diff --git a/lib/common/widgets/interactiveviewer_gallery/interactive_viewer_boundary.dart b/lib/common/widgets/interactiveviewer_gallery/interactive_viewer_boundary.dart index 55c3a02e7..b2ede573e 100644 --- a/lib/common/widgets/interactiveviewer_gallery/interactive_viewer_boundary.dart +++ b/lib/common/widgets/interactiveviewer_gallery/interactive_viewer_boundary.dart @@ -18,7 +18,7 @@ class InteractiveViewerBoundary extends StatefulWidget { super.key, required this.child, required this.boundaryWidth, - this.controller, + required this.controller, this.onScaleChanged, this.onLeftBoundaryHit, this.onRightBoundaryHit, @@ -43,7 +43,7 @@ class InteractiveViewerBoundary extends StatefulWidget { final double boundaryWidth; /// The [TransformationController] for the [InteractiveViewer]. - final TransformationController? controller; + final TransformationController controller; /// Called when the scale changed after an interaction ended. final ScaleChanged? onScaleChanged; @@ -68,7 +68,7 @@ class InteractiveViewerBoundary extends StatefulWidget { class InteractiveViewerBoundaryState extends State with SingleTickerProviderStateMixin { - TransformationController? _controller; + late TransformationController _controller; double? _scale; @@ -85,8 +85,7 @@ class InteractiveViewerBoundaryState extends State @override void initState() { super.initState(); - - _controller = widget.controller ?? TransformationController(); + _controller = widget.controller; _animateController = AnimationController( duration: const Duration(milliseconds: 300), @@ -98,9 +97,7 @@ class InteractiveViewerBoundaryState extends State @override void dispose() { - _controller!.dispose(); _animateController.dispose(); - super.dispose(); } @@ -183,7 +180,7 @@ class InteractiveViewerBoundaryState extends State } void _updateBoundaryDetection() { - final double scale = _controller!.value.row0[0]; + final double scale = _controller.value.row0[0]; if (_scale != scale) { // the scale changed @@ -196,7 +193,7 @@ class InteractiveViewerBoundaryState extends State return; } - final double xOffset = _controller!.value.row0[3]; + final double xOffset = _controller.value.row0[3]; final double boundaryWidth = widget.boundaryWidth; final double boundaryEnd = boundaryWidth * scale; final double xPos = boundaryEnd + xOffset; diff --git a/lib/pages/video/controller.dart b/lib/pages/video/controller.dart index c3fdf87bb..a8150a499 100644 --- a/lib/pages/video/controller.dart +++ b/lib/pages/video/controller.dart @@ -825,9 +825,6 @@ class VideoDetailController extends GetxController ?.stream .position .listen((position) { - if (!autoPlay.value) { - return; - } int currentPos = position.inSeconds; if (currentPos != _lastPos) { _lastPos = currentPos; @@ -962,7 +959,7 @@ class VideoDetailController extends GetxController isSeek: isSeek, ); if (isSkip) { - if (Pref.blockToast) { + if (autoPlay.value && Pref.blockToast) { _showBlockToast('已跳过${item.segmentType.shortTitle}片段'); } if (_isBlock && Pref.blockTrack) {