mac 2 年前
父节点
当前提交
5b6ccc3993

+ 1
- 0
ios/Flutter/Debug.xcconfig 查看文件

1
+#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"
1
 #include "Generated.xcconfig"
2
 #include "Generated.xcconfig"

+ 1
- 0
ios/Flutter/Release.xcconfig 查看文件

1
+#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"
1
 #include "Generated.xcconfig"
2
 #include "Generated.xcconfig"

+ 41
- 0
ios/Podfile 查看文件

1
+# Uncomment this line to define a global platform for your project
2
+# platform :ios, '9.0'
3
+
4
+# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
5
+ENV['COCOAPODS_DISABLE_STATS'] = 'true'
6
+
7
+project 'Runner', {
8
+  'Debug' => :debug,
9
+  'Profile' => :release,
10
+  'Release' => :release,
11
+}
12
+
13
+def flutter_root
14
+  generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__)
15
+  unless File.exist?(generated_xcode_build_settings_path)
16
+    raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first"
17
+  end
18
+
19
+  File.foreach(generated_xcode_build_settings_path) do |line|
20
+    matches = line.match(/FLUTTER_ROOT\=(.*)/)
21
+    return matches[1].strip if matches
22
+  end
23
+  raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get"
24
+end
25
+
26
+require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root)
27
+
28
+flutter_ios_podfile_setup
29
+
30
+target 'Runner' do
31
+  use_frameworks!
32
+  use_modular_headers!
33
+
34
+  flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
35
+end
36
+
37
+post_install do |installer|
38
+  installer.pods_project.targets.each do |target|
39
+    flutter_additional_ios_build_settings(target)
40
+  end
41
+end

+ 82
- 0
ios/Podfile.lock 查看文件

1
+PODS:
2
+  - AMap3DMap (9.3.0):
3
+    - AMapFoundation (~> 1.7.0)
4
+  - amap_flutter_location (0.0.1):
5
+    - AMapLocation
6
+    - Flutter
7
+  - amap_flutter_map (0.0.1):
8
+    - AMap3DMap
9
+    - Flutter
10
+  - AMapFoundation (1.7.0)
11
+  - AMapLocation (2.9.0):
12
+    - AMapFoundation (>= 1.7.0)
13
+  - Flutter (1.0.0)
14
+  - fluttertoast (0.0.2):
15
+    - Flutter
16
+    - Toast
17
+  - fluwx (0.0.1):
18
+    - Flutter
19
+    - "OpenWeChatSDK (~> 1.9.2+1)"
20
+  - "OpenWeChatSDK (1.9.2+1)"
21
+  - path_provider_ios (0.0.1):
22
+    - Flutter
23
+  - permission_handler_apple (9.0.4):
24
+    - Flutter
25
+  - Toast (4.0.0)
26
+  - tobias (0.0.1):
27
+    - Flutter
28
+
29
+DEPENDENCIES:
30
+  - amap_flutter_location (from `.symlinks/plugins/amap_flutter_location/ios`)
31
+  - amap_flutter_map (from `.symlinks/plugins/amap_flutter_map/ios`)
32
+  - Flutter (from `Flutter`)
33
+  - fluttertoast (from `.symlinks/plugins/fluttertoast/ios`)
34
+  - fluwx (from `.symlinks/plugins/fluwx/ios`)
35
+  - path_provider_ios (from `.symlinks/plugins/path_provider_ios/ios`)
36
+  - permission_handler_apple (from `.symlinks/plugins/permission_handler_apple/ios`)
37
+  - tobias (from `.symlinks/plugins/tobias/ios`)
38
+
39
+SPEC REPOS:
40
+  trunk:
41
+    - AMap3DMap
42
+    - AMapFoundation
43
+    - AMapLocation
44
+    - OpenWeChatSDK
45
+    - Toast
46
+
47
+EXTERNAL SOURCES:
48
+  amap_flutter_location:
49
+    :path: ".symlinks/plugins/amap_flutter_location/ios"
50
+  amap_flutter_map:
51
+    :path: ".symlinks/plugins/amap_flutter_map/ios"
52
+  Flutter:
53
+    :path: Flutter
54
+  fluttertoast:
55
+    :path: ".symlinks/plugins/fluttertoast/ios"
56
+  fluwx:
57
+    :path: ".symlinks/plugins/fluwx/ios"
58
+  path_provider_ios:
59
+    :path: ".symlinks/plugins/path_provider_ios/ios"
60
+  permission_handler_apple:
61
+    :path: ".symlinks/plugins/permission_handler_apple/ios"
62
+  tobias:
63
+    :path: ".symlinks/plugins/tobias/ios"
64
+
65
+SPEC CHECKSUMS:
66
+  AMap3DMap: e429ea5e1d76b1793b75029db007241d67d2ebdf
67
+  amap_flutter_location: 44ff5beb64f42e0bf5feb402fe299dac0013af6f
68
+  amap_flutter_map: 979e54d227cedac6c7504a2151bfbf3bcf96760a
69
+  AMapFoundation: c14fcebd8e4267c593bd2e25067ac86b0ce64aba
70
+  AMapLocation: f5eb11e11c62f0f599f80b578eec8a1f70deb985
71
+  Flutter: 50d75fe2f02b26cc09d224853bb45737f8b3214a
72
+  fluttertoast: 16fbe6039d06a763f3533670197d01fc73459037
73
+  fluwx: 79c66b6d795ab8208262ada215d9e60388cfe492
74
+  OpenWeChatSDK: 67375e7d4154c22f7ba6b1c334b121473e7d515c
75
+  path_provider_ios: 14f3d2fd28c4fdb42f44e0f751d12861c43cee02
76
+  permission_handler_apple: 44366e37eaf29454a1e7b1b7d736c2cceaeb17ce
77
+  Toast: 91b396c56ee72a5790816f40d3a94dd357abc196
78
+  tobias: 2aded9b83e3663b907360a800d8e3c13284f25c5
79
+
80
+PODFILE CHECKSUM: aafe91acc616949ddb318b77800a7f51bffa2a4c
81
+
82
+COCOAPODS: 1.11.3

