-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update for the overlay builder #713
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,6 +20,16 @@ class PlayerWithControls extends StatelessWidget { | |
return width > height ? width / height : height / width; | ||
} | ||
|
||
Widget buildOverlay(BuildContext context) { | ||
if(chewieController.overlayBuilder != null) { | ||
return chewieController.overlayBuilder!(context); | ||
} | ||
if (chewieController.overlay != null) { | ||
return chewieController.overlay!; | ||
} | ||
return const SizedBox.shrink(); | ||
Comment on lines
+24
to
+30
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This should be chained as an if-else statement, with it defaulting to For bonus credit, instead of using a function to compute the correct Widget to return, why not move it into a standalone widget that takes in the current controller and computes it when |
||
} | ||
|
||
Widget buildControls( | ||
BuildContext context, | ||
ChewieController chewieController, | ||
|
@@ -50,7 +60,7 @@ class PlayerWithControls extends StatelessWidget { | |
), | ||
), | ||
), | ||
if (chewieController.overlay != null) chewieController.overlay!, | ||
buildOverlay(context), | ||
if (Theme.of(context).platform != TargetPlatform.iOS) | ||
Consumer<PlayerNotifier>( | ||
builder: ( | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be
final
since we're trying to make the controller immutable.