Skip to content
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

added boolean param for fix fullscreen in nested route #239

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion lib/src/flick_video_player.dart
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ class FlickVideoPlayer extends StatefulWidget {
this.wakelockEnabled = true,
this.wakelockEnabledFullscreen = true,
this.webKeyDownHandler = flickDefaultWebKeyDownHandler,
this.useRootOverlay = false
}) : super(key: key);

final FlickManager flickManager;
Expand Down Expand Up @@ -61,6 +62,9 @@ class FlickVideoPlayer extends StatefulWidget {
/// Prevents the screen from turning off automatically in full-screen.
final bool wakelockEnabledFullscreen;

/// Open video to fullscreen in nested route screen
final bool useRootOverlay;

/// Callback called on keyDown for web, used for keyboard shortcuts.
final Function(KeyboardEvent, FlickManager) webKeyDownHandler;

Expand All @@ -72,10 +76,12 @@ class _FlickVideoPlayerState extends State<FlickVideoPlayer> {
late FlickManager flickManager;
bool _isFullscreen = false;
OverlayEntry? _overlayEntry;
late bool _useRootOverlay;

@override
void initState() {
flickManager = widget.flickManager;
_useRootOverlay = widget.useRootOverlay;
flickManager.registerContext(context);
flickManager.flickControlManager!.addListener(listener);
_setSystemUIOverlays();
Expand Down Expand Up @@ -138,7 +144,7 @@ class _FlickVideoPlayerState extends State<FlickVideoPlayer> {
);
});

Overlay.of(context)!.insert(_overlayEntry!);
Overlay.of(context, rootOverlay: this._useRootOverlay)!.insert(_overlayEntry!);
}

_exitFullscreen() {
Expand Down