李志伟 3 years ago
parent
commit
640437e440

+ 19
- 13
lib/pages/OrderConfirmation/index.dart View File

1
-import 'package:flutter/cupertino.dart';
2
 import 'package:flutter/material.dart';
1
 import 'package:flutter/material.dart';
3
 import 'package:flutter/services.dart';
2
 import 'package:flutter/services.dart';
4
 import 'package:flutter_screenutil/flutter_screenutil.dart';
3
 import 'package:flutter_screenutil/flutter_screenutil.dart';
5
 import 'package:get/get.dart';
4
 import 'package:get/get.dart';
5
+import 'package:get_storage/get_storage.dart';
6
 import 'package:intl/intl.dart';
6
 import 'package:intl/intl.dart';
7
 
7
 
8
 class OrderConfirmation extends StatefulWidget {
8
 class OrderConfirmation extends StatefulWidget {
19
 
19
 
20
   var selectDate; //选择的时间
20
   var selectDate; //选择的时间
21
   var workingArea;
21
   var workingArea;
22
-
23
-
22
+  String address = '请选择详细地址';
23
+  @override
24
+  void initState() {
25
+    super.initState();
26
+    //到底哪里错了 唉
27
+    // if (GetStorage().read("address") != null) {
28
+    //   address = GetStorage().read("address").address;
29
+    // }
30
+  }
24
 //  20:59:59
31
 //  20:59:59
25
 
32
 
26
   @override
33
   @override
76
                 floatingLabelBehavior: FloatingLabelBehavior.never,
83
                 floatingLabelBehavior: FloatingLabelBehavior.never,
77
                 hintText: "请输入具体面积(公顷)",
84
                 hintText: "请输入具体面积(公顷)",
78
               ),
85
               ),
79
-              onChanged: (e){
86
+              onChanged: (e) {
80
                 setState(() {
87
                 setState(() {
81
-                  workingArea=e;
88
+                  workingArea = e;
82
                 });
89
                 });
83
               },
90
               },
84
               // 校验用户名
91
               // 校验用户名
