Skip to content

Commit 0da5582

Browse files
committed
Add option for overlays and orientations after fullscreen
1 parent 7959e06 commit 0da5582

File tree

1 file changed

+17
-7
lines changed

1 file changed

+17
-7
lines changed

lib/src/chewie_player.dart

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -125,13 +125,10 @@ class ChewieState extends State<Chewie> {
125125
Screen.keepOn(false);
126126
}
127127

128-
SystemChrome.setEnabledSystemUIOverlays(SystemUiOverlay.values);
129-
SystemChrome.setPreferredOrientations([
130-
DeviceOrientation.portraitUp,
131-
DeviceOrientation.portraitDown,
132-
DeviceOrientation.landscapeLeft,
133-
DeviceOrientation.landscapeRight,
134-
]);
128+
SystemChrome.setEnabledSystemUIOverlays(
129+
widget.controller.systemOverlaysAfterFullScreen);
130+
SystemChrome.setPreferredOrientations(
131+
widget.controller.deviceOrientationsAfterFullScreen);
135132
}
136133
}
137134

@@ -162,6 +159,13 @@ class ChewieController extends ChangeNotifier {
162159
this.allowedScreenSleep = true,
163160
this.isLive = false,
164161
this.allowFullScreen = true,
162+
this.systemOverlaysAfterFullScreen = SystemUiOverlay.values,
163+
this.deviceOrientationsAfterFullScreen = const [
164+
DeviceOrientation.portraitUp,
165+
DeviceOrientation.portraitDown,
166+
DeviceOrientation.landscapeLeft,
167+
DeviceOrientation.landscapeRight,
168+
],
165169
}) : assert(videoPlayerController != null,
166170
'You must provide a controller to play a video') {
167171
_initialize();
@@ -219,6 +223,12 @@ class ChewieController extends ChangeNotifier {
219223
/// Defines if the fullscreen control should be shown
220224
final bool allowFullScreen;
221225

226+
/// Defines the system overlays visible after exiting fullscreen
227+
final List<SystemUiOverlay> systemOverlaysAfterFullScreen;
228+
229+
/// Defines the set of allowed device orientations after exiting fullscreen
230+
final List<DeviceOrientation> deviceOrientationsAfterFullScreen;
231+
222232
static ChewieController of(BuildContext context) {
223233
final _ChewieControllerProvider chewieControllerProvider =
224234
context.inheritFromWidgetOfExactType(_ChewieControllerProvider);

0 commit comments

Comments
 (0)