+ 567
- 481
ios/Runner.xcodeproj/project.pbxproj
文件差异内容过多而无法显示
查看文件


+ 10
- 7
ios/Runner.xcworkspace/contents.xcworkspacedata 查看文件

1
-<?xml version="1.0" encoding="UTF-8"?>
2
-<Workspace
3
-   version = "1.0">
4
-   <FileRef
5
-      location = "group:Runner.xcodeproj">
6
-   </FileRef>
7
-</Workspace>
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<Workspace
3
+   version = "1.0">
4
+   <FileRef
5
+      location = "group:Runner.xcodeproj">
6
+   </FileRef>
7
+   <FileRef
8
+      location = "group:Pods/Pods.xcodeproj">
9
+   </FileRef>
10
+</Workspace>

+ 49
- 47
ios/Runner/Info.plist 查看文件

1
-<?xml version="1.0" encoding="UTF-8"?>
2
-<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3
-<plist version="1.0">
4
-<dict>
5
-	<key>CFBundleDevelopmentRegion</key>
6
-	<string>$(DEVELOPMENT_LANGUAGE)</string>
7
-	<key>CFBundleDisplayName</key>
8
-	<string>Farmer Client</string>
9
-	<key>CFBundleExecutable</key>
10
-	<string>$(EXECUTABLE_NAME)</string>
11
-	<key>CFBundleIdentifier</key>
12
-	<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
13
-	<key>CFBundleInfoDictionaryVersion</key>
14
-	<string>6.0</string>
15
-	<key>CFBundleName</key>
16
-	<string>farmer_client</string>
17
-	<key>CFBundlePackageType</key>
18
-	<string>APPL</string>
19
-	<key>CFBundleShortVersionString</key>
20
-	<string>$(FLUTTER_BUILD_NAME)</string>
21
-	<key>CFBundleSignature</key>
22
-	<string>????</string>
23
-	<key>CFBundleVersion</key>
24
-	<string>$(FLUTTER_BUILD_NUMBER)</string>
25
-	<key>LSRequiresIPhoneOS</key>
26
-	<true/>
27
-	<key>UILaunchStoryboardName</key>
28
-	<string>LaunchScreen</string>
29
-	<key>UIMainStoryboardFile</key>
30
-	<string>Main</string>
31
-	<key>UISupportedInterfaceOrientations</key>
32
-	<array>
33
-		<string>UIInterfaceOrientationPortrait</string>
34
-		<string>UIInterfaceOrientationLandscapeLeft</string>
35
-		<string>UIInterfaceOrientationLandscapeRight</string>
36
-	</array>
37
-	<key>UISupportedInterfaceOrientations~ipad</key>
38
-	<array>
39
-		<string>UIInterfaceOrientationPortrait</string>
40
-		<string>UIInterfaceOrientationPortraitUpsideDown</string>
41
-		<string>UIInterfaceOrientationLandscapeLeft</string>
42
-		<string>UIInterfaceOrientationLandscapeRight</string>
43
-	</array>
44
-	<key>UIViewControllerBasedStatusBarAppearance</key>
45
-	<false/>
46
-</dict>
47
-</plist>
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3
+<plist version="1.0">
4
+<dict>
5
+	<key>CFBundleDevelopmentRegion</key>
6
+	<string>$(DEVELOPMENT_LANGUAGE)</string>
7
+	<key>CFBundleDisplayName</key>
8
+	<string>Farmer Client</string>
9
+	<key>CFBundleExecutable</key>
10
+	<string>$(EXECUTABLE_NAME)</string>
11
+	<key>CFBundleIdentifier</key>
12
+	<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
13
+	<key>CFBundleInfoDictionaryVersion</key>
14
+	<string>6.0</string>
15
+	<key>CFBundleName</key>
16
+	<string>farmer_client</string>
17
+	<key>CFBundlePackageType</key>
18
+	<string>APPL</string>
19
+	<key>CFBundleShortVersionString</key>
20
+	<string>$(FLUTTER_BUILD_NAME)</string>
21
+	<key>CFBundleSignature</key>
22
+	<string>????</string>
23
+	<key>CFBundleVersion</key>
24
+	<string>$(FLUTTER_BUILD_NUMBER)</string>
25
+	<key>LSRequiresIPhoneOS</key>
26
+	<true/>
27
+	<key>UILaunchStoryboardName</key>
28
+	<string>LaunchScreen</string>
29
+	<key>UIMainStoryboardFile</key>
30
+	<string>Main</string>
31
+	<key>UISupportedInterfaceOrientations</key>
32
+	<array>
33
+		<string>UIInterfaceOrientationPortrait</string>
34
+		<string>UIInterfaceOrientationLandscapeLeft</string>
35
+		<string>UIInterfaceOrientationLandscapeRight</string>
36
+	</array>
37
+	<key>UISupportedInterfaceOrientations~ipad</key>
38
+	<array>
39
+		<string>UIInterfaceOrientationPortrait</string>
40
+		<string>UIInterfaceOrientationPortraitUpsideDown</string>
41
+		<string>UIInterfaceOrientationLandscapeLeft</string>
42
+		<string>UIInterfaceOrientationLandscapeRight</string>
43
+	</array>
44
+	<key>UIViewControllerBasedStatusBarAppearance</key>
45
+	<false/>
46
+	<key>CADisableMinimumFrameDurationOnPhone</key>
47
+	<true/>
48
+</dict>
49
+</plist>

+ 1
- 0
lib/models/addressController.dart 查看文件

4
 class AddressController extends GetxController {
4
 class AddressController extends GetxController {
5
   static AddressController t = Get.find();
5
   static AddressController t = Get.find();
6
   final address = Rx<Address>(Address.fromJson({'address': '选择位置'}));
6
   final address = Rx<Address>(Address.fromJson({'address': '选择位置'}));
7
+  final addressList = Rx<List<Address>>([]);
7
 }
8
 }

+ 7
- 13
lib/pages/ArticleInfo/ArticleInfo.dart 查看文件

3
 import 'package:flutter_easyloading/flutter_easyloading.dart';
