Ver Fonte

Add option to hide mute button

Ben Hagen há 6 anos atrás
pai
commit
c2bc3bfaff

+ 4 - 0
lib/src/chewie_player.dart

@@ -159,6 +159,7 @@ class ChewieController extends ChangeNotifier {
     this.allowedScreenSleep = true,
     this.isLive = false,
     this.allowFullScreen = true,
+    this.allowMuting = true,
     this.systemOverlaysAfterFullScreen = SystemUiOverlay.values,
     this.deviceOrientationsAfterFullScreen = const [
       DeviceOrientation.portraitUp,
@@ -223,6 +224,9 @@ class ChewieController extends ChangeNotifier {
   /// Defines if the fullscreen control should be shown
   final bool allowFullScreen;
 
+  /// Defines if the mute control should be shown
+  final bool allowMuting;
+
   /// Defines the system overlays visible after exiting fullscreen
   final List<SystemUiOverlay> systemOverlaysAfterFullScreen;
 

+ 4 - 2
lib/src/cupertino_controls.dart

@@ -381,8 +381,10 @@ class _CupertinoControlsState extends State<CupertinoControls> {
                   backgroundColor, iconColor, barHeight, buttonPadding)
               : Container(),
           Expanded(child: Container()),
-          _buildMuteButton(
-              controller, backgroundColor, iconColor, barHeight, buttonPadding),
+          chewieController.allowMuting
+              ? _buildMuteButton(controller, backgroundColor, iconColor,
+                  barHeight, buttonPadding)
+              : Container(),
         ],
       ),
     );

+ 3 - 1
lib/src/material_controls.dart

@@ -95,7 +95,9 @@ class _MaterialControlsState extends State<MaterialControls> {
                 ? Expanded(child: const Text('LIVE'))
                 : _buildPosition(iconColor),
             chewieController.isLive ? const SizedBox() : _buildProgressBar(),
-            _buildMuteButton(controller),
+            chewieController.allowMuting
+                ? _buildMuteButton(controller)
+                : Container(),
             chewieController.allowFullScreen
                 ? _buildExpandButton()
                 : Container(),