[baozhangchao] 3 år sedan
förälder
incheckning
2986398d28

+ 89
- 0
lib/components/UI/DefaultButton.dart Visa fil

@@ -0,0 +1,89 @@
1
+import 'package:flutter/material.dart';
2
+
3
+
4
+
5
+class DefaultButton extends StatefulWidget {
6
+  //点击回调
7
+  final GestureTapCallback onPressed;
8
+  final String text;
9
+  final EdgeInsetsGeometry margin;
10
+  final double width;
11
+  final double height;
12
+  final double? fontSize;
13
+  final Color backColor;
14
+  final Color color;
15
+
16
+  EdgeInsetsGeometry marginDefault =
17
+  const EdgeInsets.fromLTRB(0, 90.0, 0, 30); //按钮默认的margin值
18
+
19
+  DefaultButton({
20
+    Key? key,
21
+    required this.onPressed,
22
+    required this.text,
23
+    required this.margin,
24
+    required this.width,
25
+    required this.height,
26
+    this.fontSize,
27
+    required this.backColor,
28
+    required this.color,
29
+  }) : super(key: key);
30
+
31
+  @override
32
+  State createState() {
33
+    if (margin == null) {
34
+      return _DefaultButtonState(onPressed, text, marginDefault,width,height,fontSize,backColor,color);
35
+    }
36
+    return _DefaultButtonState(onPressed, text, margin,width,height,fontSize,backColor,color);
37
+  }
38
+}
39
+
40
+class _DefaultButtonState extends State<DefaultButton> {
41
+  //点击回调
42
+  final GestureTapCallback onPressed;
43
+  final String text;
44
+  final EdgeInsetsGeometry margin;
45
+  final double width;
46
+  final double height;
47
+  final double? fontSize;
48
+  final Color backColor;
49
+  final Color color;
50
+  _DefaultButtonState(
51
+      this.onPressed,
52
+      this.text,
53
+      this.margin,
54
+      this.width,
55
+      this.height,
56
+      this.fontSize,
57
+      this.backColor,
58
+      this.color
59
+      );
60
+
61
+  @override
62
+  Widget build(BuildContext context) {
63
+    Widget _SectionBtn = Container(
64
+      margin: margin,
65
+      child: SizedBox(
66
+        width: width,
67
+        height: height,
68
+        child: RaisedButton(
69
+          color: backColor,
70
+          disabledColor: const Color(0xF5F6F7ff),
71
+          disabledTextColor: const Color(0xF5F6F7ff),
72
+          colorBrightness: Brightness.dark,
73
+          shape:
74
+          RoundedRectangleBorder(borderRadius: BorderRadius.circular(5.0)),
75
+          child: Text(text,style:  TextStyle(
76
+              fontSize: fontSize,
77
+              color: color,
78
+          ),),
79
+          textColor: Colors.white,
80
+          onPressed: onPressed,
81
+        ),
82
+      ),
83
+    );
84
+
85
+    return _SectionBtn;
86
+  }
87
+
88
+}
89
+

+ 15
- 0
lib/models/User.dart Visa fil

@@ -0,0 +1,15 @@
1
+
2
+import 'package:farmer_client/models/entities/person.dart';
3
+import 'package:get/get.dart';
4
+
5
+class User extends GetxController {
6
+  Person? _person;
7
+  Person? get person => _person;
8
+  set person (Person? p) {
9
+    _person = p;
10
+    update();
11
+  }
12
+
13
+  bool get isLogin => _person != null;
14
+
15
+}

+ 11
- 0
lib/pages/TabBar/Information_page.dart Visa fil

@@ -0,0 +1,11 @@
1
+import 'package:flutter/material.dart';
2
+
3
+class InformationPage extends StatelessWidget {
4
+  @override
5
+  Widget build(BuildContext context) {
6
+    // TODO: implement build
7
+    return Scaffold(
8
+      body: Center(child: Text('资讯')),
9
+    );
10
+  }
11
+}

+ 11
- 0
lib/pages/TabBar/Mine_page.dart Visa fil

@@ -0,0 +1,11 @@
1
+import 'package:flutter/material.dart';
2
+
3
+class MinePage extends StatelessWidget {
4
+  @override
5
+  Widget build(BuildContext context) {
6
+    // TODO: implement build
7
+    return Scaffold(
8
+      body: Center(child: Text('我的')),
9
+    );
10
+  }
11
+}

+ 11
- 0
lib/pages/TabBar/Orders_page.dart Visa fil

@@ -0,0 +1,11 @@
1
+import 'package:flutter/material.dart';
2
+
3
+class OrdersPage extends StatelessWidget {
4
+  @override
5
+  Widget build(BuildContext context) {
6
+    // TODO: implement build
7
+    return Scaffold(
8
+      body: Center(child: Text('订单')),
9
+    );
10
+  }
11
+}

+ 10
- 0
lib/pages/TabBar/home_page.dart Visa fil

@@ -0,0 +1,10 @@
1
+import 'package:flutter/material.dart';
2
+
3
+class HomePage extends StatelessWidget {
4
+  @override
5
+  Widget build(BuildContext context) {
6
+    return Scaffold(
7
+      body: Center(child: Text('首页')),
8
+    );
9
+  }
10
+}

+ 71
- 0
lib/pages/TabBar/index_page.dart Visa fil