3
 import 'package:flutter_easyloading/flutter_easyloading.dart';
4
 import 'package:flutter_screenutil/flutter_screenutil.dart';
4
 import 'package:flutter_screenutil/flutter_screenutil.dart';
5
 import 'package:get/get.dart';
5
 import 'package:get/get.dart';
6
-import 'package:get/get_core/src/get_main.dart';
7
-
8
 import '../../models/entities/NewsInformationInfoTextModel.dart';
6
 import '../../models/entities/NewsInformationInfoTextModel.dart';
9
-import '../../models/entities/NewsInformationModel.dart';
10
 import '../../widgets/layout/BasicPage.dart';
7
 import '../../widgets/layout/BasicPage.dart';
11
 
8
 
12
 class ArticleInfo extends BasicPage {
9
 class ArticleInfo extends BasicPage {
28
         newsInfoContent.value = NewsInformationInfoTextModel.fromJson(value);
25
         newsInfoContent.value = NewsInformationInfoTextModel.fromJson(value);
29
         newsList.value = newsInfoContent.value.contentList!;
26
         newsList.value = newsInfoContent.value.contentList!;
30
         EasyLoading.dismiss();
27
         EasyLoading.dismiss();
31
-
32
       });
28
       });
33
     }
29
     }
34
   }
30
   }
50
                 ),
46
                 ),
51
                 Container(
47
                 Container(
52
                   alignment: Alignment.center,
48
                   alignment: Alignment.center,
53
-
54
                   width: 260.w,
49
                   width: 260.w,
55
-                  child:              Obx(() => Text(
56
-                    newsInfoContent.value.title.toString(),
57
-                    style: TextStyle(
58
-                      fontSize: 17.sp,
59
-                      fontWeight: FontWeight.bold,
60
-                    ),
61
-                  )),
50
+                  child: Obx(() => Text(
51
+                        newsInfoContent.value.title.toString(),
52
+                        style: TextStyle(
53
+                          fontSize: 17.sp,
54
+                          fontWeight: FontWeight.bold,
55
+                        ),
56
+                      )),
62
                 ),
57
                 ),
63
-
64
                 Image(
58
                 Image(
65
                     image: AssetImage('images/icons/decorate.png'), width: 17),
59
                     image: AssetImage('images/icons/decorate.png'), width: 17),
66
               ],
60
               ],

+ 18
- 6
lib/pages/addAddress/index.dart 查看文件

1
+import 'package:farmer_client/models/addressController.dart';
1
 import 'package:farmer_client/models/entities/Address.dart';
2
 import 'package:farmer_client/models/entities/Address.dart';
2
 import 'package:farmer_client/services/address.dart';
3
 import 'package:farmer_client/services/address.dart';
3
 import 'package:farmer_client/widgets/DefaultButton.dart';
4
 import 'package:farmer_client/widgets/DefaultButton.dart';
8
 import 'package:get/get.dart';
9
 import 'package:get/get.dart';
9
 
10
 
