From 502dd0bbc8572da0935fbc4e57f9680027504ccd Mon Sep 17 00:00:00 2001 From: yujune Date: Wed, 3 Apr 2024 14:58:55 +0800 Subject: [PATCH 1/4] chore: export MaterialVideoProgressBar widget. --- lib/chewie.dart | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/chewie.dart b/lib/chewie.dart index 73b73c44f..549955a49 100644 --- a/lib/chewie.dart +++ b/lib/chewie.dart @@ -4,5 +4,6 @@ export 'src/chewie_player.dart'; export 'src/chewie_progress_colors.dart'; export 'src/cupertino/cupertino_controls.dart'; export 'src/material/material_controls.dart'; +export 'src/material/material_progress_bar.dart'; export 'src/material/material_desktop_controls.dart'; export 'src/models/index.dart'; From 52bcf752a1834e403b214df449dbaa1f65fd7ccb Mon Sep 17 00:00:00 2001 From: yujune Date: Wed, 3 Apr 2024 14:59:05 +0800 Subject: [PATCH 2/4] chore: add barHeight and handleHeight properties. --- lib/src/material/material_progress_bar.dart | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/src/material/material_progress_bar.dart b/lib/src/material/material_progress_bar.dart index 63b091c7d..1edac5435 100644 --- a/lib/src/material/material_progress_bar.dart +++ b/lib/src/material/material_progress_bar.dart @@ -7,6 +7,8 @@ class MaterialVideoProgressBar extends StatelessWidget { MaterialVideoProgressBar( this.controller, { this.height = kToolbarHeight, + this.barHeight = 10, + this.handleHeight = 6, ChewieProgressColors? colors, this.onDragEnd, this.onDragStart, @@ -15,6 +17,8 @@ class MaterialVideoProgressBar extends StatelessWidget { }) : colors = colors ?? ChewieProgressColors(); final double height; + final double barHeight; + final double handleHeight; final VideoPlayerController controller; final ChewieProgressColors colors; final Function()? onDragStart; @@ -25,8 +29,8 @@ class MaterialVideoProgressBar extends StatelessWidget { Widget build(BuildContext context) { return VideoProgressBar( controller, - barHeight: 10, - handleHeight: 6, + barHeight: barHeight, + handleHeight: handleHeight, drawShadow: true, colors: colors, onDragEnd: onDragEnd, From 7772acdb4563c54c01fed33404b80b9c55b508f6 Mon Sep 17 00:00:00 2001 From: yujune Date: Fri, 10 May 2024 18:06:13 +0800 Subject: [PATCH 3/4] chore: make progress bar independent on chewie controller. --- lib/src/progress_bar.dart | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/src/progress_bar.dart b/lib/src/progress_bar.dart index 2494abf36..b07a16e5b 100644 --- a/lib/src/progress_bar.dart +++ b/lib/src/progress_bar.dart @@ -9,6 +9,7 @@ class VideoProgressBar extends StatefulWidget { this.onDragEnd, this.onDragStart, this.onDragUpdate, + this.draggableProgressBar = true, super.key, required this.barHeight, required this.handleHeight, @@ -24,6 +25,7 @@ class VideoProgressBar extends StatefulWidget { final double barHeight; final double handleHeight; final bool drawShadow; + final bool draggableProgressBar; @override // ignore: library_private_types_in_public_api @@ -65,7 +67,6 @@ class _VideoProgressBarState extends State { @override Widget build(BuildContext context) { - final ChewieController chewieController = ChewieController.of(context); final child = Center( child: StaticProgressBar( value: controller.value, @@ -77,7 +78,7 @@ class _VideoProgressBarState extends State { ), ); - return chewieController.draggableProgressBar + return widget.draggableProgressBar ? GestureDetector( onHorizontalDragStart: (DragStartDetails details) { if (!controller.value.isInitialized) { From ecd76ac18594b2017d21d8914a90b1835754443f Mon Sep 17 00:00:00 2001 From: yujune Date: Wed, 4 Sep 2024 11:43:23 +0800 Subject: [PATCH 4/4] chore: pass draggableProgressBar from chewieController. --- lib/src/cupertino/cupertino_controls.dart | 1 + lib/src/cupertino/cupertino_progress_bar.dart | 3 +++ lib/src/material/material_controls.dart | 1 + lib/src/material/material_desktop_controls.dart | 1 + lib/src/material/material_progress_bar.dart | 3 +++ 5 files changed, 9 insertions(+) diff --git a/lib/src/cupertino/cupertino_controls.dart b/lib/src/cupertino/cupertino_controls.dart index df1475274..ddcc24fdf 100644 --- a/lib/src/cupertino/cupertino_controls.dart +++ b/lib/src/cupertino/cupertino_controls.dart @@ -720,6 +720,7 @@ class _CupertinoControlsState extends State 255, ), ), + draggableProgressBar: chewieController.draggableProgressBar, ), ), ); diff --git a/lib/src/cupertino/cupertino_progress_bar.dart b/lib/src/cupertino/cupertino_progress_bar.dart index 04ca99f59..f24fc0f80 100644 --- a/lib/src/cupertino/cupertino_progress_bar.dart +++ b/lib/src/cupertino/cupertino_progress_bar.dart @@ -12,6 +12,7 @@ class CupertinoVideoProgressBar extends StatelessWidget { this.onDragStart, this.onDragUpdate, super.key, + this.draggableProgressBar = true, }) : colors = colors ?? ChewieProgressColors(); final VideoPlayerController controller; @@ -19,6 +20,7 @@ class CupertinoVideoProgressBar extends StatelessWidget { final Function()? onDragStart; final Function()? onDragEnd; final Function()? onDragUpdate; + final bool draggableProgressBar; @override Widget build(BuildContext context) { @@ -31,6 +33,7 @@ class CupertinoVideoProgressBar extends StatelessWidget { onDragEnd: onDragEnd, onDragStart: onDragStart, onDragUpdate: onDragUpdate, + draggableProgressBar: draggableProgressBar, ); } } diff --git a/lib/src/material/material_controls.dart b/lib/src/material/material_controls.dart index 70711173b..aff58292a 100644 --- a/lib/src/material/material_controls.dart +++ b/lib/src/material/material_controls.dart @@ -615,6 +615,7 @@ class _MaterialControlsState extends State Theme.of(context).colorScheme.background.withOpacity(0.5), backgroundColor: Theme.of(context).disabledColor.withOpacity(.5), ), + draggableProgressBar: chewieController.draggableProgressBar, ), ); } diff --git a/lib/src/material/material_desktop_controls.dart b/lib/src/material/material_desktop_controls.dart index 41ab86906..2bac682ed 100644 --- a/lib/src/material/material_desktop_controls.dart +++ b/lib/src/material/material_desktop_controls.dart @@ -592,6 +592,7 @@ class _MaterialDesktopControlsState extends State Theme.of(context).colorScheme.background.withOpacity(0.5), backgroundColor: Theme.of(context).disabledColor.withOpacity(.5), ), + draggableProgressBar: chewieController.draggableProgressBar, ), ); } diff --git a/lib/src/material/material_progress_bar.dart b/lib/src/material/material_progress_bar.dart index 1edac5435..ba58a37d6 100644 --- a/lib/src/material/material_progress_bar.dart +++ b/lib/src/material/material_progress_bar.dart @@ -14,6 +14,7 @@ class MaterialVideoProgressBar extends StatelessWidget { this.onDragStart, this.onDragUpdate, super.key, + this.draggableProgressBar = true, }) : colors = colors ?? ChewieProgressColors(); final double height; @@ -24,6 +25,7 @@ class MaterialVideoProgressBar extends StatelessWidget { final Function()? onDragStart; final Function()? onDragEnd; final Function()? onDragUpdate; + final bool draggableProgressBar; @override Widget build(BuildContext context) { @@ -36,6 +38,7 @@ class MaterialVideoProgressBar extends StatelessWidget { onDragEnd: onDragEnd, onDragStart: onDragStart, onDragUpdate: onDragUpdate, + draggableProgressBar: draggableProgressBar, ); } }