@@ -0,0 +1,71 @@
1
+import 'package:flutter/material.dart';
2
+import 'package:flutter/cupertino.dart';
3
+import 'home_page.dart';
4
+import 'Information_page.dart';
5
+import 'Mine_page.dart';
6
+import 'Orders_page.dart';
7
+
8
+class IndexPage extends StatefulWidget {
9
+  _IndexPageState createState() => _IndexPageState();
10
+}
11
+
12
+class _IndexPageState extends State<IndexPage> {
13
+
14
+
15
+  final List<BottomNavigationBarItem> bottomTabs = [
16
+     BottomNavigationBarItem(
17
+      icon: Icon(CupertinoIcons.home),
18
+      title: Text('首页'),
19
+    ),
20
+     BottomNavigationBarItem(
21
+      icon: Icon(CupertinoIcons.search),
22
+      title: Text('资讯'),
23
+
24
+    ),
25
+     BottomNavigationBarItem(
26
+      icon: Icon(CupertinoIcons.shopping_cart),
27
+      title: Text('订单'),
28
+
29
+    ),
30
+     BottomNavigationBarItem(
31
+      icon: Icon(CupertinoIcons.profile_circled),
32
+      title: Text('我的'),
33
+    ),
34
+  ];
35
+
36
+  final List tabBodies = [
37
+    HomePage(),
38
+    InformationPage(),
39
+    OrdersPage(),
40
+    MinePage(),
41
+  ];
42
+
43
+  int currentIndex = 0;
44
+  var currentPage;
45
+
46
+  @override
47
+  void initState() {
48
+    super.initState();
49
+    currentPage = tabBodies[currentIndex];
50
+  }
51
+
52
+  @override
53
+  Widget build(BuildContext context) {
54
+    // TODO: implement build
55
+    return Scaffold(
56
+      backgroundColor: Color.fromRGBO(244, 245, 245, 1),
57
+      bottomNavigationBar: BottomNavigationBar(
58
+        type: BottomNavigationBarType.fixed,
59
+        currentIndex: currentIndex,
60
+        items: bottomTabs,
61
+        onTap: (index){
62
+          setState(() {
63
+            currentIndex = index;
64
+            currentPage = tabBodies[currentIndex];
65
+          });
66
+        },
67
+      ),
68
+      body: currentPage,
69
+    );
70
+  }
71
+}

+ 1
- 0
lib/pages/TabBar/member_page.dart Visa fil

@@ -0,0 +1 @@
1
+// TODO Implement this library.

+ 27
- 31
lib/pages/main/widgets/UserAddress.dart Visa fil

@@ -45,55 +45,51 @@ class UserAddress extends StatelessWidget {
45 45
                 )),
46 46
             Row(
47 47
               mainAxisAlignment: MainAxisAlignment.spaceBetween,
48
-
49 48
               children: [
50 49
                 Container(
51 50
                   child: Row(
52 51
                     mainAxisAlignment: MainAxisAlignment.spaceBetween,
53 52
                     children: [
54
-                      Padding(padding: EdgeInsets.fromLTRB(17.w, 0, 10.w, 0),
55
-                      child:  Image(
56
-                        image: AssetImage('images/gpsImgae.png'),
57
-                        width: 12.w,
58
-                      ),
53
+                      Padding(
54
+                        padding: EdgeInsets.fromLTRB(17.w, 0, 10.w, 0),
55
+                        child: Image(
56
+                          image: AssetImage('images/gpsImgae.png'),
57
+                          width: 12.w,
58
+                        ),
59 59
                       ),
60 60
                       Container(
61 61
                         width: 260,
62
-                        child:  Text('请填写详细地址请填写详细地址请填写详细地址',
63
-                          softWrap: true,
64
-                          maxLines: 1,
65
-                          textAlign: TextAlign.left,
66
-                          overflow: TextOverflow.ellipsis,
67
-                          style: TextStyle(
68
-                            fontWeight: FontWeight.bold,
69
-                            fontSize: 17,
70
-                          ),),
71
-
62
+                        child: GestureDetector(
63
+                          child: Text(
64
+                            '请填写详细地址请填写详细地址请填写详细地址',
65
+                            softWrap: true,
66
+                            maxLines: 1,
67
+                            textAlign: TextAlign.left,
68
+                            overflow: TextOverflow.ellipsis,
69
+                            style: TextStyle(
70
+                              fontWeight: FontWeight.bold,
71
+                              fontSize: 17,
72
+                            ),
73
+                          ),
74
+                          onTap: () {
75
+                            print('修改地址');
76
+                          },
77
+                        ),
72 78
                       )
73
-
74
-
75 79
                     ],
76 80
                   ),
77 81
                 ),
78 82
                 Container(
79 83
                   alignment: Alignment.center,
80 84
                   padding: EdgeInsets.fromLTRB(0, 0, 30.w, 0),
81
-                  child: GestureDetector(
82
-                    child: const Text(
83
-                      '>>',
84
-                      style: TextStyle(
85
-                        fontWeight: FontWeight.bold,
86
-                        fontSize: 17,
87
-                      ),
85
+                  child: Text(
86
+                    '>>',
87
+                    style: TextStyle(
88
+                      fontWeight: FontWeight.bold,
89
+                      fontSize: 17,
88 90
                     ),
89
-                    onTap: () {
90
-                      print('修改个人信息');
91
-                    },
92 91
                   ),
93 92
                 ),
94
-
95
-
96
-
97 93
               ],
98 94
             ),
99 95
           ],