[baozhangchao] 3 lat temu
rodzic
commit
e145a18875

+ 6
- 1
lib/models/app.dart Wyświetl plik

@@ -16,8 +16,13 @@ class AppController extends GetxController {
16 16
   final testInt = 1.obs;
17 17
 
18 18
   get locationStr {
19
-    if (null == location.value) return null;
19
+    if(location.value!.longitude==null){
20
+      return null;
21
+
22
+    }else{
20 23
     return location.value!.longitude.toString() + "," + location.value!.latitude.toString();
24
+
25
+    }
21 26
   }
22 27
 
23 28
   @override

+ 6
- 20
lib/pages/ArticleInfo/ArticleInfo.dart Wyświetl plik

@@ -1,27 +1,14 @@
1 1
 import 'package:flutter/material.dart';
2 2
 import 'package:flutter_screenutil/flutter_screenutil.dart';
3 3
 
4
-class ArticleInfo extends StatelessWidget {
5
-  const ArticleInfo({Key? key}) : super(key: key);
4
+import '../../widgets/layout/BasicPage.dart';
5
+
6
+class ArticleInfo extends BasicPage {
6 7
 
7 8
   @override
8
-  Widget build(BuildContext context) {
9
-    return Scaffold(
10
-      resizeToAvoidBottomInset: false,
11
-      appBar: AppBar(
12
-        elevation: 0,
13
-        centerTitle: true,
14
-        backgroundColor: Colors.white,
15
-        title: Text(
16
-          '资讯详情',
17
-          style: TextStyle(
18
-              color: Colors.black,
19
-              fontSize: 17.sp,
20
-              letterSpacing: 2,
21
-              fontWeight: FontWeight.bold),
22
-        ),
23
-      ),
24
-        body: Container(
9
+  Widget builder(BuildContext context) {
10
+    naviTitle='资讯详情';
11
+    return  Container(
25 12
           padding: EdgeInsets.fromLTRB(15, 30, 15, 50),
26 13
 
27 14
           child: Column(
@@ -59,7 +46,6 @@ class ArticleInfo extends StatelessWidget {
59 46
               )
60 47
             ],
61 48
           ),
62
-        ),
63 49
     );
64 50
 
65 51
   }

+ 29
- 18
lib/pages/TabBar/widgets/home/index.dart Wyświetl plik

@@ -9,42 +9,48 @@ import '../../../../models/entities/banner.dart';
9 9
 import '../../../../services/homeAPI.dart';
10 10
 import '../../../../widgets/CarsCard.dart';
11 11
 import 'package:farmer_client/models/app.dart';
12
-import '../../../../widgets/layout/BasicPage.dart';
13 12
 import '../../../MoreCars/index.dart';
14 13
 
14
+class HomePage extends StatefulWidget {
15
+  const HomePage({Key? key}) : super(key: key);
15 16
 
17
+  @override
18
+  State<HomePage> createState() => _HomePageState();
19
+}
16 20
 
17
-class HomePage extends BasicPage {
18 21
 
19
-  final bannerList = Rx<List<banner>>([]);
22
+class _HomePageState extends State<HomePage> {
23
+  final CarouselController _controller = CarouselController();
24
+  List<banner> BannerList = [];
20 25
 
21 26
   @override
22
-  void beforeShow() {
27
+  void initState() {
28
+    super.initState();
23 29
     final location = AppController.t.locationStr;
30
+    print('location+$location');
24 31
 
25 32
     getHomeBanner('banner').then((value) {
26
-      value.forEach((item) {
27
-        bannerList.value.add(banner.fromJson(item));
33
+      setState(() {
34
+        value.forEach((item) {
35
+          BannerList.add(banner.fromJson(item));
36
+        });
28 37
       });
29 38
     });
30
-  }
31 39
 
32
-  List<Widget>? _renderList() {
33
-    return bannerList.value.map((item) => Container(
34
-      child: Center(
35
-          child: Image.network(item.thumb.toString(),
36
-              fit: BoxFit.cover, width: 350.w)),
37
-    )).toList();
40
+    getMachinery(location).then((value) {
41
+      print('$value');
42
+    });
38 43
   }
39 44
 
40 45
   @override
41
-  Widget builder (BuildContext context) {
46
+  Widget build(BuildContext context) {
42 47
     return Container(
43 48
       alignment: Alignment.center,
44 49
       padding: EdgeInsets.fromLTRB(15.w, 0, 15.w, 0),
45
-      child: Column(
50
+      child: ListView(
46 51
         children: [
47 52
           Container(
53
+            width: 20.w,
48 54
             child: TypeHeader(
49 55
               type: true,
50 56
             ),
@@ -52,8 +58,13 @@ class HomePage extends BasicPage {
52 58
           Container(
53 59
             margin: EdgeInsets.fromLTRB(0, 15, 0, 0),
54 60
             child:
55
-                Obx(() => CarouselSlider(
56
-              items: _renderList(),
61
+                // Text('asdasdas')
62
+                CarouselSlider(
63
+              items: BannerList.map((item) => Container(
64
+                    child: Center(
65
+                        child: Image.network(item.thumb.toString(),
66
+                            fit: BoxFit.cover, width: 350.w)),
67
+                  )).toList(),
57 68
               options: CarouselOptions(
58 69
                 autoPlay: true,
59 70
                 enlargeCenterPage: false, //图片中心放大
@@ -62,7 +73,7 @@ class HomePage extends BasicPage {
62 73
                 height: 214.w,
63 74
                 initialPage: 1, //初始页
64 75
               ),
65
-            )),
76
+            ),
66 77
           ),
67 78
           Container(
68 79
               margin: EdgeInsets.fromLTRB(0, 20, 0, 20),

+ 1
- 0
lib/pages/TabBar/widgets/home/widgets/headers.dart Wyświetl plik

@@ -11,6 +11,7 @@ class TypeHeader extends StatefulWidget {
11 11
   State<TypeHeader> createState() => _TypeHeaderState();
12 12
 }
13 13
 
14
+
14 15
 class _TypeHeaderState extends State<TypeHeader> {
15 16
   @override
16 17
   Widget build(BuildContext context) {

+ 13
- 9
lib/pages/login/login.dart Wyświetl plik

@@ -135,20 +135,25 @@ class _RouteLogin extends State<MyRouteLogin> {
135 135
             mainAxisAlignment: MainAxisAlignment.end,
136 136
             crossAxisAlignment: CrossAxisAlignment.start,
137 137
             children:[
138
-              const Text(
138
+              Padding(padding: EdgeInsets.fromLTRB(15, 0, 0, 5),
139
+              child:    const Text(
139 140
                 '您好!',
140 141
                 style: TextStyle(
141 142
                   fontWeight: FontWeight.bold,
142
-                  fontSize: 50,
143
+                  fontSize: 33,
143 144
                 ),
144 145
               ),
145
-              const Text(
146
-                '欢迎进入农户端应用!',
147
-                style: TextStyle(
148
-                  fontWeight: FontWeight.bold,
149
-                  fontSize: 35,
146
+              ),
147
+              Padding(padding: EdgeInsets.fromLTRB(15, 0, 0, 0),
148
+                child:    const Text(
149
+                  '欢迎进入农户端应用!',
150
+                  style: TextStyle(
151
+                    fontWeight: FontWeight.bold,
152
+                    fontSize: 27,
153
+                  ),
150 154
                 ),
151 155
               ),
156
+
152 157
               Cell(
153 158
                 // margin: EdgeInsets.symmetric(horizontal: 13.w),
154 159
                   margin: const EdgeInsets.fromLTRB(13, 43, 10, 0),
@@ -178,7 +183,6 @@ class _RouteLogin extends State<MyRouteLogin> {
178 183
                     },
179 184
                   ),
180 185
                   footer: SizedBox(
181
-                    width: 300.w,
182 186
                     child: ElevatedButton(
183 187
                       onPressed: () => {
184 188
                         setState(() {
@@ -186,7 +190,7 @@ class _RouteLogin extends State<MyRouteLogin> {
186 190
                         })
187 191
                       },
188 192
                       child: Text(
189
-                        '$buttonText',
193
+                        '$buttonText+86',
190 194
                         style: TextStyle(
191 195
                           fontSize: 15.sp,
192 196
                         ),

+ 14
- 75
lib/pages/orderInfo/index.dart Wyświetl plik

@@ -5,59 +5,27 @@ import 'package:fluttertoast/fluttertoast.dart';
5 5
 import 'package:get/get.dart';
6 6
 
7 7
 import '../../widgets/OrderInfoCard.dart';
8
+import '../../widgets/layout/BasicPage.dart';
8 9
 
9
-class OrderPageInfo extends StatefulWidget {
10
-  const OrderPageInfo({Key? key}) : super(key: key);
10
+// class OrderPageInfo extends StatefulWidget {
11
+//   const OrderPageInfo({Key? key}) : super(key: key);
12
+//
13
+//   @override
14
+//   State<OrderPageInfo> createState() => _OrderPageInfoState();
15
+// }
11 16
 
17
+class OrderPageInfo extends BasicPage {
12 18
   @override
13
-  State<OrderPageInfo> createState() => _OrderPageInfoState();
14
-}
15 19
 
16
-class _OrderPageInfoState extends State<OrderPageInfo> {
20
+
17 21
   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
-        });
22
+
41 23
   }
42 24
 
43 25
   @override
44
-  Widget build(BuildContext context) {
45
-    return Scaffold(
46
-      resizeToAvoidBottomInset: false,
47
-      appBar: AppBar(
48
-        elevation: 0,
49
-        centerTitle: true,
50
-        backgroundColor: Colors.white,
51
-        title: Text(
52
-          '订单详情',
53
-          style: TextStyle(
54
-              color: Colors.black,
55
-              fontSize: 17.sp,
56
-              letterSpacing: 2,
57
-              fontWeight: FontWeight.bold),
58
-        ),
59
-      ),
60
-      body: Column(
26
+  Widget builder (BuildContext context) {
27
+    naviTitle= '订单详情';
28
+    return  Column(
61 29
         children: [
62 30
           OrderInfoCard(),
63 31
           Spacer(),
@@ -109,37 +77,8 @@ class _OrderPageInfoState extends State<OrderPageInfo> {
109 77
               ],
110 78
             ),
111 79
           ),
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
-          // ),
141 80
         ],
142
-      ),
143 81
     );
82
+
144 83
   }
145 84
 }