10
 class AddAddress extends BasicPage {
11
 class AddAddress extends BasicPage {
12
+  AddressController addressController = AddressController.t;
13
+
11
   final address = Rx<Address>(Address());
14
   final address = Rx<Address>(Address());
12
   late String text = '';
15
   late String text = '';
13
   late String id = '';
16
   late String id = '';
14
-
17
+  bool isBack = false;
15
   @override
18
   @override
16
   void beforeShow() {
19
   void beforeShow() {
17
     super.beforeShow();
20
     super.beforeShow();
18
-    if (Get.arguments != null) {
19
-      print(Get.arguments['item']);
20
-      // address(Get.arguments['item']);
21
+    isBack = Get.arguments['isBack'];
22
+    if (Get.arguments['item'] != null) {
21
       text = Get.arguments['item'];
23
       text = Get.arguments['item'];
22
       id = Get.arguments['id'];
24
       id = Get.arguments['id'];
23
     }
25
     }
75
               if (address.value.address == null) {
77
               if (address.value.address == null) {
76
                 Fluttertoast.showToast(msg: '请输入地址!');
78
                 Fluttertoast.showToast(msg: '请输入地址!');
77
               } else {
79
               } else {
80
+                List<Address> list = [...addressController.addressList()];
78
                 if (text == '') {
81
                 if (text == '') {
79
                   addressSave(address().address.toString()).then((value) {
82
                   addressSave(address().address.toString()).then((value) {
83
+                    list.add(Address.fromJson(value));
84
+                    addressController.addressList(list);
80
                     Fluttertoast.showToast(msg: '添加地址成功!');
85
                     Fluttertoast.showToast(msg: '添加地址成功!');
81
-                    Get.offNamed('/addressList');
86
+                    Get.offNamed('/addressList', arguments: {'isBack': isBack});
82
                   });
87
                   });
83
                 } else {
88
                 } else {
84
                   addressUpdate(id, address().address.toString()).then((value) {
89
                   addressUpdate(id, address().address.toString()).then((value) {
90
+                    Address ads = Address.fromJson(value);
91
+                    for (var element in list) {
92
+                      if (element.addressId == ads.addressId) {
93
+                        element.address = ads.address;
94
+                      }
95
+                    }
96
+                    addressController.addressList(list);
85
                     Fluttertoast.showToast(msg: '修改地址成功!');
97
                     Fluttertoast.showToast(msg: '修改地址成功!');
86
-                    Get.offNamed('/addressList');
98
+                    Get.offNamed('/addressList', arguments: {'isBack': isBack});
87
                   });
99
                   });
88
                 }
100
                 }
89
               }
101
               }

+ 78
- 91
lib/pages/addressList/index.dart 查看文件

13
 import '../../services/address.dart';
13
 import '../../services/address.dart';
14
 
14
 
15
 class AddressList extends BasicPage {
15
 class AddressList extends BasicPage {
16
+  //判断是否从订单页面跳转
16
   bool isBack = false;
17
   bool isBack = false;
17
   AddressController addressController = AddressController.t;
18
   AddressController addressController = AddressController.t;
18
-  final addressList = Rx<List<Address>>([]);
19
 
19
 
20
   @override
20
   @override
21
   void beforeShow() {
21
   void beforeShow() {
22
     super.beforeShow();
22
     super.beforeShow();
23
+    if (addressController.addressList.value.isEmpty) {
24
+      getList();
25
+    }
26
+    if (Get.arguments != null) {
27
+      isBack = Get.arguments['isBack'];
28
+    }
29
+  }
30
+
31
+  void getList() {
23
     EasyLoading.show(status: '数据加载中...');
32
     EasyLoading.show(status: '数据加载中...');
24
     getAddress().then((value) {
33
     getAddress().then((value) {
25
       final list = <Address>[];
34
       final list = <Address>[];
26
       value['records'].forEach((item) {
35
       value['records'].forEach((item) {
27
         list.add(Address.fromJson(item));
36
         list.add(Address.fromJson(item));
28
       });
37
       });
29
-      addressList(list);
38
+      addressController.addressList(list);
39
+      EasyLoading.dismiss();
40
+    }).catchError((error) {
30
       EasyLoading.dismiss();
41
       EasyLoading.dismiss();
42
+      Fluttertoast.showToast(msg: error.error['message']);
31
     });
43
     });
32
-    if (Get.arguments != null) {
33
-      isBack = Get.arguments['isBack'];
34
-    }
35
   }
44
   }
36
 
45
 
37
   void onChange(id) {
46
   void onChange(id) {
38
-    print(id);
39
     addressDefault(id).then((value) {
47
     addressDefault(id).then((value) {
40
-      getAddress().then((value) {
41
-        final defaultlist = [...addressList.value];
42
-        for (var element in defaultlist) {
43
-          if (element.isDefault == true) {
44
-            element.isDefault = false;
45
-          } else {
46
-            element.isDefault = true;
47
-          }
48
-        }
49
-        addressList(defaultlist);
50
-        print(addressList.value);
51
-      });
52
-      // final defaultlist = [...addressList.value];
53
-      // for (var element in defaultlist) {
54
-      //   if (element.isDefault == true) {
55
-      //     defaultlist.selected = true;
56
-      //   }
57
-      // }
58
-      // addressList(defaultlist);
59
-      // print(addressList.value);
48
+      getList();
60
     });
49
     });
61
-   }
50
+  }
62
 
51
 
63
   void onDelete(id) {
52
   void onDelete(id) {
64
-    print(id);
65
     modal.showDialog(
53
     modal.showDialog(
66
         title: '提示',
54
         title: '提示',
67
         content: Container(
55
         content: Container(
68
           alignment: Alignment.center,
56
           alignment: Alignment.center,
69
-          child: Text('确定要删除此地址吗?'),
57
+          child: const Text('确定要删除此地址吗?'),
70
         ),
58
         ),
71
         onCancel: () => true,
59
         onCancel: () => true,
72
         onConfirm: () => {
60
         onConfirm: () => {
73
               addressDelete(id).then((value) {
61
               addressDelete(id).then((value) {
74
-                final newslist = [...addressList()];
75
-                for (var item in addressList()) {
76
-                  if (item.addressId == id) {
77
-                    newslist.remove(item);
62
+                List<Address> newslist = [];
63
+                for (var item in addressController.addressList()) {
64
+                  if (item.addressId != id) {
65
+                    newslist.add(item);
78
                   }
66
                   }
79
                 }
67
                 }
80
-                addressList(newslist);
68
+                addressController.addressList(newslist);
69
+
81
                 Fluttertoast.showToast(msg: '删除成功!');
70
                 Fluttertoast.showToast(msg: '删除成功!');
82
               }),
71
               }),
83
             });
72
             });
87
   Widget builder(BuildContext context) {
76
   Widget builder(BuildContext context) {
88
     naviTitle = '地址管理';
77
     naviTitle = '地址管理';
89
     return ListView(
78
     return ListView(
90
-          children: [
91
-            Container(
92
-              padding: EdgeInsets.all(15.w),
93
-              child:
94
-              Obx(() =>  Column(
95
-                //左对齐
96
-                crossAxisAlignment: CrossAxisAlignment.start,
97
-                children: [
98
-                  Column(
99
-                      children: addressList()
100
-                          .asMap()
101
-                          .keys
102
-                          .map(
103
-                            (e) => AddressCard(
104
-                              No: e + 1,
105
-                              item: addressList.value[e],
106
-                              isBack: isBack,
107
-                              onChange: () {
108
-                                onChange(addressList.value[e].addressId);
109
-                              },
110
-                              onEdit: () {
111
-                                Get.offNamed('/addAddress', arguments: {
112
-                                  'id': addressList.value[e].addressId,
113
-                                  'item':
114
-                                      addressList.value[e].address.toString()
115
-                                });
116
-                              },
117
-                              onDelete: () {
118
-                                onDelete(addressList.value[e].addressId);
119
-                              },
120
-                              onBack: () {
121
-                                //选择地址
122
-                                addressController.address.value =
123
-                                    addressList.value[e];
124
-                                Get.back();
125
-                              },
126
-                            ),
127
-                          )
128
-                          .toList()),
129
-                  DefaultButton(
130
-                    color: const Color(0xffffffff),
131
-                    backColor: const Color(0xFFFF703B),
132
-                    width: 345.w,
133
-                    height: 49.h,
134
-                    text: '+新增地址',
135
-                    onPressed: () {
136
-                      Get.offNamed('/addAddress');
137
-                    },
138
-                    margin: const EdgeInsets.all(0),
139
-                    fontSize: 20.sp,
140
-                    radius: 24.5.w,
141
-                  ),
142
-                ],
143
-              )),
144
-            ),
145
-          ],
146
-        );
79
+      children: [
80
+        Container(
81
+            padding: EdgeInsets.all(15.w),
82
+            child: Column(
83
+              //左对齐
84
+              crossAxisAlignment: CrossAxisAlignment.start,
85
+              children: [
86
+                Obx(
87
+                  () => Column(children: [
88
+                    ...addressController.addressList().map((item) {
89
+                      int e = addressController.addressList().indexOf(item);
90
+
91
+                      return AddressCard(
92
+                        No: e + 1,
93
+                        item: item,
94
+                        isBack: isBack,
95
+                        onChange: () {
96
+                          onChange(item.addressId);
97
+                        },
98
+                        onEdit: () {
99
+                          Get.offNamed('/addAddress', arguments: {
100
+                            'isBack': isBack,
101
+                            'id': item.addressId,
102
+                            'item': item.address.toString()
103
+                          });
104
+                        },
105
+                        onDelete: () {
106
+                          onDelete(item.addressId);
107
+                        },
108
+                        onBack: () {
109
+                          //选择地址
110
+                          addressController.address.value = item;
111
+                          Get.back();
112
+                        },
113
+                      );
114
+                    })
115
+                  ]),
116
+                ),
117
+                DefaultButton(
118
+                  color: const Color(0xffffffff),
119
+                  backColor: const Color(0xFFFF703B),
120
+                  width: 345.w,
121
+                  height: 49.h,
122
+                  text: '+新增地址',
123
+                  onPressed: () {
124
+                    Get.offNamed('/addAddress', arguments: {'isBack': isBack});
125
+                  },
126
+                  margin: const EdgeInsets.all(0),
127
+                  fontSize: 20.sp,
128
+                  radius: 24.5.w,
129
+                ),
130
+              ],
131
+            )),
132
+      ],
133
+    );
147
   }
134
   }
148
 }
135
 }

+ 0
- 14
lib/pages/addressList/widget/AddressCard.dart 查看文件

1
 import 'package:farmer_client/models/entities/Address.dart';
1
 import 'package:farmer_client/models/entities/Address.dart';
2
 import 'package:flutter/material.dart';
2
 import 'package:flutter/material.dart';
3
 import 'package:flutter_screenutil/flutter_screenutil.dart';
3
 import 'package:flutter_screenutil/flutter_screenutil.dart';
4
-import 'package:get/get_rx/src/rx_typedefs/rx_typedefs.dart';
5
 
4
 
6
 class AddressCard extends StatefulWidget {
5
 class AddressCard extends StatefulWidget {
7
   final Address item;
6
   final Address item;
181
     );
180
     );
182
   }
181
   }
183
 }
182
 }
184
-
185
-//
186
-// class UseEffect extends ChangeNotifier{//这里也可以使用with来进行实现
187
-//   int _count = 0;//数值计算
188
-//
189
-//   int get count => _count;
190
-//
191
-//   addCount(){
192
-//     _count++;
193
-//     notifyListeners();
194
-//   }
195
-//
196
-// }

+ 169
- 157
lib/pages/login/login.dart 查看文件

114
     return Scaffold(
114
     return Scaffold(
115
       backgroundColor: Colors.transparent,
115
       backgroundColor: Colors.transparent,
116
       resizeToAvoidBottomInset: false,
116
       resizeToAvoidBottomInset: false,
117
-      body: Container(
118
-        decoration: const BoxDecoration(
119
-          image: DecorationImage(
120
-            image: AssetImage("images/icon_login.png"),
121
-            fit: BoxFit.cover,
122
-          ),
123
-        ),
117
+      body: GestureDetector(
118
+        behavior: HitTestBehavior.translucent,
119
+        onTap: () {
120
+          FocusScope.of(context).requestFocus(FocusNode());
121
+        },
124
         child: Container(
122
         child: Container(
125
-          child: ListView(
126
-            // mainAxisAlignment: MainAxisAlignment.end,
127
-            // crossAxisAlignment: CrossAxisAlignment.start,
128
-            children: [
129
-              Padding(
130
-                padding: EdgeInsets.fromLTRB(15, 0, 0, 5),
131
-                child: const Text(
132
-                  '您好!',
133
-                  style: TextStyle(
134
-                    fontWeight: FontWeight.bold,
135
-                    fontSize: 33,
123
+          decoration: const BoxDecoration(
124
+            image: DecorationImage(
125
+              image: AssetImage("images/icon_login.png"),
126
+              fit: BoxFit.cover,
127
+            ),
128
+          ),
129
+          child: Container(
130
+            child: ListView(
131
+              // mainAxisAlignment: MainAxisAlignment.end,
132
+              // crossAxisAlignment: CrossAxisAlignment.start,
133
+              children: [
134
+                Padding(
135
+                  padding: EdgeInsets.fromLTRB(15, 0, 0, 5),
136
+                  child: const Text(
137
+                    '您好!',
138
+                    style: TextStyle(
139
+                      fontWeight: FontWeight.bold,
140
+                      fontSize: 33,
141
+                    ),
136
                   ),
142
                   ),
137
                 ),
143
                 ),
138
-              ),
139
-              Padding(
140
-                padding: EdgeInsets.fromLTRB(15, 0, 0, 0),
141
-                child: const Text(
142
-                  '欢迎进入农户端应用!',
143
-                  style: TextStyle(
144
-                    fontWeight: FontWeight.bold,
145
-                    fontSize: 27,
144
+                Padding(
145
+                  padding: EdgeInsets.fromLTRB(15, 0, 0, 0),
146
+                  child: const Text(
147
+                    '欢迎进入农户端应用!',
148
+                    style: TextStyle(
149
+                      fontWeight: FontWeight.bold,
150
+                      fontSize: 27,
151
+                    ),
146
                   ),
152
                   ),
147
                 ),
153
                 ),
148
-              ),
149
-              Cell(
154
+                Cell(
155
+                    // margin: EdgeInsets.symmetric(horizontal: 13.w),
156
+                    margin: const EdgeInsets.fromLTRB(13, 43, 10, 0),
157
+                    header: Text(
158
+                      "+86",
159
+                      style: TextStyle(
160
+                        fontSize: 19.sp,
161
+                      ),
162
+                    ),
163
+                    child: TextField(
164
+                      maxLength: 11,
165
+                      keyboardType: TextInputType.number,
166
+                      style: TextStyle(
167
+                        fontSize: 17.sp,
168
+                      ),
169
+                      decoration: const InputDecoration(
170
+                        isCollapsed: true,
171
+                        contentPadding:
172
+                            EdgeInsets.symmetric(vertical: 8, horizontal: 16),
173
+                        labelText: "请输入手机号码",
174
+                        counterText: '', //去掉计数
175
+                        border: InputBorder.none,
176
+                        floatingLabelBehavior: FloatingLabelBehavior.never,
177
+                      ),
178
+                      onChanged: (e) {
179
+                        _handlePhone(e);
180
+                      },
181
+                    ),
182
+                    footer: SizedBox(
183
+                      child: ElevatedButton(
184
+                        onPressed: () => {
185
+                          setState(() {
186
+                            _buttonClickListen();
187
+                          })
188
+                        },
189
+                        child: Text(
190
+                          '$buttonText',
191
+                          style: TextStyle(
192
+                            fontSize: 15.sp,
193
+                          ),
194
+                        ),
195
+                        style: ButtonStyle(
196
+                          backgroundColor: isButtonEnable
197
+                              ? MaterialStateProperty.all(
198
+                                  const Color(0xFFFF703B))
199
+                              : MaterialStateProperty.all(
200
+                                  const Color(0xFFCBCBCB)),
201
+                          shape: MaterialStateProperty.all(
202
+                              const RoundedRectangleBorder(
203
+                                  borderRadius:
204
+                                      BorderRadius.all(Radius.circular(10)))),
205
+                        ),
206
+                      ),
207
+                    )),
208
+                Cell(
150
                   // margin: EdgeInsets.symmetric(horizontal: 13.w),
209
                   // margin: EdgeInsets.symmetric(horizontal: 13.w),
151
-                  margin: const EdgeInsets.fromLTRB(13, 43, 10, 0),
152
-                  header: Text(
153
-                    "+86",
154
-                    style: TextStyle(
155
-                      fontSize: 19.sp,
210
+                  margin: const EdgeInsets.fromLTRB(13, 16, 10, 0),
211
+
212
+                  header: Align(
213
+                    alignment: FractionalOffset(0.1, 0.5),
214
+                    child: Image.asset(
215
+                      'images/phoneCode.png',
216
+                      width: 20,
217
+                      height: 20,
156
                     ),
218
                     ),
157
                   ),
219
                   ),
220
+
158
                   child: TextField(
221
                   child: TextField(
159
-                    maxLength: 11,
160
                     keyboardType: TextInputType.number,
222
                     keyboardType: TextInputType.number,
161
                     style: TextStyle(
223
                     style: TextStyle(
162
                       fontSize: 17.sp,
224
                       fontSize: 17.sp,
165
                       isCollapsed: true,
227
                       isCollapsed: true,
166
                       contentPadding:
228
                       contentPadding:
167
                           EdgeInsets.symmetric(vertical: 8, horizontal: 16),
229
                           EdgeInsets.symmetric(vertical: 8, horizontal: 16),
168
-                      labelText: "请输入手机号码",
169
-                      counterText: '', //去掉计数
230
+                      labelText: "请输入验证码",
170
                       border: InputBorder.none,
231
                       border: InputBorder.none,
171
                       floatingLabelBehavior: FloatingLabelBehavior.never,
232
                       floatingLabelBehavior: FloatingLabelBehavior.never,
172
                     ),
233
                     ),
173
                     onChanged: (e) {
234
                     onChanged: (e) {
174
-                      _handlePhone(e);
235
+                      _handleCode(e);
175
                     },
236
                     },
176
                   ),
237
                   ),
177
-                  footer: SizedBox(
238
+                ),
239
+                Container(
240
+                  height: 350.h,
241
+                  alignment: Alignment.bottomCenter,
242
+                  child: SizedBox(
243
+                    width: 315.w,
244
+                    height: 49.h,
178
                     child: ElevatedButton(
245
                     child: ElevatedButton(
179
-                      onPressed: () => {
180
-                        setState(() {
181
-                          _buttonClickListen();
182
-                        })
246
+                      onPressed: () {
247
+                        _handelSubmit();
183
                       },
248
                       },
184
-                      child: Text(
185
-                        '$buttonText',
249
+                      child: const Text(
250
+                        "登陆",
186
                         style: TextStyle(
251
                         style: TextStyle(
187
-                          fontSize: 15.sp,
188
-                        ),
252
+                            fontSize: 18,
253
+                            color: Colors.white,
254
+                            fontWeight: FontWeight.bold),
189
                       ),
255
                       ),
190
                       style: ButtonStyle(
256
                       style: ButtonStyle(
191
-                        backgroundColor: isButtonEnable
192
-                            ? MaterialStateProperty.all(const Color(0xFFFF703B))
193
-                            : MaterialStateProperty.all(
194
-                                const Color(0xFFCBCBCB)),
257
+                        elevation: MaterialStateProperty.all(0),
258
+                        backgroundColor:
259
+                            MaterialStateProperty.all(const Color(0xFFFF703B)),
195
                         shape: MaterialStateProperty.all(
260
                         shape: MaterialStateProperty.all(
196
                             const RoundedRectangleBorder(
261
                             const RoundedRectangleBorder(
197
                                 borderRadius:
262
                                 borderRadius:
198
-                                    BorderRadius.all(Radius.circular(10)))),
263
+                                    BorderRadius.all(Radius.circular(24.4)))),
199
                       ),
264
                       ),
200
                     ),
265
                     ),
201
-                  )),
202
-              Cell(
203
-                // margin: EdgeInsets.symmetric(horizontal: 13.w),
204
-                margin: const EdgeInsets.fromLTRB(13, 16, 10, 0),
205
-
206
-                header: Align(
207
-                  alignment: FractionalOffset(0.1, 0.5),
208
-                  child: Image.asset(
209
-                    'images/phoneCode.png',
210
-                    width: 20,
211
-                    height: 20,
212
                   ),
266
                   ),
213
                 ),
267
                 ),
214
-
215
-                child: TextField(
216
-                  keyboardType: TextInputType.number,
217
-                  style: TextStyle(
218
-                    fontSize: 17.sp,
219
-                  ),
220
-                  decoration: const InputDecoration(
221
-                    isCollapsed: true,
222
-                    contentPadding:
223
-                        EdgeInsets.symmetric(vertical: 8, horizontal: 16),
224
-                    labelText: "请输入验证码",
225
-                    border: InputBorder.none,
226
-                    floatingLabelBehavior: FloatingLabelBehavior.never,
227
-                  ),
228
-                  onChanged: (e) {
229
-                    _handleCode(e);
230
-                  },
231
-                ),
232
-              ),
233
-              Container(
234
-                height: 350.h,
235
-                alignment: Alignment.bottomCenter,
236
-                child: SizedBox(
237
-                  width: 315.w,
238
-                  height: 49.h,
239
-                  child: ElevatedButton(
240
-                    onPressed: () {
241
-                      _handelSubmit();
242
-                    },
243
-                    child: const Text(
244
-                      "登陆",
245
-                      style: TextStyle(
246
-                          fontSize: 18,
247
-                          color: Colors.white,
248
-                          fontWeight: FontWeight.bold),
249
-                    ),
250
-                    style: ButtonStyle(
251
-                      elevation: MaterialStateProperty.all(0),
252
-                      backgroundColor:
253
-                          MaterialStateProperty.all(const Color(0xFFFF703B)),
254
-                      shape: MaterialStateProperty.all(
255
-                          const RoundedRectangleBorder(
256
-                              borderRadius:
257
-                                  BorderRadius.all(Radius.circular(24.4)))),
258
-                    ),
259
-                  ),
260
-                ),
261
-              ),
262
-              Container(
263
-                  padding: EdgeInsets.fromLTRB(10.0, 10, 0, 10),
264
-                  child: Row(
265
-                    children: <Widget>[
266
-                      Radio<bool>(
267
-                          value: true,
268
-                          activeColor: Color(0xFFFF703B),
269
-                          groupValue: _newValue,
270
-                          onChanged: (value) {
271
-                            setState(() {
272
-                              _newValue = value!;
273
-                            });
274
-                          }),
275
-                      // SizedBox(
276
-                      //   child:Text('文本协议/隐私政策',style: TextStyle(fontSize:15.sp,color: Color(0xffce3800))),
277
-                      // ),
278
-                      Text('请认真查看',style: TextStyle(fontSize:14.sp,color: Color(0xff2a2a2a))),
279
-                      GestureDetector(
280
-                        onTap: (){
281
-                          Get.toNamed('/agreement');
282
-                        },
283
-                        child:  Text('文本协议/隐私政策',style: TextStyle(fontSize:14.sp,color: Color(0xffce3800))),
284
-
285
-                      ),
286
-                      Text(',确认之后选择此项',style: TextStyle(fontSize:14.sp,color: Color(0xff2a2a2a))),
287
-                      // RichText(
288
-                      //   text: TextSpan(children: <InlineSpan>[
289
-                      //     const TextSpan(
290
-                      //         text: '请认真查看',
291
-                      //         style: TextStyle(color: Color(0xff2a2a2a))),
292
-                      //     TextSpan(
293
-                      //       text: '文本协议/隐私政策,',
294
-                      //       style: TextStyle(color: Color(0xffce3800)),
295
-                      //       recognizer:
296
-                      //           TapGestureRecognizer() //踩坑。。。recognizer 是手势交互 除了我现在些的是 点击交互,其他一般都是抽象类。
297
-                      //             ..onTap = () {
298
-                      //               Get.toNamed('/agreement');
299
-                      //             },
300
-                      //     ),
301
-                      //     const TextSpan(
302
-                      //         text: '确认之后选择此项',
303
-                      //         style: TextStyle(color: Color(0xff2a2a2a))),
304
-                      //   ]),
305
-                      // ),
306
-                    ],
307
-                  )),
308
-            ],
268
+                Container(
269
+                    padding: EdgeInsets.fromLTRB(10.0, 10, 0, 10),
270
+                    child: Row(
271
+                      children: <Widget>[
272
+                        Radio<bool>(
273
+                            value: true,
274
+                            activeColor: Color(0xFFFF703B),
275
+                            groupValue: _newValue,
276
+                            onChanged: (value) {
277
+                              setState(() {
278
+                                _newValue = value!;
279
+                              });
280
+                            }),
281
+                        // SizedBox(
282
+                        //   child:Text('文本协议/隐私政策',style: TextStyle(fontSize:15.sp,color: Color(0xffce3800))),
283
+                        // ),
284
+                        Text('请认真查看',
285
+                            style: TextStyle(
286
+                                fontSize: 14.sp, color: Color(0xff2a2a2a))),
287
+                        GestureDetector(
288
+                          onTap: () {
289
+                            Get.toNamed('/agreement');
290
+                          },
291
+                          child: Text('文本协议/隐私政策',
292
+                              style: TextStyle(
293
+                                  fontSize: 14.sp, color: Color(0xffce3800))),
294
+                        ),
295
+                        Text(',确认之后选择此项',
296
+                            style: TextStyle(
297
+                                fontSize: 14.sp, color: Color(0xff2a2a2a))),
298
+                        // RichText(
299
+                        //   text: TextSpan(children: <InlineSpan>[
300
+                        //     const TextSpan(
301
+                        //         text: '请认真查看',
302
+                        //         style: TextStyle(color: Color(0xff2a2a2a))),
303
+                        //     TextSpan(
304
+                        //       text: '文本协议/隐私政策,',
305
+                        //       style: TextStyle(color: Color(0xffce3800)),
306
+                        //       recognizer:
307
+                        //           TapGestureRecognizer() //踩坑。。。recognizer 是手势交互 除了我现在些的是 点击交互,其他一般都是抽象类。
308
+                        //             ..onTap = () {
309
+                        //               Get.toNamed('/agreement');
310
+                        //             },
311
+                        //     ),
312
+                        //     const TextSpan(
313
+                        //         text: '确认之后选择此项',
314
+                        //         style: TextStyle(color: Color(0xff2a2a2a))),
315
+                        //   ]),
316
+                        // ),
317
+                      ],
318
+                    )),
319
+              ],
320
+            ),
309
           ),
321
           ),
310
         ),
322
         ),
311
       ),
323
       ),

+ 6
- 5
lib/pages/main/index.dart 查看文件

2
 import 'package:farmer_client/widgets/layout/BasicPage.dart';
2
 import 'package:farmer_client/widgets/layout/BasicPage.dart';
3
 import 'package:flutter/material.dart';
3
 import 'package:flutter/material.dart';
4
 import 'package:flutter_easyloading/flutter_easyloading.dart';
4
 import 'package:flutter_easyloading/flutter_easyloading.dart';
5
+import 'package:fluttertoast/fluttertoast.dart';
5
 import 'package:get/get.dart';
6
 import 'package:get/get.dart';
6
-import 'package:get/get_rx/src/rx_types/rx_types.dart';
7
 
7
 
8
 import '../../models/entities/Address.dart';
8
 import '../../models/entities/Address.dart';
9
 import '../../services/address.dart';
9
 import '../../services/address.dart';
30
         list.add(Address.fromJson(item));
30
         list.add(Address.fromJson(item));
31
       });
31
       });
