From aa740e60399cb37a0e88dc5b8d5fbea08f42b211 Mon Sep 17 00:00:00 2001 From: ppmurmu Date: Thu, 29 Sep 2022 16:04:43 +0530 Subject: [PATCH 1/4] added backward forward --- lib/src/chewie_player.dart | 5 +++ lib/src/material/material_controls.dart | 56 +++++++++++++++++++++++++ 2 files changed, 61 insertions(+) diff --git a/lib/src/chewie_player.dart b/lib/src/chewie_player.dart index 23d075b72..c858ff708 100644 --- a/lib/src/chewie_player.dart +++ b/lib/src/chewie_player.dart @@ -537,6 +537,8 @@ class ChewieController extends ChangeNotifier { bool get isFullScreen => _isFullScreen; bool get isPlaying => videoPlayerController.value.isPlaying; + ///-------------- + Future _initialize() async { await videoPlayerController.setLooping(looping); @@ -606,6 +608,9 @@ class ChewieController extends ChangeNotifier { await videoPlayerController.seekTo(moment); } + ///------------- + + Future setVolume(double volume) async { await videoPlayerController.setVolume(volume); } diff --git a/lib/src/material/material_controls.dart b/lib/src/material/material_controls.dart index 081f4b5cc..e4f19cd8c 100644 --- a/lib/src/material/material_controls.dart +++ b/lib/src/material/material_controls.dart @@ -276,6 +276,8 @@ class _MaterialControlsState extends State _buildPosition(iconColor), if (chewieController.allowMuting) _buildMuteButton(controller), + _buildBackwardButton(), + _buildForwardButton(), const Spacer(), if (chewieController.allowFullScreen) _buildExpandButton(), ], @@ -335,6 +337,60 @@ class _MaterialControlsState extends State ); } + GestureDetector _buildForwardButton() { + return GestureDetector( + onTap: () { + controller.seekTo( + Duration(seconds: controller.value.position.inSeconds + 10)); + }, + child: AnimatedOpacity( + opacity: notifier.hideStuff ? 0.0 : 1.0, + duration: const Duration(milliseconds: 300), + child: Container( + height: barHeight + (chewieController.isFullScreen ? 15.0 : 0), + margin: const EdgeInsets.only(right: 12.0), + padding: const EdgeInsets.only( + left: 8.0, + right: 8.0, + ), + child: Center( + child: Icon( + Icons.forward_10_rounded, + color: Colors.white, + ), + ), + ), + ), + ); + } + + GestureDetector _buildBackwardButton() { + return GestureDetector( + onTap: () { + controller.seekTo( + Duration(seconds: controller.value.position.inSeconds - 10)); + }, + child: AnimatedOpacity( + opacity: notifier.hideStuff ? 0.0 : 1.0, + duration: const Duration(milliseconds: 300), + child: Container( + height: barHeight + (chewieController.isFullScreen ? 15.0 : 0), + margin: const EdgeInsets.only(right: 12.0), + padding: const EdgeInsets.only( + left: 8.0, + right: 8.0, + ), + child: Center( + child: Icon( + Icons.replay_10_rounded, + color: Colors.white, + ), + ), + ), + ), + ); + } + GestureDetector _buildExpandButton() { return GestureDetector( onTap: _onExpandCollapse, From d1d233cec09b22a81a271bb0b123c1403de21627 Mon Sep 17 00:00:00 2001 From: ppmurmu Date: Thu, 29 Sep 2022 16:53:53 +0530 Subject: [PATCH 2/4] added backdrop --- lib/src/material/material_controls.dart | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/lib/src/material/material_controls.dart b/lib/src/material/material_controls.dart index e4f19cd8c..3c984f1ad 100644 --- a/lib/src/material/material_controls.dart +++ b/lib/src/material/material_controls.dart @@ -255,6 +255,7 @@ class _MaterialControlsState extends State opacity: notifier.hideStuff ? 0.0 : 1.0, duration: const Duration(milliseconds: 300), child: Container( + color: Colors.black.withOpacity(0.45), height: barHeight + (chewieController.isFullScreen ? 10.0 : 0), padding: EdgeInsets.only( left: 20, @@ -276,8 +277,8 @@ class _MaterialControlsState extends State _buildPosition(iconColor), if (chewieController.allowMuting) _buildMuteButton(controller), - _buildBackwardButton(), - _buildForwardButton(), + if (!chewieController.isLive) _buildBackwardButton(), + if (!chewieController.isLive) _buildForwardButton(), const Spacer(), if (chewieController.allowFullScreen) _buildExpandButton(), ], @@ -353,7 +354,7 @@ class _MaterialControlsState extends State left: 8.0, right: 8.0, ), - child: Center( + child: const Center( child: Icon( Icons.forward_10_rounded, color: Colors.white, @@ -380,7 +381,7 @@ class _MaterialControlsState extends State left: 8.0, right: 8.0, ), - child: Center( + child: const Center( child: Icon( Icons.replay_10_rounded, color: Colors.white, From c8907a7c785d836a471f4911a5dfbcf8efaf8b37 Mon Sep 17 00:00:00 2001 From: ppmurmu Date: Thu, 29 Sep 2022 17:29:35 +0530 Subject: [PATCH 3/4] live color changed --- lib/src/material/material_controls.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/src/material/material_controls.dart b/lib/src/material/material_controls.dart index 3c984f1ad..d6ef65dd9 100644 --- a/lib/src/material/material_controls.dart +++ b/lib/src/material/material_controls.dart @@ -272,7 +272,7 @@ class _MaterialControlsState extends State mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ if (chewieController.isLive) - const Expanded(child: Text('LIVE')) + const Expanded(child: Text('LIVE' , style: TextStyle(color: Colors.red),)) else _buildPosition(iconColor), if (chewieController.allowMuting) From 3dd12951bbd6a51bbba07ae687c2904142815ad1 Mon Sep 17 00:00:00 2001 From: ppmurmu Date: Thu, 29 Sep 2022 18:02:43 +0530 Subject: [PATCH 4/4] opacity 0.35 --- lib/src/material/material_controls.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/src/material/material_controls.dart b/lib/src/material/material_controls.dart index d6ef65dd9..12de3df6d 100644 --- a/lib/src/material/material_controls.dart +++ b/lib/src/material/material_controls.dart @@ -255,7 +255,7 @@ class _MaterialControlsState extends State opacity: notifier.hideStuff ? 0.0 : 1.0, duration: const Duration(milliseconds: 300), child: Container( - color: Colors.black.withOpacity(0.45), + color: Colors.black.withOpacity(0.35), height: barHeight + (chewieController.isFullScreen ? 10.0 : 0), padding: EdgeInsets.only( left: 20,