exitFullscreen function
Makes the Video present in the current BuildContext exit fullscreen.
Implementation
Future<void> exitFullscreen(BuildContext context) {
return lock.synchronized(() async {
if (isFullscreen(context)) {
if (context.mounted) {
Navigator.of(context).maybePop();
// It is known that this [context] will have a [FullscreenInheritedWidget] above it.
FullscreenInheritedWidget.of(context).parent.refreshView();
}
// [exitNativeFullscreen] is moved to [WillPopScope] in [FullscreenInheritedWidget].
// This is because [exitNativeFullscreen] needs to be called when the user presses the back button.
}
});
}