Skip to content

Commit 7ba611a

Browse files
authored
Merge pull request #826 from yujune/master
2 parents 75085dc + ecd76ac commit 7ba611a

7 files changed

+19
-4
lines changed

lib/chewie.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,6 @@ export 'src/chewie_player.dart';
44
export 'src/chewie_progress_colors.dart';
55
export 'src/cupertino/cupertino_controls.dart';
66
export 'src/material/material_controls.dart';
7+
export 'src/material/material_progress_bar.dart';
78
export 'src/material/material_desktop_controls.dart';
89
export 'src/models/index.dart';

lib/src/cupertino/cupertino_controls.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -722,6 +722,7 @@ class _CupertinoControlsState extends State<CupertinoControls>
722722
255,
723723
),
724724
),
725+
draggableProgressBar: chewieController.draggableProgressBar,
725726
),
726727
),
727728
);

lib/src/cupertino/cupertino_progress_bar.dart

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,15 @@ class CupertinoVideoProgressBar extends StatelessWidget {
1212
this.onDragStart,
1313
this.onDragUpdate,
1414
super.key,
15+
this.draggableProgressBar = true,
1516
}) : colors = colors ?? ChewieProgressColors();
1617

1718
final VideoPlayerController controller;
1819
final ChewieProgressColors colors;
1920
final Function()? onDragStart;
2021
final Function()? onDragEnd;
2122
final Function()? onDragUpdate;
23+
final bool draggableProgressBar;
2224

2325
@override
2426
Widget build(BuildContext context) {
@@ -31,6 +33,7 @@ class CupertinoVideoProgressBar extends StatelessWidget {
3133
onDragEnd: onDragEnd,
3234
onDragStart: onDragStart,
3335
onDragUpdate: onDragUpdate,
36+
draggableProgressBar: draggableProgressBar,
3437
);
3538
}
3639
}

lib/src/material/material_controls.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -618,6 +618,7 @@ class _MaterialControlsState extends State<MaterialControls>
618618
Theme.of(context).colorScheme.surface.withOpacity(0.5),
619619
backgroundColor: Theme.of(context).disabledColor.withOpacity(.5),
620620
),
621+
draggableProgressBar: chewieController.draggableProgressBar,
621622
),
622623
);
623624
}

lib/src/material/material_desktop_controls.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -594,6 +594,7 @@ class _MaterialDesktopControlsState extends State<MaterialDesktopControls>
594594
Theme.of(context).colorScheme.surface.withOpacity(0.5),
595595
backgroundColor: Theme.of(context).disabledColor.withOpacity(.5),
596596
),
597+
draggableProgressBar: chewieController.draggableProgressBar,
597598
),
598599
);
599600
}

lib/src/material/material_progress_bar.dart

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,31 +7,38 @@ class MaterialVideoProgressBar extends StatelessWidget {
77
MaterialVideoProgressBar(
88
this.controller, {
99
this.height = kToolbarHeight,
10+
this.barHeight = 10,
11+
this.handleHeight = 6,
1012
ChewieProgressColors? colors,
1113
this.onDragEnd,
1214
this.onDragStart,
1315
this.onDragUpdate,
1416
super.key,
17+
this.draggableProgressBar = true,
1518
}) : colors = colors ?? ChewieProgressColors();
1619

1720
final double height;
21+
final double barHeight;
22+
final double handleHeight;
1823
final VideoPlayerController controller;
1924
final ChewieProgressColors colors;
2025
final Function()? onDragStart;
2126
final Function()? onDragEnd;
2227
final Function()? onDragUpdate;
28+
final bool draggableProgressBar;
2329

2430
@override
2531
Widget build(BuildContext context) {
2632
return VideoProgressBar(
2733
controller,
28-
barHeight: 10,
29-
handleHeight: 6,
34+
barHeight: barHeight,
35+
handleHeight: handleHeight,
3036
drawShadow: true,
3137
colors: colors,
3238
onDragEnd: onDragEnd,
3339
onDragStart: onDragStart,
3440
onDragUpdate: onDragUpdate,
41+
draggableProgressBar: draggableProgressBar,
3542
);
3643
}
3744
}

lib/src/progress_bar.dart

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ class VideoProgressBar extends StatefulWidget {
99
this.onDragEnd,
1010
this.onDragStart,
1111
this.onDragUpdate,
12+
this.draggableProgressBar = true,
1213
super.key,
1314
required this.barHeight,
1415
required this.handleHeight,
@@ -24,6 +25,7 @@ class VideoProgressBar extends StatefulWidget {
2425
final double barHeight;
2526
final double handleHeight;
2627
final bool drawShadow;
28+
final bool draggableProgressBar;
2729

2830
@override
2931
// ignore: library_private_types_in_public_api
@@ -65,7 +67,6 @@ class _VideoProgressBarState extends State<VideoProgressBar> {
6567

6668
@override
6769
Widget build(BuildContext context) {
68-
final ChewieController chewieController = ChewieController.of(context);
6970
final child = Center(
7071
child: StaticProgressBar(
7172
value: controller.value,
@@ -77,7 +78,7 @@ class _VideoProgressBarState extends State<VideoProgressBar> {
7778
),
7879
);
7980

80-
return chewieController.draggableProgressBar
81+
return widget.draggableProgressBar
8182
? GestureDetector(
8283
onHorizontalDragStart: (DragStartDetails details) {
8384
if (!controller.value.isInitialized) {

0 commit comments

Comments
 (0)