Skip to content

Commit

Permalink
Only reinitialize if ChewieController changed
Browse files Browse the repository at this point in the history
  • Loading branch information
cbenhagen committed Jan 23, 2019
1 parent 2bd06b7 commit fc1bc16
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
7 changes: 5 additions & 2 deletions lib/src/cupertino_controls.dart
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,14 @@ class _CupertinoControlsState extends State<CupertinoControls> {

@override
void didChangeDependencies() {
final _oldController = chewieController;
chewieController = ChewieController.of(context);
controller = chewieController.videoPlayerController;

_dispose();
_initialize();
if (_oldController != chewieController) {
_dispose();
_initialize();
}

super.didChangeDependencies();
}
Expand Down
7 changes: 5 additions & 2 deletions lib/src/material_controls.dart
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,14 @@ class _MaterialControlsState extends State<MaterialControls> {

@override
void didChangeDependencies() {
final _oldController = chewieController;
chewieController = ChewieController.of(context);
controller = chewieController.videoPlayerController;

_dispose();
_initialize();
if (_oldController != chewieController) {
_dispose();
_initialize();
}

super.didChangeDependencies();
}
Expand Down

0 comments on commit fc1bc16

Please sign in to comment.