173
                   Padding(
180
                   Padding(
174
                       padding: EdgeInsets.fromLTRB(10, 0, 0, 0),
181
                       padding: EdgeInsets.fromLTRB(10, 0, 0, 0),
175
                       child: GestureDetector(
182
                       child: GestureDetector(
176
-                        onTap: () {},
183
+                        onTap: () {
184
+                          Get.toNamed('/addressList',
185
+                              arguments: {'isBack': true});
186
+                        },
177
                         child: Container(
187
                         child: Container(
178
                           width: 290.w,
188
                           width: 290.w,
179
                           child: Text(
189
                           child: Text(
180
-                            '请选择详细地址',
190
+                            address,
181
                             softWrap: true,
191
                             softWrap: true,
182
                             maxLines: 1,
192
                             maxLines: 1,
183
                             textAlign: TextAlign.left,
193
                             textAlign: TextAlign.left,
189
               ),
199
               ),
190
             ),
200
             ),
191
 
201
 
192
-            // 登录按钮
193
             Spacer(),
202
             Spacer(),
194
             Container(
203
             Container(
195
               alignment: Alignment.bottomCenter,
204
               alignment: Alignment.bottomCenter,
199
                 child: ElevatedButton(
208
                 child: ElevatedButton(
200
                   onPressed: () {
209
                   onPressed: () {
201
                     if ((_formKey.currentState as FormState).validate()) {
210
                     if ((_formKey.currentState as FormState).validate()) {
202
-                      var a={selectDate,workingArea};
211
+                      var a = {selectDate, workingArea};
203
                       print('我确定了$a');
212
                       print('我确定了$a');
204
                       //验证通过提交数据
213
                       //验证通过提交数据
214
+                      Get.toNamed('/orderPageInfo');
205
                     }
215
                     }
206
                   },
216
                   },
207
                   child: const Text(
217
                   child: const Text(
260
     );
270
     );
261
   }
271
   }
262
 }
272
 }
263
-
264
-
265
-
266
-

+ 42
- 24
lib/pages/addressList/index.dart View File

5
 import 'package:flutter_screenutil/flutter_screenutil.dart';
5
 import 'package:flutter_screenutil/flutter_screenutil.dart';
6
 import 'package:fluttertoast/fluttertoast.dart';
6
 import 'package:fluttertoast/fluttertoast.dart';
7
 import 'package:get/get.dart';
7
 import 'package:get/get.dart';
8
-
8
+import 'package:get_storage/get_storage.dart';
9
 
9
 
10
 class AddressList extends StatefulWidget {
10
 class AddressList extends StatefulWidget {
11
   const AddressList({Key? key}) : super(key: key);
11
   const AddressList({Key? key}) : super(key: key);
15
 }
15
 }
16
 
16
 
17
 class _AddressList extends State<AddressList> {
17
 class _AddressList extends State<AddressList> {
18
+  bool isBack = false;
19
+
20
+  @override
21
+  void initState() {
22
+    super.initState();
23
+    if (Get.arguments != null) {
24
+      isBack = Get.arguments['isBack'];
25
+    }
26
+  }
18
 
27
 
19
   List<Address> addressList = [
28
   List<Address> addressList = [
20
     Address.fromJson({'address': '777', 'isDefault': false}),
29
     Address.fromJson({'address': '777', 'isDefault': false}),
31
       addressList[index].isDefault = true;
40
       addressList[index].isDefault = true;
32
     });
41
     });
33
   }
42
   }
34
-  void onDelete(index){
43
+
44
+  void onDelete(index) {
35
     showDialog(
45
     showDialog(
36
         context: context,
46
         context: context,
37
         builder: (context) {
47
         builder: (context) {
38
-          return AlertDialog(
39
-              content: Text("您确定要删除此地址吗?"),
40
-              actions: <Widget>[
41
-                TextButton(
42
-                  child: Text("取消"),
43
-                  onPressed: () {
44
-                    print("取消");
45
-                    Navigator.pop(context, 'Cancle');
46
-                  },
47
-                ),
48
-                TextButton(
49
-                    child: Text("确定"),
50
-                    onPressed: () {
51
-                      // setState(() {
52
-                      //   addressList.remove(addressList[e]);
53
-                      // });
54
-                      Navigator.pop(context, "Ok");
55
-                      Fluttertoast.showToast(
56
-                          msg: '删除成功!');
57
-                    })
58
-              ]);
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
+          ]);
59
         });
66
         });
60
   }
67
   }
61
 
68
 
91
                           (e) => AddressCard(
98
                           (e) => AddressCard(
92
                             No: e + 1,
99
                             No: e + 1,
93
                             item: addressList[e],
100
                             item: addressList[e],
101
+                            isBack: isBack,
94
                             onChange: () {
102
                             onChange: () {
95
                               onChange(e);
103
                               onChange(e);
96
                             },
104
                             },
97
                             onEdit: () {
105
                             onEdit: () {
98
-                              Get.toNamed('/addAddress',arguments: {'item':addressList[e]});
106
+                              Get.toNamed('/addAddress',
107
+                                  arguments: {'item': addressList[e]});
99
                             },
108
                             },
100
                             onDelete: () {
109
                             onDelete: () {
101
                               onDelete(e);
110
                               onDelete(e);
102
                             },
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
+                            },
103
                           ),
121
                           ),
104
                         )
122
                         )
105
                         .toList()),
123
                         .toList()),

+ 56
- 35
lib/pages/addressList/widget/AddressCard.dart View File

