李志伟 преди 3 години
родител
ревизия
4810ab0531

images/icons/ListBack.png → images/icons/nullDataImg.png Целия файл


BIN
images/icons/search.png Целия файл


+ 92
- 97
lib/pages/MoreCars/index.dart Целия файл

@@ -1,12 +1,11 @@
1
-
2 1
 import 'package:flutter/material.dart';
3 2
 import 'package:flutter_screenutil/flutter_screenutil.dart';
3
+import 'package:get/get.dart';
4 4
 
5 5
 import '../../widgets/CarsCard.dart';
6 6
 import '../../widgets/Search.dart';
7 7
 import '../TabBar/widgets/home/widgets/headers.dart';
8 8
 
9
-
10 9
 class MoreCars extends StatefulWidget {
11 10
   const MoreCars({Key? key}) : super(key: key);
12 11
 
@@ -14,115 +13,111 @@ class MoreCars extends StatefulWidget {
14 13
   State<MoreCars> createState() => _MoreCarsState();
15 14
 }
16 15
 
17
-class _MoreCarsState extends State<MoreCars> with TickerProviderStateMixin  {
18
-
19
-  late TabController _controller = TabController(length: tabText.length, vsync: this);
20
-   List<String> tabText= [
21
-     '全部',
22
-     '播种机',
23
-     '收割机',
24
-     '挺长名字的农机选项分类',
16
+class _MoreCarsState extends State<MoreCars> with TickerProviderStateMixin {
17
+  late TabController _controller =
18
+      TabController(length: tabText.length, vsync: this);
19
+  List<String> tabText = [
20
+    '全部',
21
+    '播种机',
22
+    '收割机',
23
+    '挺长名字的农机选项分类',
25 24
   ];
26 25
 
27
-
28
-
29 26
   @override
30 27
   void initState() {
31 28
     // TODO: implement initState
32 29
     super.initState();
33 30
   }
31
+
34 32
   @override
35 33
   Widget build(BuildContext context) {
36 34
     // _controller=TabController(length: tabText.length, vsync: this);
37 35
     return Scaffold(
38
-      resizeToAvoidBottomInset: false,
39
-      appBar: AppBar(
40
-        elevation: 0,
41
-        centerTitle: true,
42
-        backgroundColor: Colors.white,
43
-        title:Text(
44
-          '更多',
45
-          style: TextStyle(
46
-              color: Colors.black,
47
-              fontSize: 17.sp,
48
-              letterSpacing: 2,
49
-              fontWeight: FontWeight.bold),
36
+        resizeToAvoidBottomInset: false,
37
+        appBar: AppBar(
38
+          elevation: 0,
39
+          centerTitle: true,
40
+          backgroundColor: Colors.white,
41
+          title: Text(
42
+            '更多',
43
+            style: TextStyle(
44
+                color: Colors.black,
45
+                fontSize: 17.sp,
46
+                letterSpacing: 2,
47
+                fontWeight: FontWeight.bold),
48
+          ),
50 49
         ),
51
-
52
-      ),
53
-      body: ListView(
54
-          children: [Column(
55
-          children: [
56
-            Container(
57
-              padding: EdgeInsets.fromLTRB(20, 15, 20, 15),
58
-
59
-              decoration: BoxDecoration(
60
-                color: Colors.white
50
+        body: ListView(children: [
51
+          Column(
52
+            children: [
53
+              Container(
54
+                padding: EdgeInsets.fromLTRB(20, 15, 20, 15),
55
+
56
+                decoration: BoxDecoration(color: Colors.white),
57
+                // child:Search(),
58
+                child: Container(
59
+                    height: 32.w,
60
+                    decoration: const BoxDecoration(color: Colors.white),
61
+                    child: GestureDetector(
62
+                        onTap: () {
63
+                          Get.toNamed('/searchPage');
64
+                        },
65
+                        child: Container(
66
+                          decoration: const BoxDecoration(
67
+                            // color: Colors.red,
68
+                            color: Color(0x30cccccc),
69
+                            borderRadius: BorderRadius.all(Radius.circular(25)),
70
+                          ),
71
+                          child: Row(
72
+                            children: [
73
+                              Padding(
74
+                                padding: EdgeInsets.fromLTRB(15, 0, 5, 0),
75
+                                child: Icon(
76
+                                  Icons.search,
77
+                                  size: 19,
78
+                                  color: Color(0xff666666),
79
+                                ),
80
+                              ),
81
+                              Text(
82
+                                '请输入关键字查询',
83
+                                style: TextStyle(
84
+                                    color: Color(0xff666666), fontSize: 14),
85
+                              )
86
+                            ],
87
+                          ),
88
+                        )
89
+                        // Search(),
90
+                        )),
61 91
               ),
62
-              // child:Search(),
63
-              child:          Container(
64
-                  height: 32.w,
65
-                  decoration: const BoxDecoration(
66
-                      color: Colors.white
67
-                  ),
68
-                  child: GestureDetector(
69
-                      onTap: (){
70
-                        print('点击了搜索');
71
-                      },
72
-                      child: Container(
73
-                        decoration: const BoxDecoration(
74
-                          // color: Colors.red,
75
-                          color: Color(0x30cccccc),
76
-                          borderRadius: BorderRadius.all(Radius.circular(25)),
77
-                        ),
78
-                        child: Row(
79
-                          children: [
80
-                            Padding(padding: EdgeInsets.fromLTRB(15, 0, 5, 0),
81
-                              child: Icon(Icons.search,size: 19,color:Color(0xff666666) ,),
82
-                            ),
83
-                            Text('请输入关键字查询',style: TextStyle(color: Color(0xff666666),fontSize: 14),)
84
-                          ],
85
-                        ),
86
-                      )
87
-                    // Search(),
88
-                  )
92
+              TabBar(
93
+                labelStyle: TextStyle(
94
+                    fontSize: ScreenUtil().setSp(19),
95
+                    fontWeight: FontWeight.bold), //选中的样式
96
+                unselectedLabelStyle:
97
+                    TextStyle(fontSize: ScreenUtil().setSp(16)), //未选中的样式
98
+                controller: _controller,
99
+                isScrollable: true, //可滚动
100
+                indicatorColor: Colors.black, //指示器的颜色
101
+                labelColor: Colors.black, //选中文字颜色
102
+                unselectedLabelColor: Color(0xffadadad),
103
+                // indicatorSize: TabBarIndicatorSize.label, //指示器与文字等宽
104
+                tabs: tabText.map((e) => Tab(text: e)).toList(),
105
+                onTap: (int i) {
106
+                  print('当前+${i}');
107
+                },
89 108
               ),
90
-            ),
91
-            
92
-            TabBar(
93
-              labelStyle: TextStyle(fontSize: ScreenUtil().setSp(19),fontWeight: FontWeight.bold), //选中的样式
94
-              unselectedLabelStyle: TextStyle(fontSize:ScreenUtil().setSp(16)), //未选中的样式
95
-              controller: _controller,
96
-              isScrollable: true, //可滚动
97
-              indicatorColor: Colors.black, //指示器的颜色
98
-              labelColor: Colors.black, //选中文字颜色
99
-              unselectedLabelColor: Color(0xffadadad),
100
-              // indicatorSize: TabBarIndicatorSize.label, //指示器与文字等宽
101
-              tabs: tabText.map((e) => Tab(text: e)).toList(),
102
-              onTap: (int i) {
103
-                print('当前+${i}');
104
-              },
105
-
106
-            ),
107
-            Container(
108
-              child: Column(
109
-                children: [
110
-                  CarsCard(),
111
-                  CarsCard(),
112
-                  CarsCard(),
113
-                  CarsCard(),
114
-                ],
109
+              Container(
110
+                child: Column(
111
+                  children: [
112
+                    CarsCard(),
113
+                    CarsCard(),
114
+                    CarsCard(),
115
+                    CarsCard(),
116
+                  ],
117
+                ),
115 118
               )
116
-              ,
117
-            )
118
-
119
-
120
-          ],
121
-        )]
122
-
123
-      )
124
-
125
-    );
119
+            ],
120
+          )
121
+        ]));
126 122
   }
127 123
 }
128
-

+ 24
- 19
lib/pages/TabBar/widgets/home/widgets/headers.dart Целия файл

@@ -1,6 +1,6 @@
1 1
 import 'package:flutter/material.dart';
2 2
 import 'package:flutter_screenutil/flutter_screenutil.dart';
3
-
3
+import 'package:get/get.dart';
4 4
 
5 5
 class headers extends StatelessWidget {
6 6
   const headers({Key? key}) : super(key: key);
@@ -8,13 +8,11 @@ class headers extends StatelessWidget {
8 8
   @override
9 9
   Widget build(BuildContext context) {
10 10
     return Container(
11
-      child:           Row(
11
+      child: Row(
12 12
         children: [
13 13
           Container(
14 14
             height: 32.w,
15
-            decoration: BoxDecoration(
16
-                color: Colors.white
17
-            ),
15
+            decoration: BoxDecoration(color: Colors.white),
18 16
             child: Row(
19 17
               children: [
20 18
                 Image(
@@ -23,8 +21,10 @@ class headers extends StatelessWidget {
23 21
                   width: 14.w,
24 22
                   height: 17.h,
25 23
                 ),
26
-                Padding(padding: EdgeInsets.fromLTRB(5, 0, 0, 0),
27
-                  child: Text('邓州市',
24
+                Padding(
25
+                  padding: EdgeInsets.fromLTRB(5, 0, 0, 0),
26
+                  child: Text(
27
+                    '邓州市',
28 28
                     style: TextStyle(
29 29
                       color: Color(0xff202020),
30 30
                       fontSize: 16.sp,
@@ -34,19 +34,16 @@ class headers extends StatelessWidget {
34 34
                 ),
35 35
                 const Icon(Icons.arrow_drop_down)
36 36
               ],
37
-
38 37
             ),
39 38
           ),
40 39
           Container(
41 40
               padding: EdgeInsets.fromLTRB(15.w, 0, 0, 0),
42 41
               width: 260.w,
43 42
               height: 32.w,
44
-              decoration: const BoxDecoration(
45
-                  color: Colors.white
46
-              ),
43
+              decoration: const BoxDecoration(color: Colors.white),
47 44
               child: GestureDetector(
48
-                  onTap: (){
49
-                    print('点击了搜索');
45
+                  onTap: () {
46
+                    Get.toNamed('/searchPage');
50 47
                   },
51 48
                   child: Container(
52 49
                     decoration: const BoxDecoration(
@@ -56,16 +53,24 @@ class headers extends StatelessWidget {
56 53
                     ),
57 54
                     child: Row(
58 55
                       children: [
59
-                        Padding(padding: EdgeInsets.fromLTRB(15, 0, 5, 0),
60
-                          child: Icon(Icons.search,size: 19,color:Color(0xff666666) ,),
56
+                        Padding(
57
+                          padding: EdgeInsets.fromLTRB(15, 0, 5, 0),
58
+                          child: Icon(
59
+                            Icons.search,
60
+                            size: 19,
61
+                            color: Color(0xff666666),
62
+                          ),
61 63
                         ),
62
-                        Text('请输入关键字查询',style: TextStyle(color: Color(0xff666666),fontSize: 14),)
64
+                        Text(
65
+                          '请输入关键字查询',
66
+                          style:
67
+                              TextStyle(color: Color(0xff666666), fontSize: 14),
68
+                        )
63 69
                       ],
64 70
                     ),
65 71
                   )
66
-                // Search(),
67
-              )
68
-          )
72
+                  // Search(),
73
+                  ))
69 74
         ],
70 75
       ),
71 76
     );

+ 1
- 1
lib/pages/machinery/detail/index.dart Целия файл

@@ -9,7 +9,7 @@ class MachineryDetailPage extends StatelessWidget {
9 9
 
10 10
   // 响应预约事件
11 11
   void handleClick() {
12
-
12
+    Get.toNamed('/orderConfirmation');
13 13
   }
14 14
 
15 15
   @override

+ 87
- 0
lib/pages/search/index.jsx.dart Целия файл

@@ -0,0 +1,87 @@
1
+import 'package:farmer_client/widgets/NullCard.dart';
2
+import 'package:flutter/material.dart';
3
+import 'package:flutter_screenutil/flutter_screenutil.dart';
4
+import '../../widgets/CarsCard.dart';
5
+
6
+class SearchPage extends StatefulWidget {
7
+  const SearchPage({Key? key}) : super(key: key);
8
+
9
+  @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),
29
+        ),
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.w,
39
+              margin: EdgeInsets.symmetric(vertical: 15.w, horizontal: 15.h),
40
+              padding: EdgeInsets.all(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
+                      },
68
+                    ),
69
+                  ),
70
+                ],
71
+              ),
72
+            ),
73
+            Container(
74
+              child: Column(
75
+                children: [
76
+                  // NullCard(text: '暂无农机信息'),
77
+                  CarsCard(),
78
+                  CarsCard(),
79
+                  CarsCard(),
80
+                  CarsCard(),
81
+                ],
82
+              ),
83
+            )
84
+          ])),
85
+    );
86
+  }
87
+}

+ 2
- 0
lib/routes/pages.dart Целия файл

@@ -7,6 +7,7 @@ import 'package:farmer_client/pages/addressList/index.dart';
7 7
 import 'package:farmer_client/pages/agreement/index.dart';
8 8
 import 'package:farmer_client/pages/feedback/index.dart';
9 9
 import 'package:farmer_client/pages/orderInfo/index.dart';
10
+import 'package:farmer_client/pages/search/index.jsx.dart';
10 11
 import 'package:farmer_client/pages/userInfo/index.dart';
11 12
 import 'package:get/get.dart';
12 13
 import '../pages/MoreCars/index.dart';
@@ -28,4 +29,5 @@ List<GetPage> pages = [
28 29
   GetPage(name: '/feedback', page: () =>  Feedback()),
29 30
   GetPage(name: '/orderConfirmation', page: () =>  OrderConfirmation()),
30 31
   GetPage(name: '/orderPageInfo', page: () =>  OrderPageInfo()),
32
+  GetPage(name: '/searchPage', page: () =>  SearchPage()),
31 33
 ];

+ 0
- 1
lib/widgets/CarsCard.dart Целия файл

@@ -38,7 +38,6 @@ class CarsCard extends StatelessWidget {
38 38
           GestureDetector(
39 39
             onTap: (){
40 40
               Get.to(MachineryDetailPage());
41
-
42 41
             },
43 42
             child:Image.network(
44 43
               "http://yz-shigongli.oss-accelerate.aliyuncs.com/2022-03/1648094119154-7b280bbf63105a8e90299e2d79c8c6ee.jpeg",

+ 33
- 0
lib/widgets/NullCard.dart Целия файл

@@ -0,0 +1,33 @@
1
+import 'package:flutter/material.dart';
2
+import 'package:flutter_screenutil/flutter_screenutil.dart';
3
+
4
+class NullCard extends StatelessWidget {
5
+  final String text;
6
+  const NullCard({Key? key, required this.text}) : super(key: key);
7
+  @override
8
+  Widget build(BuildContext context) {
9
+    return Container(
10
+      width: 345.w,
11
+      padding: EdgeInsets.all(30.w),
12
+      alignment: Alignment.center,
13
+      child: Column(
14
+        children: [
15
+          Container(
16
+            margin: EdgeInsets.fromLTRB(0, 0, 0, 22.h),
17
+            child: Image.asset(
18
+              'images/icons/nullDataImg.png',
19
+              width: 135.w,
20
+            ),
21
+          ),
22
+          Text(
23
+            text,
24
+            style: TextStyle(
25
+                fontSize: 17.sp, color: Color(0xFFb4b4b4)),
26
+          )
27
+        ],
28
+      ),
29
+    );
30
+  }
31
+
32
+
33
+}

+ 1
- 1
lib/widgets/Search.dart Целия файл

@@ -17,7 +17,7 @@ class _SearchState extends State<Search> {
17 17
         children: [
18 18
           Container(
19 19
             decoration: BoxDecoration(color: Colors.white),
20
-            width: constraints.maxWidth,
20
+            width: 345.w,
21 21
             height: 34,
22 22
             alignment: Alignment.center,
23 23
             child: TextField(