فهرست منبع

Absorb pointer when controls are hidden

Ben Hagen 6 سال پیش
والد
کامیت
c80092e5d6
4فایلهای تغییر یافته به همراه44 افزوده شده و 24 حذف شده
  1. 7 3
      CHANGELOG.md
  2. 14 6
      lib/src/cupertino_controls.dart
  3. 22 14
      lib/src/material_controls.dart
  4. 1 1
      pubspec.yaml

+ 7 - 3
CHANGELOG.md

@@ -1,5 +1,9 @@
 # Changelog
 
+## 0.9.3
+
+  * Absorb pointer when controls are hidden
+
 ## 0.9.2
 
   * Add options to define system overlays after exiting full screen
@@ -16,7 +20,7 @@
 
 ## 0.8.0
 
-  * Update to work with `video_player: ">=0.7.0 <0.8.0` - Thanks @Sub6Resources 
+  * Update to work with `video_player: ">=0.7.0 <0.8.0` - Thanks @Sub6Resources
   * Preserves AspectRatio on FullScreen - Thanks @patrickb
   * Ability to start video in FullScreen - Thanks @miguelpruivo
 
@@ -49,7 +53,7 @@
   * Update to work with `video_player: ">=0.2.0 <0.3.0`
   * Add `showControls` option. You can use this to show / hide the controls
   * Move from `VideoProgressColors` to `ChewieProgressColors` for customization of the Chewie progress controls
-  * Remove `progressColors` in favor of platform-specific customizations: `cupertinoProgressColors` and `materialProgressColors` to control 
+  * Remove `progressColors` in favor of platform-specific customizations: `cupertinoProgressColors` and `materialProgressColors` to control
   * Add analysis options
 
 ## 0.2.0
@@ -58,7 +62,7 @@
 
 ## 0.1.1
 
-  * Fix images in docs for pub 
+  * Fix images in docs for pub
 
 ## 0.1.0
 

+ 14 - 6
lib/src/cupertino_controls.dart

@@ -48,12 +48,20 @@ class _CupertinoControlsState extends State<CupertinoControls> {
     final barHeight = orientation == Orientation.portrait ? 30.0 : 47.0;
     final buttonPadding = orientation == Orientation.portrait ? 16.0 : 24.0;
 
-    return Column(
-      children: <Widget>[
-        _buildTopBar(backgroundColor, iconColor, barHeight, buttonPadding),
-        _buildHitArea(),
-        _buildBottomBar(backgroundColor, iconColor, barHeight),
-      ],
+    return GestureDetector(
+      onTap: () {
+        _cancelAndRestartTimer();
+      },
+      child: AbsorbPointer(
+        absorbing: _hideStuff,
+        child: Column(
+          children: <Widget>[
+            _buildTopBar(backgroundColor, iconColor, barHeight, buttonPadding),
+            _buildHitArea(),
+            _buildBottomBar(backgroundColor, iconColor, barHeight),
+          ],
+        ),
+      ),
     );
   }
 

+ 22 - 14
lib/src/material_controls.dart

@@ -33,20 +33,28 @@ class _MaterialControlsState extends State<MaterialControls> {
 
   @override
   Widget build(BuildContext context) {
-    return Column(
-      children: <Widget>[
-        _latestValue != null &&
-                    !_latestValue.isPlaying &&
-                    _latestValue.duration == null ||
-                _latestValue.isBuffering
-            ? Expanded(
-                child: Center(
-                  child: CircularProgressIndicator(),
-                ),
-              )
-            : _buildHitArea(),
-        _buildBottomBar(context),
-      ],
+    return GestureDetector(
+      onTap: () {
+        _cancelAndRestartTimer();
+      },
+      child: AbsorbPointer(
+        absorbing: _hideStuff,
+        child: Column(
+          children: <Widget>[
+            _latestValue != null &&
+                        !_latestValue.isPlaying &&
+                        _latestValue.duration == null ||
+                    _latestValue.isBuffering
+                ? Expanded(
+                    child: Center(
+                      child: CircularProgressIndicator(),
+                    ),
+                  )
+                : _buildHitArea(),
+            _buildBottomBar(context),
+          ],
+        ),
+      ),
     );
   }
 

+ 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.2
+version: 0.9.3
 homepage: https://github.com/brianegan/chewie
 authors:
   - Brian Egan <brian@brianegan.com>