6
 class AddressCard extends StatefulWidget {
6
 class AddressCard extends StatefulWidget {
7
   final Address item;
7
   final Address item;
8
   final int No;
8
   final int No;
9
+  final bool isBack;
9
   final GestureTapCallback onChange;
10
   final GestureTapCallback onChange;
10
   final GestureTapCallback onDelete;
11
   final GestureTapCallback onDelete;
11
   final GestureTapCallback onEdit;
12
   final GestureTapCallback onEdit;
12
-  AddressCard(
13
+  final GestureTapCallback onBack;
14
+  const AddressCard(
13
       {Key? key,
15
       {Key? key,
14
       required this.item,
16
       required this.item,
15
       required this.No,
17
       required this.No,
18
+      required this.isBack,
16
       required this.onChange,
19
       required this.onChange,
17
       required this.onDelete,
20
       required this.onDelete,
18
-      required this.onEdit})
21
+      required this.onEdit,
22
+      required this.onBack})
19
       : super(key: key);
23
       : super(key: key);
20
 
24
 
21
   @override
25
   @override
22
   _AddressCard createState() =>
26
   _AddressCard createState() =>
23
-      _AddressCard(item, No, onChange, onDelete, onEdit);
27
+      _AddressCard(item, No, onChange, onDelete, onEdit, isBack, onBack);
24
 }
28
 }
25
 
29
 
26
 class _AddressCard extends State<AddressCard> {
30
 class _AddressCard extends State<AddressCard> {
27
   final Address item;
31
   final Address item;
28
   final int No;
32
   final int No;
33
+  final bool isBack;
29
   final GestureTapCallback onChange;
34
   final GestureTapCallback onChange;
30
   final GestureTapCallback onDelete;
35
   final GestureTapCallback onDelete;
31
   final GestureTapCallback onEdit;
36
   final GestureTapCallback onEdit;
32
-  _AddressCard(this.item, this.No, this.onChange, this.onDelete, this.onEdit);
37
+  final GestureTapCallback onBack;
38
+  _AddressCard(this.item, this.No, this.onChange, this.onDelete, this.onEdit,
39
+      this.isBack, this.onBack);
33
   @override
40
   @override
34
   Widget build(BuildContext context) {
41
   Widget build(BuildContext context) {
35
     return Container(
42
     return Container(
81
               decoration: BoxDecoration(
88
               decoration: BoxDecoration(
82
                 border: Border(
89
                 border: Border(
83
                   bottom: BorderSide(
90
                   bottom: BorderSide(
84
-                      width: 0.5.h,
91
+                      width: 1.h,
85
                       color: const Color(0xcc000000),
92
                       color: const Color(0xcc000000),
86
                       style: BorderStyle.solid),
93
                       style: BorderStyle.solid),
87
                 ),
94
                 ),
113
               ),
120
               ),
114
             ),
121
             ),
115
           ),
122
           ),
116
-          Row(
117
-            mainAxisAlignment: MainAxisAlignment.spaceBetween,
118
-            children: [
119
-              GestureDetector(
120
-                onTap: onChange,
121
-                child: Row(
122
-                  children: [
123
-                    const Text('设为默认地址'),
124
-                    Radio<bool>(
125
-                        value: true,
126
-                        activeColor: const Color(0xFFFF703B),
127
-                        groupValue: item.isDefault,
128
-                        onChanged: (value){
129
-                          onChange();
130
-                        }),
131
-                  ],
123
+          if (isBack)
124
+            GestureDetector(
125
+              onTap: onBack,
126
+              child: Container(
127
+                width: 315.w,
128
+                margin: EdgeInsets.fromLTRB(0, 5.w, 0, 0),
129
+                child: Text(
130
+                  '选择此地址',
131
+                  style:
132
+                      TextStyle(fontSize: 17.sp, fontWeight: FontWeight.w800),
132
                 ),
133
                 ),
133
               ),
134
               ),
134
-              GestureDetector(
135
-                onTap: onDelete,
136
-                child: Row(
137
-                  children: [
138
-                    const Text('删除'),
139
-                    Image.asset(
140
-                      'images/icons/delete.png',
141
-                      width: 25.w,
142
-                      height: 25.w,
143
-                    ),
144
-                  ],
135
+            ),
136
+          if (!isBack)
137
+            Row(
138
+              mainAxisAlignment: MainAxisAlignment.spaceBetween,
139
+              children: [
140
+                GestureDetector(
141
+                  onTap: onChange,
142
+                  child: Row(
143
+                    children: [
144
+                      const Text('设为默认地址'),
145
+                      Radio<bool>(
146
+                          value: true,
147
+                          activeColor: const Color(0xFFFF703B),
148
+                          groupValue: item.isDefault,
149
+                          onChanged: (value) {
150
+                            onChange();
151
+                          }),
152
+                    ],
153
+                  ),
145
                 ),
154
                 ),
146
-              ),
147
-            ],
148
-          ),
155
+                GestureDetector(
156
+                  onTap: onDelete,
157
+                  child: Row(
158
+                    children: [
159
+                      const Text('删除'),
160
+                      Image.asset(
161
+                        'images/icons/delete.png',
162
+                        width: 25.w,
163
+                        height: 25.w,
164
+                      ),
165
+                    ],
166
+                  ),
167
+                ),
168
+              ],
169
+            ),
149
         ],
170
         ],
