Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add barHeight and handleHeight for MaterialVideoProgressBar #826

Merged
merged 4 commits into from
Sep 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions lib/chewie.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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';
1 change: 1 addition & 0 deletions lib/src/cupertino/cupertino_controls.dart
Original file line number Diff line number Diff line change
Expand Up @@ -720,6 +720,7 @@ class _CupertinoControlsState extends State<CupertinoControls>
255,
),
),
draggableProgressBar: chewieController.draggableProgressBar,
),
),
);
Expand Down
3 changes: 3 additions & 0 deletions lib/src/cupertino/cupertino_progress_bar.dart
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,15 @@ class CupertinoVideoProgressBar extends StatelessWidget {
this.onDragStart,
this.onDragUpdate,
super.key,
this.draggableProgressBar = true,
}) : colors = colors ?? ChewieProgressColors();

final VideoPlayerController controller;
final ChewieProgressColors colors;
final Function()? onDragStart;
final Function()? onDragEnd;
final Function()? onDragUpdate;
final bool draggableProgressBar;

@override
Widget build(BuildContext context) {
Expand All @@ -31,6 +33,7 @@ class CupertinoVideoProgressBar extends StatelessWidget {
onDragEnd: onDragEnd,
onDragStart: onDragStart,
onDragUpdate: onDragUpdate,
draggableProgressBar: draggableProgressBar,
);
}
}
1 change: 1 addition & 0 deletions lib/src/material/material_controls.dart
Original file line number Diff line number Diff line change
Expand Up @@ -615,6 +615,7 @@ class _MaterialControlsState extends State<MaterialControls>
Theme.of(context).colorScheme.background.withOpacity(0.5),
backgroundColor: Theme.of(context).disabledColor.withOpacity(.5),
),
draggableProgressBar: chewieController.draggableProgressBar,
),
);
}
Expand Down
1 change: 1 addition & 0 deletions lib/src/material/material_desktop_controls.dart
Original file line number Diff line number Diff line change
Expand Up @@ -592,6 +592,7 @@ class _MaterialDesktopControlsState extends State<MaterialDesktopControls>
Theme.of(context).colorScheme.background.withOpacity(0.5),
backgroundColor: Theme.of(context).disabledColor.withOpacity(.5),
),
draggableProgressBar: chewieController.draggableProgressBar,
),
);
}
Expand Down
11 changes: 9 additions & 2 deletions lib/src/material/material_progress_bar.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,31 +7,38 @@ class MaterialVideoProgressBar extends StatelessWidget {
MaterialVideoProgressBar(
this.controller, {
this.height = kToolbarHeight,
this.barHeight = 10,
this.handleHeight = 6,
ChewieProgressColors? colors,
this.onDragEnd,
this.onDragStart,
this.onDragUpdate,
super.key,
this.draggableProgressBar = true,
}) : colors = colors ?? ChewieProgressColors();

final double height;
final double barHeight;
final double handleHeight;
final VideoPlayerController controller;
final ChewieProgressColors colors;
final Function()? onDragStart;
final Function()? onDragEnd;
final Function()? onDragUpdate;
final bool draggableProgressBar;

@override
Widget build(BuildContext context) {
return VideoProgressBar(
controller,
barHeight: 10,
handleHeight: 6,
barHeight: barHeight,
handleHeight: handleHeight,
drawShadow: true,
colors: colors,
onDragEnd: onDragEnd,
onDragStart: onDragStart,
onDragUpdate: onDragUpdate,
draggableProgressBar: draggableProgressBar,
);
}
}
5 changes: 3 additions & 2 deletions lib/src/progress_bar.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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
Expand Down Expand Up @@ -65,7 +67,6 @@ class _VideoProgressBarState extends State<VideoProgressBar> {

@override
Widget build(BuildContext context) {
final ChewieController chewieController = ChewieController.of(context);
final child = Center(
child: StaticProgressBar(
value: controller.value,
Expand All @@ -77,7 +78,7 @@ class _VideoProgressBarState extends State<VideoProgressBar> {
),
);

return chewieController.draggableProgressBar
return widget.draggableProgressBar
diegotori marked this conversation as resolved.
Show resolved Hide resolved
? GestureDetector(
onHorizontalDragStart: (DragStartDetails details) {
if (!controller.value.isInitialized) {
Expand Down