Browse Source

修复扦样单页面Loading报错的问题;

maqiang 7 months ago
parent
commit
1d765cb9f4

+ 8 - 7
lib/page/sample_task/reap_sample_detail/reap_sample_basic_detail_page.dart

@@ -61,8 +61,7 @@ class _ReapSampleBasicDetailPageState extends BaseLifecycleState<ReapSampleBasic
61
   List<CardMenuData> personList = [];
61
   List<CardMenuData> personList = [];
62
 
62
 
63
   /// 获取行政区划列表
63
   /// 获取行政区划列表
64
-  Future<List<CardMenuData>?> getDistrictList(num level, {num? id, bool showLoading = true}) async {
65
-    if (showLoading) MyNavigator.showLoading();
64
+  Future<List<CardMenuData>?> getDistrictList(num level, {num? id}) async {
66
     try {
65
     try {
67
       var rsp = await MyApi.get().districtList(level, id: id);
66
       var rsp = await MyApi.get().districtList(level, id: id);
68
       List<CardMenuData> list = (rsp.data ?? []).map((e) => CardMenuData(e.uname, e.id)).toList();
67
       List<CardMenuData> list = (rsp.data ?? []).map((e) => CardMenuData(e.uname, e.id)).toList();
@@ -71,12 +70,10 @@ class _ReapSampleBasicDetailPageState extends BaseLifecycleState<ReapSampleBasic
71
       } else if (level == 5) {
70
       } else if (level == 5) {
72
         cunList.value = list;
71
         cunList.value = list;
73
       }
72
       }
74
-      if (showLoading) MyNavigator.dismissLoading();
75
       return list;
73
       return list;
76
     } catch (e) {
74
     } catch (e) {
77
       logger.e(e);
75
       logger.e(e);
78
     }
76
     }
79
-    if (showLoading) MyNavigator.dismissLoading();
80
     return null;
77
     return null;
81
   }
78
   }
82
 
79
 
@@ -200,7 +197,7 @@ class _ReapSampleBasicDetailPageState extends BaseLifecycleState<ReapSampleBasic
200
       MyNavigator.showLoading();
197
       MyNavigator.showLoading();
201
       bool stepSuccess = false;
198
       bool stepSuccess = false;
202
       // 省
199
       // 省
203
-      var provinceList = await getDistrictList(1, showLoading: false);
200
+      var provinceList = await getDistrictList(1);
204
       if (provinceList != null) {
201
       if (provinceList != null) {
205
         for (CardMenuData item in provinceList) {
202
         for (CardMenuData item in provinceList) {
206
           if (item.name == province) {
203
           if (item.name == province) {
@@ -212,7 +209,7 @@ class _ReapSampleBasicDetailPageState extends BaseLifecycleState<ReapSampleBasic
212
         if (stepSuccess) {
209
         if (stepSuccess) {
213
           stepSuccess = false;
210
           stepSuccess = false;
214
           // 市
211
           // 市
215
-          var cityList = await getDistrictList(2, id: sheng.value!.value, showLoading: false);
212
+          var cityList = await getDistrictList(2, id: sheng.value!.value);
216
           if (cityList == null) return;
213
           if (cityList == null) return;
217
           for (CardMenuData item in cityList) {
214
           for (CardMenuData item in cityList) {
218
             if (item.name == city) {
215
             if (item.name == city) {
@@ -226,7 +223,7 @@ class _ReapSampleBasicDetailPageState extends BaseLifecycleState<ReapSampleBasic
226
             stepSuccess = false;
223
             stepSuccess = false;
227
             // 区
224
             // 区
228
             if (district.isNotEmpty) {
225
             if (district.isNotEmpty) {
229
-              var districtList = await getDistrictList(3, id: shi.value!.value, showLoading: false);
226
+              var districtList = await getDistrictList(3, id: shi.value!.value);
230
               if (districtList == null) return;
227
               if (districtList == null) return;
231
               for (CardMenuData item in districtList) {
228
               for (CardMenuData item in districtList) {
232
                 if (item.name == district) {
229
                 if (item.name == district) {
@@ -434,6 +431,10 @@ class _ReapSampleBasicDetailPageState extends BaseLifecycleState<ReapSampleBasic
434
     data = widget.data;
431
     data = widget.data;
435
     isDetail = widget.detail;
432
     isDetail = widget.detail;
436
     widget.ctrl.verifyData = verifyData;
433
     widget.ctrl.verifyData = verifyData;
434
+  }
435
+
436
+  @override
437
+  void onFirstShow(Duration timeStamp) {
437
     // 土壤信息
438
     // 土壤信息
438
     getTrxxList();
439
     getTrxxList();
439
 
440
 

+ 7 - 1
lib/page/sample_task/reap_sample_detail/reap_sample_variety_detail_page.dart

@@ -1,5 +1,6 @@
1
 import 'package:flutter/material.dart';
1
 import 'package:flutter/material.dart';
2
 import 'package:lszlgl/base/base_lifecycle_state.dart';
2
 import 'package:lszlgl/base/base_lifecycle_state.dart';
3
+import 'package:lszlgl/main.dart';
3
 import 'package:lszlgl/service/dict_service.dart';
4
 import 'package:lszlgl/service/dict_service.dart';
4
 import 'package:lszlgl/utils/string_utils.dart';
5
 import 'package:lszlgl/utils/string_utils.dart';
5
 import 'package:lszlgl/widget/card_item.dart';
6
 import 'package:lszlgl/widget/card_item.dart';
@@ -72,7 +73,9 @@ class _ReapSampleVarietyDetailPageState extends BaseLifecycleState<ReapSampleVar
72
         }
73
         }
73
       }
74
       }
74
       lspzList.value = list;
75
       lspzList.value = list;
75
-    } catch (e) {}
76
+    } catch (e) {
77
+      logger.e(e);
78
+    }
76
     MyNavigator.dismissLoading();
79
     MyNavigator.dismissLoading();
77
   }
80
   }
78
 
81
 
@@ -151,7 +154,10 @@ class _ReapSampleVarietyDetailPageState extends BaseLifecycleState<ReapSampleVar
151
     isDetail = widget.detail;
154
     isDetail = widget.detail;
152
     widget.ctrl.verifyData = verifyData;
155
     widget.ctrl.verifyData = verifyData;
153
     arrowDown = Image.asset(imgItemArrowDown, width: 20, color: const Color(0xFF01B2C8));
156
     arrowDown = Image.asset(imgItemArrowDown, width: 20, color: const Color(0xFF01B2C8));
157
+  }
154
 
158
 
159
+  @override
160
+  void onFirstShow(Duration timeStamp) {
155
     // 粮食品类菜单数据
161
     // 粮食品类菜单数据
156
     getLsxxList();
162
     getLsxxList();
157
     // 是否优选品种
163
     // 是否优选品种

+ 1 - 1
pubspec.yaml

@@ -39,7 +39,7 @@ dependencies:
39
   cupertino_icons: ^1.0.2
39
   cupertino_icons: ^1.0.2
40
 
40
 
41
   # 弹框
41
   # 弹框
42
-  flutter_smart_dialog: ^4.9.6
42
+  flutter_smart_dialog: ^4.9.7+4
43
   # 轮播图
43
   # 轮播图
44
   card_swiper: ^3.0.1
44
   card_swiper: ^3.0.1
45
   # 缓存网络图片
45
   # 缓存网络图片