150
       ),
171
       ),
151
     );
172
     );

+ 103
- 32
lib/pages/orderInfo/index.dart View File

1
+import 'package:farmer_client/widgets/DefaultButton.dart';
1
 import 'package:flutter/material.dart';
2
 import 'package:flutter/material.dart';
2
 import 'package:flutter_screenutil/flutter_screenutil.dart';
3
 import 'package:flutter_screenutil/flutter_screenutil.dart';
4
+import 'package:fluttertoast/fluttertoast.dart';
5
+import 'package:get/get.dart';
3
 
6
 
4
 import '../../widgets/OrderInfoCard.dart';
7
 import '../../widgets/OrderInfoCard.dart';
5
 
8
 
6
-
7
-
8
-
9
 class OrderPageInfo extends StatefulWidget {
9
 class OrderPageInfo extends StatefulWidget {
10
   const OrderPageInfo({Key? key}) : super(key: key);
10
   const OrderPageInfo({Key? key}) : super(key: key);
11
 
11
 
14
 }
14
 }
15
 
15
 
16
 class _OrderPageInfoState extends State<OrderPageInfo> {
16
 class _OrderPageInfoState extends State<OrderPageInfo> {
17
+  void onCancel() {
18
+    showDialog(
19
+        context: context,
20
+        builder: (context) {
21
+          return AlertDialog(content: Text("您确定要取消订单吗?"), actions: <Widget>[
22
+            TextButton(
23
+              child: Text("取消"),
24
+              onPressed: () {
25
+                print("取消");
26
+                Navigator.pop(context, 'Cancle');
27
+              },
28
+            ),
29
+            TextButton(
30
+                child: Text("确定"),
31
+                onPressed: () {
32
+                  // setState(() {
33
+                  //   addressList.remove(addressList[e]);
34
+                  // });
35
+                  Navigator.pop(context, "Ok");
36
+                  Fluttertoast.showToast(msg: '取消成功!');
37
+                  Get.offAllNamed('/');
38
+                })
39
+          ]);
40
+        });
41
+  }
42
+
17
   @override
43
   @override
18
   Widget build(BuildContext context) {
44
   Widget build(BuildContext context) {
19
     return Scaffold(
45
     return Scaffold(
31
               fontWeight: FontWeight.bold),
57
               fontWeight: FontWeight.bold),
32
         ),
58
         ),
33
       ),
59
       ),
