Skip to content

Commit d276d60

Browse files
committed
Double tap fullscreen toggle as an option
1 parent f7279a4 commit d276d60

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

lib/src/chewie_player.dart

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -335,6 +335,7 @@ class ChewieController extends ChangeNotifier {
335335
this.hideControlsTimer = defaultHideControlsTimer,
336336
this.controlsSafeAreaMinimum = EdgeInsets.zero,
337337
this.pauseOnBackgroundTap = false,
338+
this.allowDoubleTapToggleFullScreen = true,
338339
}) : assert(
339340
playbackSpeeds.every((speed) => speed > 0),
340341
'The playbackSpeeds values must all be greater than 0',
@@ -394,6 +395,7 @@ class ChewieController extends ChangeNotifier {
394395
)?
395396
routePageBuilder,
396397
bool? pauseOnBackgroundTap,
398+
bool? allowDoubleTapToggleFullScreen,
397399
}) {
398400
return ChewieController(
399401
draggableProgressBar: draggableProgressBar ?? this.draggableProgressBar,
@@ -458,6 +460,8 @@ class ChewieController extends ChangeNotifier {
458460
progressIndicatorDelay:
459461
progressIndicatorDelay ?? this.progressIndicatorDelay,
460462
pauseOnBackgroundTap: pauseOnBackgroundTap ?? this.pauseOnBackgroundTap,
463+
allowDoubleTapToggleFullScreen:
464+
allowDoubleTapToggleFullScreen ?? this.allowDoubleTapToggleFullScreen,
461465
);
462466
}
463467

@@ -630,6 +634,9 @@ class ChewieController extends ChangeNotifier {
630634
/// Defines if the player should pause when the background is tapped
631635
final bool pauseOnBackgroundTap;
632636

637+
/// Defines if double tap should toggle fullscreen mode
638+
final bool allowDoubleTapToggleFullScreen;
639+
633640
static ChewieController of(BuildContext context) {
634641
final chewieControllerProvider = context
635642
.dependOnInheritedWidgetOfExactType<ChewieControllerProvider>()!;

lib/src/material/material_controls.dart

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -374,9 +374,9 @@ class _MaterialControlsState extends State<MaterialControls>
374374
});
375375
}
376376
},
377-
onDoubleTap: () {
378-
_onExpandCollapse();
379-
},
377+
onDoubleTap: chewieController.allowDoubleTapToggleFullScreen
378+
? _onExpandCollapse
379+
: null,
380380
child: Container(
381381
alignment: Alignment.center,
382382
color: Colors

0 commit comments

Comments
 (0)