32
       addressListInfo(list);
32
       addressListInfo(list);
33
-      for(var i=0; i< addressListInfo.value.length;i++){
34
-        if (addressListInfo.value[i].isDefault==true ){
33
+      for (var i = 0; i < addressListInfo.value.length; i++) {
34
+        if (addressListInfo.value[i].isDefault == true) {
35
           addressInfoContent(addressListInfo.value[i]);
35
           addressInfoContent(addressListInfo.value[i]);
36
         }
36
         }
37
       }
37
       }
38
-
38
+    }).catchError((error) {
39
+      EasyLoading.dismiss();
40
+      Fluttertoast.showToast(msg: error.error['message']);
39
     });
41
     });
40
   }
42
   }
41
 
43
 
46
         ));
48
         ));
47
   }
49
   }
48
 }
50
 }
49
-

+ 1
- 4
lib/services/address.dart 查看文件

8
  * @returns
8
  * @returns
9
  */
9
  */
10
 Future getAddress() async {
10
 Future getAddress() async {
11
-  return request('/address', options: Options(method: 'GET'))
12
-      .catchError((error) => {
13
-            Fluttertoast.showToast(msg: error.error['message']),
14
-          });
11
+  return request('/address', options: Options(method: 'GET'));
15
 }
12
 }
16
 