34
-      body:      Column(
60
+      body: Column(
35
         children: [
61
         children: [
36
           OrderInfoCard(),
62
           OrderInfoCard(),
37
-
63
+          Spacer(),
38
           Container(
64
           Container(
39
-            height: 130.h,
40
-            margin: EdgeInsets.only(top: 20.0, bottom: 0.0),
41
-            alignment: Alignment.bottomCenter,
42
-            child: SizedBox(
43
-              width: 315.w,
44
-              height: 49.h,
45
-              child: ElevatedButton(
46
-                onPressed: () {
47
-                  // _handelSubmit();
48
-                  print('用户点击了支付啊阿松大撒地方');
49
-                },
50
-                child: const Text(
51
-                  "支付",
52
-                  style: TextStyle(
53
-                      fontSize: 18,
54
-                      color: Colors.white,
55
-                      fontWeight: FontWeight.bold),
65
+            margin: EdgeInsets.fromLTRB(15.w, 0, 15.w, 50.h),
66
+            child: Row(
67
+              mainAxisAlignment: MainAxisAlignment.spaceBetween,
68
+              children: [
69
+                GestureDetector(
70
+                  onTap: () {
71
+                    onCancel();
72
+                  },
73
+                  child: Container(
74
+                    width: 150.w,
75
+                    height: 49.h,
76
+                    decoration: BoxDecoration(
77
+                        color: const Color(0xffffffff),
78
+                        border: Border.all(
79
+                            color: const Color(0xFFFF703B),
80
+                            width: 1.w,
81
+                            style: BorderStyle.solid),
82
+                        borderRadius:
83
+                            BorderRadius.all(Radius.circular(24.5.w))),
84
+                    child: Center(
85
+                      child: Text(
86
+                        '取消',
87
+                        style: TextStyle(
88
+                            fontSize: 20.sp,
89
+                            color: const Color(0xFFFF703B),
90
+                            fontWeight: FontWeight.bold),
91
+                      ),
92
+                    ),
93
+                  ),
56
                 ),
94
                 ),
57
-                style: ButtonStyle(
58
-                  elevation: MaterialStateProperty.all(0),
59
-                  backgroundColor:
60
-                  MaterialStateProperty.all(const Color(0xFFFF703B)),
61
-                  shape: MaterialStateProperty.all(
62
-                      const RoundedRectangleBorder(
63
-                          borderRadius:
64
-                          BorderRadius.all(Radius.circular(24.4)))),
95
+                DefaultButton(
96
+                  color: const Color(0xffffffff),
97
+                  backColor: const Color(0xFFFF703B),
98
+                  width: 150.w,
99
+                  height: 49.h,
100
+                  text: '支付',
101
+                  onPressed: () {
102
+                    Fluttertoast.showToast(msg: '支付成功!');
103
+                    Get.offAllNamed('/');
104
+                  },
105
+                  margin: const EdgeInsets.all(0),
106
+                  fontSize: 20.sp,
107
+                  radius: 24.5.w,
65
                 ),
108
                 ),
66
-              ),
109
+              ],
67
             ),
110
             ),
68
           ),
111
           ),
112
+          // Container(
113
+          //   height: 130.h,
114
+          //   margin: EdgeInsets.only(top: 20.0, bottom: 0.0),
115
+          //   alignment: Alignment.bottomCenter,
116
+          //   child: SizedBox(
117
+          //     width: 315.w,
118
+          //     height: 49.h,
119
+          //     child: ElevatedButton(
120
+          //       onPressed: () {
121
+          //         // _handelSubmit();
122
+          //         print('用户点击了支付啊阿松大撒地方');
123
+          //       },
124
+          //       child: const Text(
125
+          //         "支付",
126
+          //         style: TextStyle(
127
+          //             fontSize: 18,
128
+          //             color: Colors.white,
129
+          //             fontWeight: FontWeight.bold),
130
+          //       ),
131
+          //       style: ButtonStyle(
132
+          //         elevation: MaterialStateProperty.all(0),
133
+          //         backgroundColor:
134
+          //             MaterialStateProperty.all(const Color(0xFFFF703B)),
135
+          //         shape: MaterialStateProperty.all(const RoundedRectangleBorder(
136
+          //             borderRadius: BorderRadius.all(Radius.circular(24.4)))),
137
+          //       ),
138
+          //     ),
139
+          //   ),
140
+          // ),
69
         ],
141
         ],
70
       ),
142
       ),
71
     );
143
     );
72
-
73
   }
144
   }
74
 }
145
 }

+ 5
- 1
lib/routes/pages.dart View File

1
 
1
 
2
 import 'package:farmer_client/pages/ArticleInfo/ArticleInfo.dart';
