diff --git a/lib/common/widgets/interactiveviewer_gallery/interactive_viewer_boundary.dart b/lib/common/widgets/interactiveviewer_gallery/interactive_viewer_boundary.dart index beba6861c..84675b2b0 100644 --- a/lib/common/widgets/interactiveviewer_gallery/interactive_viewer_boundary.dart +++ b/lib/common/widgets/interactiveviewer_gallery/interactive_viewer_boundary.dart @@ -75,6 +75,17 @@ class InteractiveViewerBoundaryState extends State ); _updateMoveAnimation(); + + _scaleAnimation = _animateController.drive( + Tween(begin: 1.0, end: 0.25), + ); + + _opacityAnimation = _animateController.drive( + DecorationTween( + begin: const BoxDecoration(color: Colors.black), + end: const BoxDecoration(color: Colors.transparent), + ), + ); } @override @@ -86,31 +97,12 @@ class InteractiveViewerBoundaryState extends State void _updateMoveAnimation() { final double endX = _offset.dx.sign * (_offset.dx.abs() / _offset.dy.abs()); final double endY = _offset.dy.sign; - _slideAnimation = _animateController.drive( Tween( begin: Offset.zero, end: Offset(endX, endY), ), ); - - _scaleAnimation = _animateController.drive( - Tween( - begin: 1.0, - end: 0.25, - ), - ); - - _opacityAnimation = _animateController.drive( - DecorationTween( - begin: const BoxDecoration( - color: Colors.black, - ), - end: const BoxDecoration( - color: Colors.transparent, - ), - ), - ); } void _handleDragStart(ScaleStartDetails details) { diff --git a/lib/pages/dynamics_tab/view.dart b/lib/pages/dynamics_tab/view.dart index 6d56e96ba..851a42377 100644 --- a/lib/pages/dynamics_tab/view.dart +++ b/lib/pages/dynamics_tab/view.dart @@ -36,12 +36,7 @@ class _DynamicsTabPageState DynamicsController dynamicsController = Get.putOrFind(DynamicsController.new); @override - late final DynamicsTabController controller = Get.putOrFind( - () => - DynamicsTabController(dynamicsType: widget.dynamicsType) - ..mid = dynamicsController.mid.value, - tag: widget.dynamicsType.name, - ); + late final DynamicsTabController controller; @override bool get wantKeepAlive => true; @@ -68,6 +63,12 @@ class _DynamicsTabPageState @override void initState() { + controller = Get.putOrFind( + () => + DynamicsTabController(dynamicsType: widget.dynamicsType) + ..mid = dynamicsController.mid.value, + tag: widget.dynamicsType.name, + ); super.initState(); if (widget.dynamicsType == DynamicsTabType.up) { _listener = dynamicsController.mid.listen((mid) { diff --git a/lib/pages/member_contribute/view.dart b/lib/pages/member_contribute/view.dart index 2a9a4047e..2e82de64b 100644 --- a/lib/pages/member_contribute/view.dart +++ b/lib/pages/member_contribute/view.dart @@ -33,13 +33,19 @@ class _MemberContributeState extends State @override bool get wantKeepAlive => true; - late final _controller = Get.putOrFind( - () => MemberContributeCtr( - heroTag: widget.heroTag, - initialIndex: widget.initialIndex, - ), - tag: widget.heroTag, - ); + late final MemberContributeCtr _controller; + + @override + void initState() { + super.initState(); + _controller = Get.putOrFind( + () => MemberContributeCtr( + heroTag: widget.heroTag, + initialIndex: widget.initialIndex, + ), + tag: widget.heroTag, + ); + } @override Widget build(BuildContext context) { diff --git a/lib/pages/music/video/view.dart b/lib/pages/music/video/view.dart index a04faf342..2d6bad63a 100644 --- a/lib/pages/music/video/view.dart +++ b/lib/pages/music/video/view.dart @@ -20,7 +20,7 @@ class MusicRecommendPage extends StatefulWidget { class _MusicRecommendPageState extends State with GridMixin { - late final MusicRecommendController _controller = Get.putOrFind( + final MusicRecommendController _controller = Get.putOrFind( MusicRecommendController.new, tag: (Get.arguments as MusicRecommendArgs).id, ); diff --git a/lib/pages/music/view.dart b/lib/pages/music/view.dart index 51a859c56..03cd99125 100644 --- a/lib/pages/music/view.dart +++ b/lib/pages/music/view.dart @@ -40,7 +40,7 @@ class MusicDetailPage extends StatefulWidget { class _MusicDetailPageState extends CommonDynPageState { @override - late final MusicDetailController controller = Get.putOrFind( + final MusicDetailController controller = Get.putOrFind( MusicDetailController.new, tag: Get.parameters['musicId']!, ); diff --git a/lib/pages/video/related/view.dart b/lib/pages/video/related/view.dart index 1da596cd3..6e1096507 100644 --- a/lib/pages/video/related/view.dart +++ b/lib/pages/video/related/view.dart @@ -16,10 +16,16 @@ class RelatedVideoPanel extends StatefulWidget { } class _RelatedVideoPanelState extends State with GridMixin { - late final RelatedController _relatedController = Get.putOrFind( - RelatedController.new, - tag: widget.heroTag, - ); + late final RelatedController _relatedController; + + @override + void initState() { + super.initState(); + _relatedController = Get.putOrFind( + RelatedController.new, + tag: widget.heroTag, + ); + } @override Widget build(BuildContext context) {