Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
bggRGjQaUbCoE
2025-10-09 10:53:29 +08:00
parent e0b0a98f0f
commit c7e7b3f9c5
2 changed files with 7 additions and 13 deletions

View File

@@ -18,7 +18,7 @@ class InteractiveViewerBoundary extends StatefulWidget {
super.key, super.key,
required this.child, required this.child,
required this.boundaryWidth, required this.boundaryWidth,
this.controller, required this.controller,
this.onScaleChanged, this.onScaleChanged,
this.onLeftBoundaryHit, this.onLeftBoundaryHit,
this.onRightBoundaryHit, this.onRightBoundaryHit,
@@ -43,7 +43,7 @@ class InteractiveViewerBoundary extends StatefulWidget {
final double boundaryWidth; final double boundaryWidth;
/// The [TransformationController] for the [InteractiveViewer]. /// The [TransformationController] for the [InteractiveViewer].
final TransformationController? controller; final TransformationController controller;
/// Called when the scale changed after an interaction ended. /// Called when the scale changed after an interaction ended.
final ScaleChanged? onScaleChanged; final ScaleChanged? onScaleChanged;
@@ -68,7 +68,7 @@ class InteractiveViewerBoundary extends StatefulWidget {
class InteractiveViewerBoundaryState extends State<InteractiveViewerBoundary> class InteractiveViewerBoundaryState extends State<InteractiveViewerBoundary>
with SingleTickerProviderStateMixin { with SingleTickerProviderStateMixin {
TransformationController? _controller; late TransformationController _controller;
double? _scale; double? _scale;
@@ -85,8 +85,7 @@ class InteractiveViewerBoundaryState extends State<InteractiveViewerBoundary>
@override @override
void initState() { void initState() {
super.initState(); super.initState();
_controller = widget.controller;
_controller = widget.controller ?? TransformationController();
_animateController = AnimationController( _animateController = AnimationController(
duration: const Duration(milliseconds: 300), duration: const Duration(milliseconds: 300),
@@ -98,9 +97,7 @@ class InteractiveViewerBoundaryState extends State<InteractiveViewerBoundary>
@override @override
void dispose() { void dispose() {
_controller!.dispose();
_animateController.dispose(); _animateController.dispose();
super.dispose(); super.dispose();
} }
@@ -183,7 +180,7 @@ class InteractiveViewerBoundaryState extends State<InteractiveViewerBoundary>
} }
void _updateBoundaryDetection() { void _updateBoundaryDetection() {
final double scale = _controller!.value.row0[0]; final double scale = _controller.value.row0[0];
if (_scale != scale) { if (_scale != scale) {
// the scale changed // the scale changed
@@ -196,7 +193,7 @@ class InteractiveViewerBoundaryState extends State<InteractiveViewerBoundary>
return; return;
} }
final double xOffset = _controller!.value.row0[3]; final double xOffset = _controller.value.row0[3];
final double boundaryWidth = widget.boundaryWidth; final double boundaryWidth = widget.boundaryWidth;
final double boundaryEnd = boundaryWidth * scale; final double boundaryEnd = boundaryWidth * scale;
final double xPos = boundaryEnd + xOffset; final double xPos = boundaryEnd + xOffset;

View File

@@ -825,9 +825,6 @@ class VideoDetailController extends GetxController
?.stream ?.stream
.position .position
.listen((position) { .listen((position) {
if (!autoPlay.value) {
return;
}
int currentPos = position.inSeconds; int currentPos = position.inSeconds;
if (currentPos != _lastPos) { if (currentPos != _lastPos) {
_lastPos = currentPos; _lastPos = currentPos;
@@ -962,7 +959,7 @@ class VideoDetailController extends GetxController
isSeek: isSeek, isSeek: isSeek,
); );
if (isSkip) { if (isSkip) {
if (Pref.blockToast) { if (autoPlay.value && Pref.blockToast) {
_showBlockToast('已跳过${item.segmentType.shortTitle}片段'); _showBlockToast('已跳过${item.segmentType.shortTitle}片段');
} }
if (_isBlock && Pref.blockTrack) { if (_isBlock && Pref.blockTrack) {