2
 import 'package:farmer_client/pages/ArticleInfo/ArticleInfo.dart';
3
+import 'package:farmer_client/pages/OrderConfirmation/index.dart';
3
 import 'package:farmer_client/pages/aboutUs/index.dart';
4
 import 'package:farmer_client/pages/aboutUs/index.dart';
4
 import 'package:farmer_client/pages/addAddress/index.dart';
5
 import 'package:farmer_client/pages/addAddress/index.dart';
5
 import 'package:farmer_client/pages/addressList/index.dart';
6
 import 'package:farmer_client/pages/addressList/index.dart';
6
 import 'package:farmer_client/pages/agreement/index.dart';
7
 import 'package:farmer_client/pages/agreement/index.dart';
7
 import 'package:farmer_client/pages/feedback/index.dart';
8
 import 'package:farmer_client/pages/feedback/index.dart';
9
+import 'package:farmer_client/pages/orderInfo/index.dart';
8
 import 'package:farmer_client/pages/userInfo/index.dart';
10
 import 'package:farmer_client/pages/userInfo/index.dart';
9
 import 'package:get/get.dart';
11
 import 'package:get/get.dart';
10
 import '../pages/index.dart';
12
 import '../pages/index.dart';
13
 List<GetPage> pages = [
15
 List<GetPage> pages = [
14
   GetPage(name: '/', page: () =>  Home()),
16
   GetPage(name: '/', page: () =>  Home()),
15
   GetPage(name: '/ArticleInfo', page: () =>  ArticleInfo()),//资讯详情
17
   GetPage(name: '/ArticleInfo', page: () =>  ArticleInfo()),//资讯详情
16
-  GetPage(name: '/splash', page: () => MachineryDetailPage()),//SplashScreen
18
+  GetPage(name: '/splash', page: () => SplashScreen()),//SplashScreen
17
   GetPage(name: '/login', page: () =>  MyRouteLogin()),
19
   GetPage(name: '/login', page: () =>  MyRouteLogin()),
18
   GetPage(name: '/addressList', page: () =>  AddressList()),
20
   GetPage(name: '/addressList', page: () =>  AddressList()),
19
   GetPage(name: '/addAddress', page: () =>  AddAddress()),
21
   GetPage(name: '/addAddress', page: () =>  AddAddress()),
22
   GetPage(name: '/aboutUs', page: () =>  AboutUs()),
24
   GetPage(name: '/aboutUs', page: () =>  AboutUs()),
23
   GetPage(name: '/agreement', page: () =>  Agreement()),
25
   GetPage(name: '/agreement', page: () =>  Agreement()),
24
   GetPage(name: '/feedback', page: () =>  Feedback()),
26
   GetPage(name: '/feedback', page: () =>  Feedback()),
27
+  GetPage(name: '/orderConfirmation', page: () =>  OrderConfirmation()),
28
+  GetPage(name: '/orderPageInfo', page: () =>  OrderPageInfo()),
25
 ];
29
 ];

+ 0
- 2
lib/widgets/CarsCard.dart View File

