李志伟 3 år sedan
förälder
incheckning
6aad6b8501

+ 66
- 87
lib/pages/addAddress/index.dart Visa fil

@@ -1,109 +1,88 @@
1 1
 import 'package:farmer_client/models/entities/Address.dart';
2 2
 import 'package:farmer_client/widgets/DefaultButton.dart';
3
+import 'package:farmer_client/widgets/layout/BasicPage.dart';
3 4
 import 'package:flutter/material.dart';
4 5
 import 'package:flutter_screenutil/flutter_screenutil.dart';
5 6
 import 'package:fluttertoast/fluttertoast.dart';
6 7
 import 'package:get/get.dart';
7 8
 
8
-class AddAddress extends StatefulWidget {
9
-  const AddAddress({Key? key}) : super(key: key);
9
+class AddAddress extends BasicPage {
10 10
 
11
-  @override
12
-  _AddAddress createState() => _AddAddress();
13
-}
14
-
15
-class _AddAddress extends State<AddAddress> {
16
-  late Address address=Address();
11
+  final address =Rx<Address>(Address());
17 12
   late String text = '';
18 13
 
19 14
   @override
20
-  void initState() {
21
-    super.initState();
15
+  void beforeShow() {
16
+    super.beforeShow();
22 17
     if (Get.arguments != null) {
23
-      address = Get.arguments['item'];
24
-      text = address.address.toString();
18
+      address.value = Get.arguments['item'];
19
+      text = address.value.address.toString();
25 20
     }
26 21
   }
27 22
 
28 23
   @override
29
-  Widget build(BuildContext context) {
30
-    return Scaffold(
31
-      appBar: AppBar(
32
-        elevation: 0,
33
-        centerTitle: true,
34
-        backgroundColor: Colors.white,
35
-        title: Text(
36
-          '添加地址',
37
-          style: TextStyle(
38
-              color: Colors.black,
39
-              fontSize: 17.sp,
40
-              letterSpacing: 2,
41
-              fontWeight: FontWeight.bold),
42
-        ),
43
-      ),
44
-      body: Container(
45
-        padding: EdgeInsets.all(15.w),
46
-        child: Column(
47
-          crossAxisAlignment: CrossAxisAlignment.start,
48
-          children: [
49
-            Text(
50
-              '详细地址:',
51
-              style: TextStyle(
52
-                  fontWeight: FontWeight.bold,
53
-                  fontSize: 17.sp,
54
-                  color: const Color(0xFF333333)),
55
-            ),
56
-            Container(
57
-              margin: EdgeInsets.fromLTRB(0, 0, 0, 50.h),
58
-              padding: EdgeInsets.symmetric(vertical: 5.w, horizontal: 18.5.w),
59
-              decoration: BoxDecoration(
60
-                  color: const Color(0xFFfefefe),
61
-                  borderRadius: BorderRadius.all(Radius.circular(10.w)),
62
-                  border: Border.all(
63
-                      color: const Color(0xcc000000),
64
-                      width: 1.h,
65
-                      style: BorderStyle.solid)),
66
-              child: TextFormField(
67
-                initialValue: text,
68
-                minLines: 6,
69
-                maxLines: 6,
70
-                style: TextStyle(fontSize: 17.sp, height: 1.5),
71
-                decoration: const InputDecoration(
72
-                  isCollapsed: true,
73
-                  hintText: '请输入地址信息',
74
-                  border: InputBorder.none,
75
-                  counterText: '', //去掉计数
76
-                  floatingLabelBehavior: FloatingLabelBehavior.never,
77
-                ),
78
-                onChanged: (e) {
79
-                  setState(() {
80
-                    address.address = e;
81
-                  });
82
-                },
24
+  Widget builder(BuildContext context) {
25
+    naviTitle='添加地址';
26
+    return Container(
27
+      padding: EdgeInsets.all(15.w),
28
+      child: Column(
29
+        crossAxisAlignment: CrossAxisAlignment.start,
30
+        children: [
31
+          Text(
32
+            '详细地址:',
33
+            style: TextStyle(
34
+                fontWeight: FontWeight.bold,
35
+                fontSize: 17.sp,
36
+                color: const Color(0xFF333333)),
37
+          ),
38
+          Container(
39
+            margin: EdgeInsets.fromLTRB(0, 0, 0, 50.h),
40
+            padding: EdgeInsets.symmetric(vertical: 5.w, horizontal: 18.5.w),
41
+            decoration: BoxDecoration(
42
+                color: const Color(0xFFfefefe),
43
+                borderRadius: BorderRadius.all(Radius.circular(10.w)),
44
+                border: Border.all(
45
+                    color: const Color(0xcc000000),
46
+                    width: 1.h,
47
+                    style: BorderStyle.solid)),
48
+            child: TextFormField(
49
+              initialValue: text,
50
+              minLines: 6,
51
+              maxLines: 6,
52
+              style: TextStyle(fontSize: 17.sp, height: 1.5),
53
+              decoration: const InputDecoration(
54
+                isCollapsed: true,
55
+                hintText: '请输入地址信息',
56
+                border: InputBorder.none,
57
+                counterText: '', //去掉计数
58
+                floatingLabelBehavior: FloatingLabelBehavior.never,
83 59
               ),
84
-            ),
85
-            DefaultButton(
86
-              color: const Color(0xffffffff),
87
-              backColor: const Color(0xFFFF703B),
88
-              width: 345.w,
89
-              height: 49.h,
90
-              text: '保存',
91
-              onPressed: () {
92
-                if(address.address==null){
93
-                  Fluttertoast.showToast(
94
-                      msg: '请输入地址!');
95
-                } else{
96
-                  Fluttertoast.showToast(
97
-                      msg: '保存成功!');
98
-                  Get.back();
99
-                }
60
+              onChanged: (e) {
61
+                  address.value.address = e;
100 62
               },
101
-              margin: const EdgeInsets.all(0),
102
-              fontSize: 20.sp,
103
-              radius: 24.5.w,
104 63
             ),
105
-          ],
106
-        ),
64
+          ),
65
+          DefaultButton(
66
+            color: const Color(0xffffffff),
67
+            backColor: const Color(0xFFFF703B),
68
+            width: 345.w,
69
+            height: 49.h,
70
+            text: '保存',
71
+            onPressed: () {
72
+              if(address.value.address==null){
73
+                Fluttertoast.showToast(
74
+                    msg: '请输入地址!');
75
+              } else{
76
+                Fluttertoast.showToast(
77
+                    msg: '保存成功!');
78
+                Get.back();
79
+              }
80
+            },
81
+            margin: const EdgeInsets.all(0),
82
+            fontSize: 20.sp,
83
+            radius: 24.5.w,
84
+          ),
85
+        ],
107 86
       ),
108 87
     );
109 88
   }

+ 73
- 113
lib/pages/addressList/index.dart Visa fil

@@ -1,144 +1,104 @@
1 1
 import 'package:farmer_client/models/entities/Address.dart';
2 2
 import 'package:farmer_client/pages/addressList/widget/AddressCard.dart';
3 3
 import 'package:farmer_client/widgets/DefaultButton.dart';
4
+import 'package:farmer_client/widgets/layout/BasicPage.dart';
4 5
 import 'package:flutter/material.dart';
5 6
 import 'package:flutter_screenutil/flutter_screenutil.dart';
6 7
 import 'package:fluttertoast/fluttertoast.dart';
7 8
 import 'package:get/get.dart';
8 9
 import 'package:get_storage/get_storage.dart';
9 10
 
10
-class AddressList extends StatefulWidget {
11
-  const AddressList({Key? key}) : super(key: key);
12
-
13
-  @override
14
-  _AddressList createState() => _AddressList();
15
-}
16
-
17
-class _AddressList extends State<AddressList> {
11
+class AddressList extends BasicPage {
18 12
   bool isBack = false;
19 13
 
20 14
   @override
21
-  void initState() {
22
-    super.initState();
15
+  void beforeShow() {
16
+    super.beforeShow();
23 17
     if (Get.arguments != null) {
24 18
       isBack = Get.arguments['isBack'];
25 19
     }
26 20
   }
27 21
 
28
-  List<Address> addressList = [
22
+  final addressList = Rx<List<Address>>([
29 23
     Address.fromJson({'address': '777', 'isDefault': false}),
30 24
     Address.fromJson({'address': '999', 'isDefault': false}),
31 25
     Address.fromJson({'address': '这是一个正经的地址', 'isDefault': false}),
32
-  ];
26
+  ]);
27
+
33 28
   void onChange(index) {
34
-    setState(() {
35
-      addressList.forEach((element) {
36
-        if (element.isDefault == true) {
37
-          element.isDefault = false;
38
-        }
39
-      });
40
-      addressList[index].isDefault = true;
41
-    });
29
+    for (var element in addressList.value) {
30
+      if (element.isDefault == true) {
31
+        element.isDefault = false;
32
+      }
33
+    }
34
+    addressList.value[index].isDefault = true;
42 35
   }
43 36
 
44 37
   void onDelete(index) {
45
-    showDialog(
46
-        context: context,
47
-        builder: (context) {
48
-          return AlertDialog(content: Text("您确定要删除此地址吗?"), actions: <Widget>[
49
-            TextButton(
50
-              child: Text("取消"),
51
-              onPressed: () {
52
-                print("取消");
53
-                Navigator.pop(context, 'Cancle');
54
-              },
55
-            ),
56
-            TextButton(
57
-                child: Text("确定"),
58
-                onPressed: () {
59
-                  // setState(() {
60
-                  //   addressList.remove(addressList[e]);
61
-                  // });
62
-                  Navigator.pop(context, "Ok");
63
-                  Fluttertoast.showToast(msg: '删除成功!');
64
-                })
65
-          ]);
66
-        });
38
+    Fluttertoast.showToast(msg: '删除成功!');
67 39
   }
68 40
 
69 41
   @override
70
-  Widget build(BuildContext context) {
71
-    return Scaffold(
72
-      appBar: AppBar(
73
-        elevation: 0,
74
-        centerTitle: true,
75
-        backgroundColor: Colors.white,
76
-        title: Text(
77
-          '地址管理',
78
-          style: TextStyle(
79
-              color: Colors.black,
80
-              fontSize: 17.sp,
81
-              letterSpacing: 2,
82
-              fontWeight: FontWeight.bold),
83
-        ),
84
-      ),
85
-      body: ListView(
86
-        children: [
87
-          Container(
88
-            padding: EdgeInsets.all(15.w),
89
-            child: Column(
90
-              //左对齐
91
-              crossAxisAlignment: CrossAxisAlignment.start,
92
-              children: [
93
-                Column(
94
-                    children: addressList
95
-                        .asMap()
96
-                        .keys
97
-                        .map(
98
-                          (e) => AddressCard(
99
-                            No: e + 1,
100
-                            item: addressList[e],
101
-                            isBack: isBack,
102
-                            onChange: () {
103
-                              onChange(e);
104
-                            },
105
-                            onEdit: () {
106
-                              Get.toNamed('/addAddress',
107
-                                  arguments: {'item': addressList[e]});
108
-                            },
109
-                            onDelete: () {
110
-                              onDelete(e);
111
-                            },
112
-                            onBack: () {
113
-                              if(GetStorage().read('address')==null) {
114
-                                GetStorage().write('address', addressList[e]);
115
-                              }else {
116
-                                GetStorage().remove('address');
117
-                                GetStorage().write('address', addressList[e]);
118
-                              }
119
-                              Get.back();
120
-                            },
121
-                          ),
122
-                        )
123
-                        .toList()),
124
-                DefaultButton(
125
-                  color: const Color(0xffffffff),
126
-                  backColor: const Color(0xFFFF703B),
127
-                  width: 345.w,
128
-                  height: 49.h,
129
-                  text: '+新增收货地址',
130
-                  onPressed: () {
131
-                    Get.toNamed('/addAddress');
132
-                  },
133
-                  margin: const EdgeInsets.all(0),
134
-                  fontSize: 20.sp,
135
-                  radius: 24.5.w,
136
-                ),
137
-              ],
138
-            ),
42
+  Widget builder(BuildContext context) {
43
+    naviTitle = '地址管理';
44
+    return Column(
45
+      children: [
46
+        Container(
47
+          padding: EdgeInsets.all(15.w),
48
+          child: Column(
49
+            //左对齐
50
+            crossAxisAlignment: CrossAxisAlignment.start,
51
+            children: [
52
+              Column(
53
+                  children: addressList.value
54
+                      .asMap()
55
+                      .keys
56
+                      .map(
57
+                        (e) => AddressCard(
58
+                          No: e + 1,
59
+                          item: addressList.value[e],
60
+                          isBack: isBack,
61
+                          onChange: () {
62
+                            onChange(e);
63
+                          },
64
+                          onEdit: () {
65
+                            Get.toNamed('/addAddress',
66
+                                arguments: {'item': addressList.value[e]});
67
+                          },
68
+                          onDelete: () {
69
+                            onDelete(e);
70
+                          },
71
+                          onBack: () {
72
+                            if (GetStorage().read('address') == null) {
73
+                              GetStorage()
74
+                                  .write('address', addressList.value[e]);
75
+                            } else {
76
+                              GetStorage().remove('address');
77
+                              GetStorage()
78
+                                  .write('address', addressList.value[e]);
79
+                            }
80
+                            Get.back();
81
+                          },
82
+                        ),
83
+                      )
84
+                      .toList()),
85
+              DefaultButton(
86
+                color: const Color(0xffffffff),
87
+                backColor: const Color(0xFFFF703B),
88
+                width: 345.w,
89
+                height: 49.h,
90
+                text: '+新增收货地址',
91
+                onPressed: () {
92
+                  Get.toNamed('/addAddress');
93
+                },
94
+                margin: const EdgeInsets.all(0),
95
+                fontSize: 20.sp,
96
+                radius: 24.5.w,
97
+              ),
98
+            ],
139 99
           ),
140
-        ],
141
-      ),
100
+        ),
101
+      ],
142 102
     );
143 103
   }
144 104
 }

+ 26
- 43
lib/pages/agreement/index.dart Visa fil

@@ -1,54 +1,37 @@
1
+import 'package:farmer_client/widgets/layout/BasicPage.dart';
1 2
 import 'package:flutter/material.dart';
2 3
 import 'package:flutter_screenutil/flutter_screenutil.dart';
3 4
 
4
-class Agreement extends StatelessWidget {
5
-  const Agreement({Key? key}) : super(key: key);
5
+class Agreement extends BasicPage {
6 6
 
7 7
   @override
8
-  Widget build(BuildContext context) {
9
-    return Scaffold(
10
-      appBar: AppBar(
11
-        elevation: 0,
12
-        centerTitle: true,
13
-        backgroundColor: Colors.white,
14
-        title: Text(
15
-          '用户协议及隐私政策',
16
-          style: TextStyle(
17
-              color: Colors.black,
18
-              fontSize: 17.sp,
19
-              letterSpacing: 2,
20
-              fontWeight: FontWeight.bold),
21
-        ),
22
-      ),
23
-      body: Container(
24
-        color: const Color(0xFFFFFFFF),
25
-        padding: EdgeInsets.all(15.w),
26
-        child: Column(
27
-          children: [
28
-            Container(
29
-              margin: EdgeInsets.fromLTRB(0, 0, 0, 30.h),
30
-              child:  Row(
31
-                mainAxisAlignment: MainAxisAlignment.center,
32
-                children: [
33
-                  Image(image: const AssetImage(
34
-                      'images/icons/decorate.png'
35
-                  ),width: 16.5.w),
36
-                  Text('用户协议',
37
-                    style: TextStyle(
38
-                        fontSize: 20.sp,
39
-                        fontWeight: FontWeight.bold,
40
-                        color: const Color(0xFF222222)
41
-                    ),
42
-                  ),
43
-                  Image(image: const AssetImage('images/icons/decorate.png'),width: 16.5.w),
44
-                ],
8
+  Widget builder(BuildContext context) {
9
+    naviTitle = '用户协议及隐私政策';
10
+    return Container(
11
+      height: 700.h,
12
+      color: const Color(0xFFFFFFFF),
13
+      padding: EdgeInsets.all(15.w),
14
+      child: Column(
15
+        children: [
16
+          Row(
17
+            mainAxisAlignment: MainAxisAlignment.center,
18
+            children: [
19
+              Image(image: const AssetImage(
20
+                  'images/icons/decorate.png'
21
+              ),width: 16.5.w),
22
+              Text('用户协议',
23
+                style: TextStyle(
24
+                    fontSize: 20.sp,
25
+                    fontWeight: FontWeight.bold,
26
+                    color: const Color(0xFF222222)
27
+                ),
45 28
               ),
46
-            ),
29
+              Image(image: const AssetImage('images/icons/decorate.png'),width: 16.5.w),
30
+            ],
31
+          ),
47 32
 
48
-          ],
49
-        ),
33
+        ],
50 34
       ),
51 35
     );
52
-
53 36
   }
54 37
 }

+ 76
- 101
lib/pages/feedback/index.dart Visa fil

@@ -1,116 +1,91 @@
1
-import 'package:farmer_client/models/entities/Address.dart';
2 1
 import 'package:farmer_client/widgets/DefaultButton.dart';
2
+import 'package:farmer_client/widgets/layout/BasicPage.dart';
3 3
 import 'package:flutter/material.dart';
4 4
 import 'package:flutter_screenutil/flutter_screenutil.dart';
5 5
 import 'package:fluttertoast/fluttertoast.dart';
6 6
 import 'package:get/get.dart';
7 7
 
8
-class Feedback extends StatefulWidget {
9
-  const Feedback({Key? key}) : super(key: key);
8
+class Feedback extends BasicPage {
9
+  final text=Rx<String>('');
10
+  final isEdit=Rx<bool>(false);
10 11
 
11 12
   @override
12
-  _Feedback createState() => _Feedback();
13
-}
14
-
15
-class _Feedback extends State<Feedback> {
16
-  String text = '';
17
-  bool isEdit=false;
18
-  @override
19
-  Widget build(BuildContext context) {
20
-    return Scaffold(
21
-      resizeToAvoidBottomInset: false,
22
-      appBar: AppBar(
23
-        elevation: 0,
24
-        centerTitle: true,
25
-        backgroundColor: Colors.white,
26
-        title: Text(
27
-          '意见反馈',
28
-          style: TextStyle(
29
-              color: Colors.black,
30
-              fontSize: 17.sp,
31
-              letterSpacing: 2,
32
-              fontWeight: FontWeight.bold),
33
-        ),
34
-      ),
35
-      body: Container(
36
-        height: 700.h,
37
-        padding: EdgeInsets.all(15.w),
38
-        child: Stack(
39
-          children: [
40
-            Container(
41
-              margin: EdgeInsets.fromLTRB(0, 0, 0, 50.h),
42
-              padding: EdgeInsets.symmetric(vertical: 5.w, horizontal: 18.5.w),
43
-              decoration: BoxDecoration(
44
-                  color: const Color(0xFFfefefe),
45
-                  borderRadius: BorderRadius.all(Radius.circular(10.w)),
46
-                  border: Border.all(
47
-                      color: const Color(0xcc000000),
48
-                      width: 1.h,
49
-                      style: BorderStyle.solid)),
50
-              child: TextFormField(
51
-                minLines: 6,
52
-                maxLines: 6,
53
-                style: TextStyle(fontSize: 17.sp, height: 1.5),
54
-                decoration: const InputDecoration(
55
-                  isCollapsed: true,
56
-                  border: InputBorder.none,
57
-                  counterText: '', //去掉计数
58
-                  floatingLabelBehavior: FloatingLabelBehavior.never,
59
-                ),
60
-                onTap: () {
61
-                  setState(() {
62
-                    isEdit=true;
63
-                  });
64
-                },
65
-                onChanged: (e) {
66
-                  setState(() {
67
-                    text = e;
68
-                  });
69
-                },
13
+  Widget builder(BuildContext context) {
14
+    naviTitle = '意见反馈';
15
+    return Container(
16
+      height: 700.h,
17
+      padding: EdgeInsets.all(15.w),
18
+      child: Stack(
19
+        children: [
20
+          Container(
21
+            margin: EdgeInsets.fromLTRB(0, 0, 0, 50.h),
22
+            padding: EdgeInsets.symmetric(vertical: 5.w, horizontal: 18.5.w),
23
+            decoration: BoxDecoration(
24
+                color: const Color(0xFFfefefe),
25
+                borderRadius: BorderRadius.all(Radius.circular(10.w)),
26
+                border: Border.all(
27
+                    color: const Color(0xcc000000),
28
+                    width: 1.h,
29
+                    style: BorderStyle.solid)),
30
+            child: TextFormField(
31
+              minLines: 6,
32
+              maxLines: 6,
33
+              style: TextStyle(fontSize: 17.sp, height: 1.5),
34
+              decoration: const InputDecoration(
35
+                isCollapsed: true,
36
+                border: InputBorder.none,
37
+                counterText: '', //去掉计数
38
+                floatingLabelBehavior: FloatingLabelBehavior.never,
70 39
               ),
40
+              onTap: () {
41
+                  isEdit.value=true;
42
+              },
43
+              onChanged: (e) {
44
+                  text.value = e;
45
+              },
71 46
             ),
72
-            if(!isEdit) Positioned(
73
-              left: 20.w,
74
-              top: 5.w,
75
-              child: Row(
76
-                children: [
77
-                  Image.asset(
78
-                    'images/icons/feedbackIcon.png',
79
-                    width: 15.w,
80
-                  ),
81
-                  Text(
82
-                    '请留下您宝贵的意见和建议!',
83
-                    style: TextStyle(
84
-                        fontSize: 17.sp,
85
-                        letterSpacing: 2,
86
-                        color: Color(0xFFBEBDBD)),
87
-                  ),
88
-                ],
89
-              ),
47
+          ),
48
+          if(!isEdit.value) Positioned(
49
+            left: 20.w,
50
+            top: 5.w,
51
+            child: Row(
52
+              children: [
53
+                Image.asset(
54
+                  'images/icons/feedbackIcon.png',
55
+                  width: 15.w,
56
+                ),
57
+                Text(
58
+                  '请留下您宝贵的意见和建议!',
59
+                  style: TextStyle(
60
+                      fontSize: 17.sp,
61
+                      letterSpacing: 2,
62
+                      color: Color(0xFFBEBDBD)),
63
+                ),
64
+              ],
90 65
             ),
91
-            Positioned(
92
-              bottom: 25.h,
93
-              child: DefaultButton(
94
-                color: const Color(0xffffffff),
95
-                backColor: const Color(0xFFFF703B),
96
-                width: 345.w,
97
-                height: 49.h,
98
-                text: '提交',
99
-                onPressed: () {
100
-                  if (text == '') {
101
-                    Fluttertoast.showToast(msg: '请输入内容哦');
102
-                  } else {
103
-                    Fluttertoast.showToast(msg: '提交成功!');
104
-                    Get.back();
105
-                  }
106
-                },
107
-                margin: const EdgeInsets.all(0),
108
-                fontSize: 20.sp,
109
-                radius: 24.5.w,
110
-              ),
66
+          ),
67
+          Positioned(
68
+            bottom: 25.h,
69
+            child: DefaultButton(
70
+              color: const Color(0xffffffff),
71
+              backColor: const Color(0xFFFF703B),
72
+              width: 345.w,
73
+              height: 49.h,
74
+              text: '提交',
75
+              onPressed: () {
76
+                if (text.value == '') {
77
+                  Fluttertoast.showToast(msg: '请输入内容哦');
78
+                } else {
79
+                  Fluttertoast.showToast(msg: '提交成功!');
80
+                  Get.back();
81
+                }
82
+              },
83
+              margin: const EdgeInsets.all(0),
84
+              fontSize: 20.sp,
85
+              radius: 24.5.w,
111 86
             ),
112
-          ],
113
-        ),
87
+          ),
88
+        ],
114 89
       ),
115 90
     );
116 91
   }

+ 49
- 72
lib/pages/search/index.jsx.dart Visa fil

@@ -1,83 +1,60 @@
1
-import 'package:farmer_client/widgets/NullCard.dart';
1
+import 'package:farmer_client/widgets/layout/BasicPage.dart';
2 2
 import 'package:flutter/material.dart';
3 3
 import 'package:flutter_screenutil/flutter_screenutil.dart';
4
-import '../../widgets/CarsCard.dart';
5 4
 
6
-class SearchPage extends StatefulWidget {
7
-  const SearchPage({Key? key}) : super(key: key);
5
+class SearchPage extends BasicPage {
8 6
 
9 7
   @override
10
-  State<SearchPage> createState() => _SearchPage();
11
-}
12
-
13
-class _SearchPage extends State<SearchPage> {
14
-  @override
15
-  Widget build(BuildContext context) {
16
-    return Scaffold(
17
-      resizeToAvoidBottomInset: false,
18
-      appBar: AppBar(
19
-        elevation: 0,
20
-        centerTitle: true,
21
-        backgroundColor: Colors.white,
22
-        title: Text(
23
-          '搜索',
24
-          style: TextStyle(
25
-              color: Colors.black,
26
-              fontSize: 17.sp,
27
-              letterSpacing: 2,
28
-              fontWeight: FontWeight.bold),
8
+  Widget builder(BuildContext context) {
9
+    naviTitle = '搜索';
10
+    return Container(
11
+        decoration: const BoxDecoration(
12
+          color: Colors.white,
29 13
         ),
30
-      ),
31
-      body: Container(
32
-          decoration: const BoxDecoration(
33
-            color: Colors.white,
34
-          ),
35
-          child: ListView(children: [
36
-            Container(
37
-              width: 345.w,
38
-              height: 34.h,
39
-              margin: EdgeInsets.symmetric(vertical: 15.h, horizontal: 15.w),
40
-              padding: EdgeInsets.symmetric(vertical: 0, horizontal: 10.w),
41
-              decoration: BoxDecoration(
42
-                  color: Color(0xFFf8f8f8),
43
-                  borderRadius: BorderRadius.all(Radius.circular(17.w))),
44
-              child: Row(
45
-                mainAxisAlignment: MainAxisAlignment.center,
46
-                children: [
47
-                  Image.asset(
48
-                    'images/icons/search.png',
49
-                    width: 15.w,
50
-                    height: 15.w,
51
-                  ),
52
-                  Container(
53
-                    width: 300.w,
54
-                    margin: EdgeInsets.fromLTRB(5.w, 0, 0, 0),
55
-                    child: TextField(
56
-                      style: TextStyle(fontSize: 14.sp),
57
-                      decoration: const InputDecoration(
58
-                        isCollapsed: true,
59
-                        hintText: '搜索关键字查询',
60
-                        border: InputBorder.none,
61
-                        counterText: '', //去掉计数
62
-                        floatingLabelBehavior: FloatingLabelBehavior.never,
63
-                      ),
64
-                      onChanged: (e) {
65
-                        print(999);
66
-                        setState(() {});
67
-                      },
14
+        child: ListView(children: [
15
+          Container(
16
+            width: 345.w,
17
+            height: 34.h,
18
+            margin: EdgeInsets.symmetric(vertical: 15.h, horizontal: 15.w),
19
+            padding: EdgeInsets.symmetric(vertical: 0, horizontal: 10.w),
20
+            decoration: BoxDecoration(
21
+                color: Color(0xFFf8f8f8),
22
+                borderRadius: BorderRadius.all(Radius.circular(17.w))),
23
+            child: Row(
24
+              mainAxisAlignment: MainAxisAlignment.center,
25
+              children: [
26
+                Image.asset(
27
+                  'images/icons/search.png',
28
+                  width: 15.w,
29
+                  height: 15.w,
30
+                ),
31
+                Container(
32
+                  width: 300.w,
33
+                  margin: EdgeInsets.fromLTRB(5.w, 0, 0, 0),
34
+                  child: TextField(
35
+                    style: TextStyle(fontSize: 14.sp),
36
+                    decoration: const InputDecoration(
37
+                      isCollapsed: true,
38
+                      hintText: '搜索关键字查询',
39
+                      border: InputBorder.none,
40
+                      counterText: '', //去掉计数
41
+                      floatingLabelBehavior: FloatingLabelBehavior.never,
68 42
                     ),
43
+                    onChanged: (e) {
44
+                      print(999);
45
+                    },
69 46
                   ),
70
-                ],
71
-              ),
47
+                ),
48
+              ],
49
+            ),
50
+          ),
51
+          Container(
52
+            child: Column(
53
+              children: [
54
+                // NullCard(text: '暂无农机信息'),
55
+              ],
72 56
             ),
73
-            Container(
74
-              child: Column(
75
-                children: [
76
-                  // NullCard(text: '暂无农机信息'),
77
-                ],
78
-              ),
79
-            )
80
-          ])),
81
-    );
57
+          )
58
+        ]));
82 59
   }
83 60
 }

+ 177
- 201
lib/pages/userInfo/index.dart Visa fil

@@ -1,34 +1,29 @@
1 1
 import 'package:farmer_client/widgets/DefaultButton.dart';
2
+import 'package:farmer_client/widgets/layout/BasicPage.dart';
2 3
 import 'package:flutter/material.dart';
3 4
 import 'package:flutter_screenutil/flutter_screenutil.dart';
4 5
 import 'package:fluttertoast/fluttertoast.dart';
5 6
 import 'package:get/get.dart';
6 7
 
7
-class UserInfo extends StatefulWidget {
8
-  const UserInfo({Key? key}) : super(key: key);
9
-
10
-  @override
11
-  _UserInfo createState() => _UserInfo();
12
-}
13
-
14
-class _UserInfo extends State<UserInfo> {
15
-  String name = '';
16
-  String phone = '';
8
+class UserInfo extends BasicPage {
9
+  final name =Rx<String>('');
10
+  final phone =Rx<String>('');
17 11
   late TextEditingController _cName;
18 12
   late TextEditingController _cPhone;
19 13
   @override
20
-  void initState() {
21
-    _cName = new TextEditingController(text: name);
22
-    _cPhone = new TextEditingController(text: phone);
14
+  void beforeShow() {
15
+    super.beforeShow();
16
+    _cName = TextEditingController(text: name.value);
17
+    _cPhone = TextEditingController(text: phone.value);
23 18
   }
24 19
 
25 20
   bool disableLogin = false;
26 21
   RegExp exp = RegExp(r'^1[3456789]\d{9}$');
27 22
 
28 23
   void handleOk() {
29
-    if (name == '' && phone == '') {
24
+    if (name.value == '' && phone.value == '') {
30 25
       Fluttertoast.showToast(msg: '请输入您的信息');
31
-    } else if (phone!=''&&!exp.hasMatch(phone)) {
26
+    } else if (phone.value!=''&&!exp.hasMatch(phone.value)) {
32 27
       Fluttertoast.showToast(msg: '请输入正确的手机号');
33 28
     } else {
34 29
       Fluttertoast.showToast(msg: '保存成功');
@@ -36,33 +31,61 @@ class _UserInfo extends State<UserInfo> {
36 31
     }
37 32
   }
38 33
 
34
+
39 35
   @override
40
-  Widget build(BuildContext context) {
41
-    return Scaffold(
42
-      //防止键盘弹起引起页面高度溢出
43
-      resizeToAvoidBottomInset: false,
44
-      appBar: AppBar(
45
-        elevation: 0,
46
-        centerTitle: true,
47
-        backgroundColor: Colors.white,
48
-        title: Text(
49
-          '个人信息',
50
-          style: TextStyle(
51
-              color: Colors.black,
52
-              fontSize: 17.sp,
53
-              letterSpacing: 2,
54
-              fontWeight: FontWeight.bold),
55
-        ),
56
-      ),
57
-      body: Container(
58
-        color: const Color(0xFFffffff),
59
-        padding: EdgeInsets.all(15.w),
60
-        child: Column(
61
-          crossAxisAlignment: CrossAxisAlignment.start,
62
-          children: [
63
-            Container(
64
-              margin: EdgeInsets.fromLTRB(0, 0, 0, 40.h),
65
-              padding: EdgeInsets.symmetric(vertical: 15.h, horizontal: 0),
36
+  Widget builder(BuildContext context) {
37
+    naviTitle = '个人信息';
38
+    return Container(
39
+      height: 700.h,
40
+      color: const Color(0xFFffffff),
41
+      padding: EdgeInsets.all(15.w),
42
+      child: Column(
43
+        crossAxisAlignment: CrossAxisAlignment.start,
44
+        children: [
45
+          Container(
46
+            width: 345.w,
47
+            margin: EdgeInsets.fromLTRB(0, 0, 0, 40.h),
48
+            padding: EdgeInsets.symmetric(vertical: 15.h, horizontal: 0),
49
+            decoration: BoxDecoration(
50
+              color: const Color(0xFFFFFFFF),
51
+              boxShadow: [
52
+                BoxShadow(
53
+                  color: const Color(0x1F000000),
54
+                  offset: Offset(0, 1.w),
55
+                  blurRadius: 0,
56
+                ),
57
+              ],
58
+            ),
59
+            child: Row(
60
+                mainAxisAlignment: MainAxisAlignment.spaceBetween,
61
+                children: [
62
+                  Image.asset(
63
+                    'images/userMoren.png',
64
+                    width: 62.w,
65
+                    height: 62.w,
66
+                  ),
67
+                  Text(
68
+                    '更换头像',
69
+                    style: TextStyle(
70
+                        fontSize: 17.sp,
71
+                        color: Color(0xFF333333),
72
+                        letterSpacing: 2,
73
+                        fontWeight: FontWeight.w500),
74
+                  ),
75
+                ]),
76
+          ),
77
+          Text(
78
+            '姓名:',
79
+            style: TextStyle(
80
+                color: const Color(0xFF333333),
81
+                fontSize: 17.sp,
82
+                letterSpacing: 2,
83
+                fontWeight: FontWeight.bold),
84
+          ),
85
+          Container(
86
+            width: 345.w,
87
+              margin: EdgeInsets.fromLTRB(0, 10.h, 0, 40.h),
88
+              padding: EdgeInsets.symmetric(vertical: 19.h, horizontal: 0),
66 89
               decoration: BoxDecoration(
67 90
                 color: const Color(0xFFFFFFFF),
68 91
                 boxShadow: [
@@ -73,172 +96,125 @@ class _UserInfo extends State<UserInfo> {
73 96
                   ),
74 97
                 ],
75 98
               ),
76
-              child: Row(
77
-                  mainAxisAlignment: MainAxisAlignment.spaceBetween,
78
-                  children: [
79
-                    Image.asset(
80
-                      'images/userMoren.png',
81
-                      width: 62.w,
82
-                      height: 62.w,
83
-                    ),
84
-                    Text(
85
-                      '更换头像',
86
-                      style: TextStyle(
87
-                          fontSize: 17.sp,
88
-                          color: Color(0xFF333333),
89
-                          letterSpacing: 2,
90
-                          fontWeight: FontWeight.w500),
91
-                    ),
92
-                  ]),
93
-            ),
94
-            Text(
95
-              '姓名:',
96
-              style: TextStyle(
97
-                  color: const Color(0xFF333333),
98
-                  fontSize: 17.sp,
99
-                  letterSpacing: 2,
100
-                  fontWeight: FontWeight.bold),
101
-            ),
102
-            Container(
103
-                margin: EdgeInsets.fromLTRB(0, 10.h, 0, 40.h),
104
-                padding: EdgeInsets.symmetric(vertical: 19.h, horizontal: 0),
105
-                decoration: BoxDecoration(
106
-                  color: const Color(0xFFFFFFFF),
107
-                  boxShadow: [
108
-                    BoxShadow(
109
-                      color: const Color(0x1F000000),
110
-                      offset: Offset(0, 1.w),
111
-                      blurRadius: 0,
112
-                    ),
113
-                  ],
114
-                ),
115
-                child: Column(
116
-                  children: [
117
-                    Row(
118
-                        mainAxisAlignment: MainAxisAlignment.spaceBetween,
119
-                        children: [
120
-                          Container(
121
-                            width: 327.w,
122
-                            child: TextField(
123
-                              controller: _cName,
124
-                              style: TextStyle(
125
-                                  color: const Color(0xFF333333),
126
-                                  fontSize: 17.sp,
127
-                                  letterSpacing: 2,
128
-                                  fontWeight: FontWeight.bold),
129
-                              decoration: const InputDecoration(
130
-                                isCollapsed: true,
131
-                                hintText: '请输入您的姓名',
132
-                                border: InputBorder.none,
133
-                                counterText: '', //去掉计数
134
-                                floatingLabelBehavior:
135
-                                    FloatingLabelBehavior.never,
136
-                              ),
137
-                              onChanged: (e) {
138
-                                setState(() {
139
-                                  name = e;
140
-                                });
141
-                              },
99
+              child: Column(
100
+                children: [
101
+                  Row(
102
+                      mainAxisAlignment: MainAxisAlignment.spaceBetween,
103
+                      children: [
104
+                        Container(
105
+                          width: 327.w,
106
+                          child: TextField(
107
+                            controller: _cName,
108
+                            style: TextStyle(
109
+                                color: const Color(0xFF333333),
110
+                                fontSize: 17.sp,
111
+                                letterSpacing: 2,
112
+                                fontWeight: FontWeight.bold),
113
+                            decoration: const InputDecoration(
114
+                              isCollapsed: true,
115
+                              hintText: '请输入您的姓名',
116
+                              border: InputBorder.none,
117
+                              counterText: '', //去掉计数
118
+                              floatingLabelBehavior:
119
+                              FloatingLabelBehavior.never,
142 120
                             ),
143
-                          ),
144
-                          GestureDetector(
145
-                            onTap: () {
146
-                              setState(() {
147
-                                name = '';
148
-                              });
149
-                              _cName.clear();
121
+                            onChanged: (e) {
122
+                                name.value = e;
150 123
                             },
151
-                            child: Image.asset(
152
-                              'images/icons/cancel.png',
153
-                              width: 18.w,
154
-                              height: 18.w,
155
-                            ),
156 124
                           ),
157
-                        ]),
158
-                  ],
159
-                )),
160
-            Text(
161
-              '手机号:',
162
-              style: TextStyle(
163
-                  color: const Color(0xFF333333),
164
-                  fontSize: 17.sp,
165
-                  letterSpacing: 2,
166
-                  fontWeight: FontWeight.bold),
167
-            ),
168
-            Container(
169
-                margin: EdgeInsets.fromLTRB(0, 10.h, 0, 40.h),
170
-                padding: EdgeInsets.symmetric(vertical: 19.h, horizontal: 0),
171
-                decoration: BoxDecoration(
172
-                  color: const Color(0xFFFFFFFF),
173
-                  boxShadow: [
174
-                    BoxShadow(
175
-                      color: const Color(0x1F000000),
176
-                      offset: Offset(0, 1.w),
177
-                      blurRadius: 0,
178
-                    ),
179
-                  ],
180
-                ),
181
-                child: Column(
182
-                  children: [
183
-                    Row(
184
-                        mainAxisAlignment: MainAxisAlignment.spaceBetween,
185
-                        children: [
186
-                          SizedBox(
187
-                            width: 327.w,
188
-                            child: TextField(
189
-                              keyboardType: TextInputType.number,
190
-                              controller: _cPhone,
191
-                              maxLength: 11,
192
-                              style: TextStyle(
193
-                                  color: const Color(0xFF333333),
194
-                                  fontSize: 17.sp,
195
-                                  letterSpacing: 2,
196
-                                  fontWeight: FontWeight.bold),
197
-                              decoration: const InputDecoration(
198
-                                isCollapsed: true,
199
-                                hintText: '请输入您的手机号',
200
-                                border: InputBorder.none,
201
-                                counterText: '', //去掉计数
202
-                                floatingLabelBehavior:
203
-                                    FloatingLabelBehavior.never,
204
-                              ),
205
-                              onChanged: (e) {
206
-                                setState(() {
207
-                                  phone = e;
208
-                                });
209
-                              },
210
-                            ),
125
+                        ),
126
+                        GestureDetector(
127
+                          onTap: () {
128
+                              name.value = '';
129
+                            _cName.clear();
130
+                          },
131
+                          child: Image.asset(
132
+                            'images/icons/cancel.png',
133
+                            width: 18.w,
134
+                            height: 18.w,
211 135
                           ),
212
-                          GestureDetector(
213
-                            onTap: () {
214
-                              setState(() {
215
-                                phone = '';
216
-                              });
217
-                              _cPhone.clear();
218
-                            },
219
-                            child: Image.asset(
220
-                              'images/icons/cancel.png',
221
-                              width: 18.w,
222
-                              height: 18.w,
136
+                        ),
137
+                      ]),
138
+                ],
139
+              )),
140
+          Text(
141
+            '手机号:',
142
+            style: TextStyle(
143
+                color: const Color(0xFF333333),
144
+                fontSize: 17.sp,
145
+                letterSpacing: 2,
146
+                fontWeight: FontWeight.bold),
147
+          ),
148
+          Container(
149
+            width: 345.w,
150
+              margin: EdgeInsets.fromLTRB(0, 10.h, 0, 40.h),
151
+              padding: EdgeInsets.symmetric(vertical: 19.h, horizontal: 0),
152
+              decoration: BoxDecoration(
153
+                color: const Color(0xFFFFFFFF),
154
+                boxShadow: [
155
+                  BoxShadow(
156
+                    color: const Color(0x1F000000),
157
+                    offset: Offset(0, 1.w),
158
+                    blurRadius: 0,
159
+                  ),
160
+                ],
161
+              ),
162
+              child: Column(
163
+                children: [
164
+                  Row(
165
+                      mainAxisAlignment: MainAxisAlignment.spaceBetween,
166
+                      children: [
167
+                        SizedBox(
168
+                          width: 327.w,
169
+                          child: TextField(
170
+                            keyboardType: TextInputType.number,
171
+                            controller: _cPhone,
172
+                            maxLength: 11,
173
+                            style: TextStyle(
174
+                                color: const Color(0xFF333333),
175
+                                fontSize: 17.sp,
176
+                                letterSpacing: 2,
177
+                                fontWeight: FontWeight.bold),
178
+                            decoration: const InputDecoration(
179
+                              isCollapsed: true,
180
+                              hintText: '请输入您的手机号',
181
+                              border: InputBorder.none,
182
+                              counterText: '', //去掉计数
183
+                              floatingLabelBehavior:
184
+                              FloatingLabelBehavior.never,
223 185
                             ),
186
+                            onChanged: (e) {
187
+                                phone.value = e;
188
+                            },
224 189
                           ),
225
-                        ]),
226
-                  ],
227
-                )),
228
-            const Spacer(),
229
-            DefaultButton(
230
-              color: const Color(0xffffffff),
231
-              backColor: const Color(0xFFFF703B),
232
-              width: 345.w,
233
-              height: 49.h,
234
-              text: '保存',
235
-              onPressed: handleOk,
236
-              margin: const EdgeInsets.all(0),
237
-              fontSize: 20.sp,
238
-              radius: 24.5.w,
239
-            ),
240
-          ],
241
-        ),
190
+                        ),
191
+                        GestureDetector(
192
+                          onTap: () {
193
+                              phone.value = '';
194
+                            _cPhone.clear();
195
+                          },
196
+                          child: Image.asset(
197
+                            'images/icons/cancel.png',
198
+                            width: 18.w,
199
+                            height: 18.w,
200
+                          ),
201
+                        ),
202
+                      ]),
203
+                ],
204
+              )),
205
+          const Spacer(),
206
+          DefaultButton(
207
+            color: const Color(0xffffffff),
208
+            backColor: const Color(0xFFFF703B),
209
+            width: 345.w,
210
+            height: 49.h,
211
+            text: '保存',
212
+            onPressed: handleOk,
213
+            margin: const EdgeInsets.all(0),
214
+            fontSize: 20.sp,
215
+            radius: 24.5.w,
216
+          ),
217
+        ],
242 218
       ),
243 219
     );
244 220
   }

+ 1
- 0
lib/theme.dart Visa fil

@@ -14,6 +14,7 @@ ThemeData getTheme() {
14 14
         color: const Color(0xFF333333),
15 15
         fontWeight: FontWeight.bold,
16 16
         fontSize: 17.sp,
17
+        letterSpacing: 2
17 18
       ),
18 19
     ),
19 20
     backgroundColor: Colors.white,

+ 0
- 1
lib/widgets/CarsCard.dart Visa fil

@@ -23,7 +23,6 @@ class _CarsCardPage extends State<CarsCard> {
23 23
   final CardInfo item;
24 24
   _CarsCardPage(this.item);
25 25
 
26
-
27 26
   @override
28 27
   Widget build(BuildContext context) {
29 28
     return Container(

+ 0
- 0
lib/widgets/layout/widgets/index.dart Visa fil