Przeglądaj źródła

Add option to hide full screen button

Ben Hagen 6 lat temu
rodzic
commit
23532e1704

+ 4 - 0
CHANGELOG.md

@@ -1,5 +1,9 @@
 # Changelog
 
+## 0.9.1
+
+  * Add option to hide full screen button
+
 ## 0.9.0
 
   * **Breaking changes**: Add a `ChewieController` to make customizations and control from outside of the player easier.

+ 4 - 0
lib/src/chewie_player.dart

@@ -161,6 +161,7 @@ class ChewieController extends ChangeNotifier {
     this.customControls,
     this.allowedScreenSleep = true,
     this.isLive = false,
+    this.allowFullScreen = true,
   }) : assert(videoPlayerController != null,
             'You must provide a controller to play a video') {
     _initialize();
@@ -215,6 +216,9 @@ class ChewieController extends ChangeNotifier {
   /// Defines if the controls should be for live stream video
   final bool isLive;
 
+  /// Defines if the fullscreen control should be shown
+  final bool allowFullScreen;
+
   static ChewieController of(BuildContext context) {
     final _ChewieControllerProvider chewieControllerProvider =
         context.inheritFromWidgetOfExactType(_ChewieControllerProvider);

+ 4 - 2
lib/src/cupertino_controls.dart

@@ -376,8 +376,10 @@ class _CupertinoControlsState extends State<CupertinoControls> {
       ),
       child: Row(
         children: <Widget>[
-          _buildExpandButton(
-              backgroundColor, iconColor, barHeight, buttonPadding),
+          chewieController.allowFullScreen
+              ? _buildExpandButton(
+                  backgroundColor, iconColor, barHeight, buttonPadding)
+              : Container(),
           Expanded(child: Container()),
           _buildMuteButton(
               controller, backgroundColor, iconColor, barHeight, buttonPadding),

+ 3 - 1
lib/src/material_controls.dart

@@ -96,7 +96,9 @@ class _MaterialControlsState extends State<MaterialControls> {
                 : _buildPosition(iconColor),
             chewieController.isLive ? const SizedBox() : _buildProgressBar(),
             _buildMuteButton(controller),
-            _buildExpandButton(),
+            chewieController.allowFullScreen
+                ? _buildExpandButton()
+                : Container(),
           ],
         ),
       ),

+ 1 - 1
pubspec.yaml

@@ -1,6 +1,6 @@
 name: chewie
 description: A video player for Flutter with Cupertino and Material play controls
-version: 0.9.0
+version: 0.9.1
 homepage: https://github.com/brianegan/chewie
 authors:
   - Brian Egan <brian@brianegan.com>