13
 
17
 /**
14
 /**

+ 6
- 8
lib/widgets/Modal.dart 查看文件

1
-import 'dart:ffi';
2
-
3
-import 'package:flutter/cupertino.dart';
4
 import 'package:flutter/material.dart';
1
 import 'package:flutter/material.dart';
5
-import 'package:flutter/widgets.dart';
6
 import 'package:flutter_screenutil/flutter_screenutil.dart';
2
 import 'package:flutter_screenutil/flutter_screenutil.dart';
7
 import 'package:get/get.dart';
3
 import 'package:get/get.dart';
8
 
4
 
13
 /// 其余情况, 都默认关闭弹窗
9
 /// 其余情况, 都默认关闭弹窗
14
 void _handleFunc(ModalFunc? func, bool lazy) {
10
 void _handleFunc(ModalFunc? func, bool lazy) {
15
   // 是否立即关闭
11
   // 是否立即关闭
16
-  _close (bool canClose) {
12
+  _close(bool canClose) {
17
     if (canClose) {
13
     if (canClose) {
18
       _closeModal();
14
       _closeModal();
19
     }
15
     }
20
-  };
16
+  }
17
+
18
+  ;
21
 
19
 
22
   // 如果 lazy 是 true 则不会立即关闭
20
   // 如果 lazy 是 true 则不会立即关闭
23
   _close(!lazy);
21
   _close(!lazy);
41
 /// 打开一个 dialog
39
 /// 打开一个 dialog
42
 void showDialog(
40
 void showDialog(
43
     {required String title,
41
     {required String title,
44
-      lazy = false,
42
+    lazy = false,
45
     String? message,
43
     String? message,
46
     Widget? content,
44
     Widget? content,
47
     ModalFunc? onConfirm,
45
     ModalFunc? onConfirm,
59
 /// 打开一个 alert
57
 /// 打开一个 alert
60
 void showAlert(
58
 void showAlert(
61
     {required String title,
59
     {required String title,
62
-      bool lazy = false,
60
+    bool lazy = false,
63
     String? message,
61
     String? message,
64
     Widget? content,
62
     Widget? content,
65
     ModalFunc? onConfirm}) {
63
     ModalFunc? onConfirm}) {

+ 7
- 3
lib/widgets/layout/BasicPage.dart 查看文件

1
 import 'package:farmer_client/widgets/layout/bottomBar/BottomBar.dart';
1
 import 'package:farmer_client/widgets/layout/bottomBar/BottomBar.dart';
2
 import 'package:flutter/material.dart';
2
 import 'package:flutter/material.dart';
3
-import 'package:flutter_screenutil/flutter_screenutil.dart';
4
 import 'package:get/get.dart';
3
 import 'package:get/get.dart';
5
 
4
 
6
 import 'barList.dart';
5
 import 'barList.dart';
101
   Widget build(BuildContext context) {
100
   Widget build(BuildContext context) {
102
     return Scaffold(
101
     return Scaffold(
103
       resizeToAvoidBottomInset: false,
102
       resizeToAvoidBottomInset: false,
104
-
105
       appBar: _getAppBar(),
103
       appBar: _getAppBar(),
106
       body: SafeArea(
104
       body: SafeArea(
107
-        child: widget.builder(context),
105
+        child: GestureDetector(
106
+          behavior: HitTestBehavior.translucent,
107
+          onTap: () {
108
+            FocusScope.of(context).requestFocus(FocusNode());
109
+          },
110
+          child: widget.builder(context),
111
+        ),
108
       ),
112
       ),
109
       bottomNavigationBar: widget.tabIndex == null
113
       bottomNavigationBar: widget.tabIndex == null
110
           ? null
114
           ? null

+ 0
- 1
lib/widgets/layout/widgets/index.dart 查看文件

1
-