From add6dfc3895c54886c538b61dc85285bf9e4dc47 Mon Sep 17 00:00:00 2001 From: dom Date: Sun, 28 Jun 2026 12:15:22 +0800 Subject: [PATCH] lazy init dyn refreshctrl Signed-off-by: dom --- lib/pages/dynamics_detail/view.dart | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/lib/pages/dynamics_detail/view.dart b/lib/pages/dynamics_detail/view.dart index a34d7e7b9..3beba2eda 100644 --- a/lib/pages/dynamics_detail/view.dart +++ b/lib/pages/dynamics_detail/view.dart @@ -72,7 +72,12 @@ class _DynamicDetailPageState // ).whenComplete(_stopRefresh); } - late final AnimationController _refreshController; + AnimationController? refreshController; + AnimationController get _refreshController => + refreshController ??= AnimationController( + vsync: this, + duration: CircularProgressIndicator.defaultAnimationDuration, + ); @override dynamic get arguments => {'item': controller.dynItem}; @@ -96,15 +101,11 @@ class _DynamicDetailPageState ), tag: id, ); - _refreshController = AnimationController( - vsync: this, - duration: CircularProgressIndicator.defaultAnimationDuration, - ); } @override void dispose() { - _refreshController.dispose(); + refreshController?.dispose(); super.dispose(); }