Skip to content

Commit a4d847b

Browse files
committed
Add swipedown exists fullscreen feature
1 parent 8b11166 commit a4d847b

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

lib/src/chewie_player.dart

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -104,10 +104,19 @@ class ChewieState extends State<Chewie> {
104104
) {
105105
return Scaffold(
106106
resizeToAvoidBottomInset: false,
107-
body: Container(
108-
alignment: Alignment.center,
109-
color: Colors.black,
110-
child: controllerProvider,
107+
body: GestureDetector(
108+
onVerticalDragEnd: (DragEndDetails details) {
109+
// A positive dy indicates a downward swipe. Use a threshold to avoid accidental triggers.
110+
final double dy = details.primaryVelocity ?? 0;
111+
if (dy > 300) {
112+
widget.controller.exitFullScreen();
113+
}
114+
},
115+
child: Container(
116+
alignment: Alignment.center,
117+
color: Colors.black,
118+
child: controllerProvider,
119+
),
111120
),
112121
);
113122
}

0 commit comments

Comments
 (0)