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

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

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

+ 1 - 1
pubspec.yaml

@@ -39,7 +39,7 @@ dependencies:
39 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 44
   card_swiper: ^3.0.1
45 45
   # 缓存网络图片