Przeglądaj źródła

fix: 修复刷新太快动画太短的问题。

Tony 1 miesiąc temu
rodzic
commit
3e488b066b

+ 7 - 2
lib/app/modules/node/controllers/node_controller.dart

@@ -121,12 +121,17 @@ class NodeController extends GetxController {
   void refreshLocations() async {
     try {
       _isRefreshing.value = true;
-      final groups = await _apiController.getLocations();
+      // 保持至少2秒的刷新过程
+      final results = await Future.wait([
+        _apiController.getLocations(),
+        Future.delayed(const Duration(milliseconds: 1500)),
+      ]);
+      final groups = results[0] as Groups;
       updateGroups(groups);
       _isRefreshing.value = false;
     } catch (_) {
       // TODO: 捕捉异常写入日志
-      Future.delayed(const Duration(seconds: 1), () {
+      Future.delayed(const Duration(milliseconds: 1500), () {
         _isRefreshing.value = false;
       });
     }