90
                     child: ElevatedButton(
90
                     child: ElevatedButton(
91
                       onPressed: () {
91
                       onPressed: () {
92
                         Get.to(OrderConfirmation());
92
                         Get.to(OrderConfirmation());
93
-                        print('点我去预约');
94
-
95
                       },
93
                       },
96
                       child: const Text(
94
                       child: const Text(
97
                         "预约",
95
                         "预约",

+ 16
- 17
lib/widgets/Search.dart View File

1
 import 'package:flutter/material.dart';
1
 import 'package:flutter/material.dart';
2
 import 'package:flutter_screenutil/flutter_screenutil.dart';
2
 import 'package:flutter_screenutil/flutter_screenutil.dart';
3
 
3
 
4
-
5
 class Search extends StatefulWidget {
4
 class Search extends StatefulWidget {
6
   const Search({Key? key}) : super(key: key);
5
   const Search({Key? key}) : super(key: key);
7
 
6
 
10
 }
9
 }
11
 
10
 
12
 class _SearchState extends State<Search> {
11
 class _SearchState extends State<Search> {
13
-
14
   @override
12
   @override
15
   Widget build(BuildContext context) {
13
   Widget build(BuildContext context) {
16
-    return LayoutBuilder(builder: (BuildContext context, BoxConstraints constraints){
17
-      return  Column(
14
+    return LayoutBuilder(
15
+        builder: (BuildContext context, BoxConstraints constraints) {
16
+      return Column(
18
         children: [
17
         children: [
19
           Container(
18
           Container(
20
-            decoration: BoxDecoration(
21
-              color: Colors.white
22
-            ),
23
-      width: constraints.maxWidth,
24
-      height: 34,
25
-      alignment: Alignment.center,
26
-      child:  TextField(
19
+            decoration: BoxDecoration(color: Colors.white),
20
+            width: constraints.maxWidth,
21
+            height: 34,
22
+            alignment: Alignment.center,
23
+            child: TextField(
27
               onChanged: (value) {
24
               onChanged: (value) {
28
                 print('打一个字我搜索一下$value');
25
                 print('打一个字我搜索一下$value');
29
               },
26
               },
31
                 FocusScope.of(context).requestFocus(FocusNode());
28
                 FocusScope.of(context).requestFocus(FocusNode());
32
                 print('点击键盘搜索');
29
                 print('点击键盘搜索');
33
               },
30
               },
34
-              style: const TextStyle(fontSize: 15, color: Colors.black, textBaseline: TextBaseline.alphabetic),
31
+              style: const TextStyle(
32
+                  fontSize: 15,
33
+                  color: Colors.black,
34
+                  textBaseline: TextBaseline.alphabetic),
35
               decoration: const InputDecoration(
35
               decoration: const InputDecoration(
36
                 isDense: true,
36
                 isDense: true,
37
                 prefixIcon: Padding(
37
                 prefixIcon: Padding(
38
                   padding: EdgeInsets.only(left: 0),
38
                   padding: EdgeInsets.only(left: 0),
39
-                  child:  Icon(Icons.search,),
39
+                  child: Icon(
40
+                    Icons.search,
41
+                  ),
40
                 ),
42
                 ),
41
                 fillColor: Color(0x30cccccc),
43
                 fillColor: Color(0x30cccccc),
42
                 filled: true,
44
                 filled: true,
43
                 border: OutlineInputBorder(borderSide: BorderSide.none),
45
                 border: OutlineInputBorder(borderSide: BorderSide.none),
44
-      contentPadding: EdgeInsets.all(0),
46
+                contentPadding: EdgeInsets.all(0),
45
                 enabledBorder: OutlineInputBorder(
47
                 enabledBorder: OutlineInputBorder(
46
                     borderSide: BorderSide(color: Color(0x00FF0000)),
48
                     borderSide: BorderSide(color: Color(0x00FF0000)),
47
                     borderRadius: BorderRadius.all(Radius.circular(100))),
49
                     borderRadius: BorderRadius.all(Radius.circular(100))),
49
                 hintStyle: TextStyle(
51
                 hintStyle: TextStyle(
50
                   textBaseline: TextBaseline.alphabetic, //用于提示文字对齐
52
                   textBaseline: TextBaseline.alphabetic, //用于提示文字对齐
51
                 ),
53
                 ),
52
-
53
               ),
54
               ),
54
-
55
             ),
55
             ),
56
           ),
56
           ),
57
         ],
57
         ],
58
       );
58
       );
59
     });
59
     });
60
-
61
   }
60
   }
62
 }
61
 }

+ 1
- 1
pubspec.lock View File

68
     dependency: "direct main"
68
     dependency: "direct main"
69
     description:
69
     description:
70
       name: carousel_slider
70
       name: carousel_slider
71
-      url: "https://pub.dartlang.org"
71
+      url: "https://pub.flutter-io.cn"
72
     source: hosted
72
     source: hosted
73
     version: "4.0.0"
73
     version: "4.0.0"
74
   characters:
74
   characters: