李志伟 3 gadus atpakaļ
vecāks
revīzija
d562cbd0d5

+ 78
- 93
lib/pages/aboutUs/index.dart Parādīt failu

@@ -1,101 +1,86 @@
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 AboutUs extends StatelessWidget {
5
-  const AboutUs({Key? key}) : super(key: key);
6
-
5
+class AboutUs extends BasicPage {
7 6
   @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(
34
-                      image: const AssetImage('images/icons/decorate.png'),
35
-                      width: 16.5.w),
36
-                  Text(
37
-                    '智慧农机的介绍',
38
-                    style: TextStyle(
39
-                        fontSize: 20.sp,
40
-                        fontWeight: FontWeight.bold,
41
-                        color: const Color(0xFF222222)),
42
-                  ),
43
-                  Image(
44
-                      image: const AssetImage('images/icons/decorate.png'),
45
-                      width: 16.5.w),
46
-                ],
47
-              ),
48
-            ),
49
-            Text(
50
-              '        智慧农机旨在通过新一代物联网,大数据,3S等信息化技术有效整合省市县各级涉农资源',
51
-              style: TextStyle(
52
-                  color: Color(0xFF121212),
53
-                  fontSize: 15.sp,
54
-                  letterSpacing: 2,
55
-                  height: 2),
56
-            ),
57
-            Text(
58
-              '        以顶层设计方式建成“一个平台一个中心N个应用”汇聚农业产业。农业“两区”。',
59
-              style: TextStyle(
60
-                  color: Color(0xFF121212),
61
-                  fontSize: 15.sp,
62
-                  letterSpacing: 2,
63
-                  height: 2),
64
-            ),
65
-            Text(
66
-              '        物联网、植保、农机、畜牧、农资、农经,科教等各级农业业务应用及数据,形成大农业”数据中心。',
67
-              style: TextStyle(
68
-                  color: Color(0xFF121212),
69
-                  fontSize: 15.sp,
70
-                  letterSpacing: 2,
71
-                  height: 2),
72
-            ),
73
-            Text(
74
-              '        构建互联共享的“互联网+农业”信息服务体系以最终实现科学指导农业生产经营管理,政府决策监管和社会公众服务。',
75
-              style: TextStyle(
76
-                  color: Color(0xFF121212),
77
-                  fontSize: 15.sp,
78
-                  letterSpacing: 2,
79
-                  height: 2),
80
-            ),
81
-            Text(
82
-              '        智慧农机旨在通过新一代物联网,大数据,3S等信息化技术有效整合省市县各级涉农资源',
83
-              style: TextStyle(
84
-                  color: Color(0xFF121212),
85
-                  fontSize: 15.sp,
86
-                  letterSpacing: 2,
87
-                  height: 2),
88
-            ),
89
-            Text(
90
-              '        以顶层设计方式建成“一个平台一个中心N个应用”汇聚农业产业。农业“两区”。',
91
-              style: TextStyle(
92
-                  color: Color(0xFF121212),
93
-                  fontSize: 15.sp,
94
-                  letterSpacing: 2,
95
-                  height: 2),
7
+  Widget builder(BuildContext context) {
8
+    naviTitle = '关于我们';
9
+    return Container(
10
+      color: const Color(0xFFFFFFFF),
11
+      padding: EdgeInsets.all(15.w),
12
+      child: Column(
13
+        children: [
14
+          Container(
15
+            margin: EdgeInsets.fromLTRB(0, 0, 0, 30.h),
16
+            child: Row(
17
+              mainAxisAlignment: MainAxisAlignment.center,
18
+              children: [
19
+                Image(
20
+                    image: const AssetImage('images/icons/decorate.png'),
21
+                    width: 16.5.w),
22
+                Text(
23
+                  '智慧农机的介绍',
24
+                  style: TextStyle(
25
+                      fontSize: 20.sp,
26
+                      fontWeight: FontWeight.bold,
27
+                      color: const Color(0xFF222222)),
28
+                ),
29
+                Image(
30
+                    image: const AssetImage('images/icons/decorate.png'),
31
+                    width: 16.5.w),
32
+              ],
96 33
             ),
97
-          ],
98
-        ),
34
+          ),
35
+          Text(
36
+            '        智慧农机旨在通过新一代物联网,大数据,3S等信息化技术有效整合省市县各级涉农资源',
37
+            style: TextStyle(
38
+                color: Color(0xFF121212),
39
+                fontSize: 15.sp,
40
+                letterSpacing: 2,
41
+                height: 2),
42
+          ),
43
+          Text(
44
+            '        以顶层设计方式建成“一个平台一个中心N个应用”汇聚农业产业。农业“两区”。',
45
+            style: TextStyle(
46
+                color: Color(0xFF121212),
47
+                fontSize: 15.sp,
48
+                letterSpacing: 2,
49
+                height: 2),
50
+          ),
51
+          Text(
52
+            '        物联网、植保、农机、畜牧、农资、农经,科教等各级农业业务应用及数据,形成大农业”数据中心。',
53
+            style: TextStyle(
54
+                color: Color(0xFF121212),
55
+                fontSize: 15.sp,
56
+                letterSpacing: 2,
57
+                height: 2),
58
+          ),
59
+          Text(
60
+            '        构建互联共享的“互联网+农业”信息服务体系以最终实现科学指导农业生产经营管理,政府决策监管和社会公众服务。',
61
+            style: TextStyle(
62
+                color: Color(0xFF121212),
63
+                fontSize: 15.sp,
64
+                letterSpacing: 2,
65
+                height: 2),
66
+          ),
67
+          Text(
68
+            '        智慧农机旨在通过新一代物联网,大数据,3S等信息化技术有效整合省市县各级涉农资源',
69
+            style: TextStyle(
70
+                color: Color(0xFF121212),
71
+                fontSize: 15.sp,
72
+                letterSpacing: 2,
73
+                height: 2),
74
+          ),
75
+          Text(
76
+            '        以顶层设计方式建成“一个平台一个中心N个应用”汇聚农业产业。农业“两区”。',
77
+            style: TextStyle(
78
+                color: Color(0xFF121212),
79
+                fontSize: 15.sp,
80
+                letterSpacing: 2,
81
+                height: 2),
82
+          ),
83
+        ],
99 84
       ),
100 85
     );
101 86
   }

+ 7
- 128
lib/pages/home/index.dart Parādīt failu

@@ -1,134 +1,13 @@
1
+import 'package:farmer_client/widgets/layout/BasicPage.dart';
1 2
 import 'package:flutter/material.dart';
2
-import 'package:flutter_screenutil/flutter_screenutil.dart';
3
-import 'package:get/get.dart';
4 3
 import './widgets/home/index.dart';
5 4
 
6
-class Home extends StatefulWidget {
7
-  const Home({Key? key}) : super(key: key);
8 5
 
6
+class Home extends BasicPage {
9 7
   @override
10
-  _Home createState() => _Home();
11
-}
12
-
13
-class _Home extends State<Home> {
14
-  //下标   当前tab
15
-  int _tabIndex = 0;
16
-
17
-  final List _titles = ['首页', '订单', '资讯','我的'];
18
-  final tabTextStyleSelected = TextStyle(
19
-      color: const Color(0xFFFF703B),
20
-      fontSize: 15.sp,
21
-      fontWeight: FontWeight.bold); //选线卡选中字体颜色
22
-  final tabTextStyleNormal = TextStyle(
23
-      color: const Color(0xFF323232),
24
-      fontSize: 15.sp,
25
-      fontWeight: FontWeight.bold); //选项卡未选中字体颜色
26
-
27
-  TextStyle getTabTextStyle(int curIndex) {
28
-    //设置tabbar 选中和未选中的状态文本
29
-    if (curIndex == _tabIndex) {
30
-      return tabTextStyleSelected;
31
-    }
32
-    return tabTextStyleNormal;
33
-  }
34
-
35
-  // 切换底部选项卡,标题的变化设置
36
-  Text getTabTitle(int curIndex) {
37
-    return Text(_titles[curIndex], style: getTabTextStyle(curIndex));
38
-  }
39
-
40
-  List images = [
41
-    ['images/index/HomesOFFImgaes.png', 'images/index/HomesNOImgaes.png'],
42
-    ['images/index/OrdersOFFImgaes.png', 'images/index/OrdersNOImgaes.png'],
43
-    ['images/index/newsONImages.png', 'images/index/newsOFFImages.png'],
44
-    ['images/index/MineOFFImgaes.png', 'images/index/MineNOImgaes.png'],
45
-  ];
46
-  Image getTabIcon(int curIndex) {
47
-    //设置tabbar选中和未选中的状态图标
48
-    if (curIndex == _tabIndex) {
49
-      return Image.asset(
50
-        images[curIndex][1],
51
-        width: 22.w,
52
-        height: 22.w,
53
-      );
54
-    }
55
-    return Image.asset(
56
-      images[curIndex][0],
57
-      width: 22.w,
58
-      height: 22.w,
59
-    );
8
+  Widget builder(BuildContext context) {
9
+    handleTabbar = 0;
10
+    naviTitle = '首页';
11
+    return const HomePage();
60 12
   }
61
-
62
-  Image getTabImage(path) {
63
-    return Image.asset(path, width: 22.w, height: 22.w);
64
-  }
65
-
66
-  Widget tabBar(index) {
67
-    return GestureDetector(
68
-      behavior: HitTestBehavior.opaque,
69
-      onTap: () {
70
-        if(index!=_tabIndex){
71
-          if(index==0){
72
-            Get.offNamed('/');
73
-          }else if(index==1){
74
-            Get.offNamed('/order');
75
-          }else if(index==2){
76
-            Get.offNamed('/infomation');
77
-          }else{
78
-            Get.offNamed('/main');
79
-          }
80
-        }
81
-      },
82
-      child: Container(
83
-        width: 93.w,
84
-        height: 65.h,
85
-        child: Column(
86
-          children: [
87
-            getTabIcon(index),
88
-            Padding(
89
-              padding: EdgeInsets.fromLTRB(0, 6.h, 0, 0),
90
-              child: getTabTitle(index),
91
-            )
92
-          ],
93
-        ),
94
-      ),
95
-    );
96
-  }
97
-
98
-  @override
99
-  Widget build(BuildContext context) {
100
-    return Scaffold(
101
-      backgroundColor: Colors.white,
102
-      appBar: AppBar(
103
-        elevation: 0,
104
-        centerTitle: true,
105
-        backgroundColor: Colors.white,
106
-        title: Text(
107
-          '首页',
108
-          style: TextStyle(
109
-              color: Colors.black,
110
-              fontSize: 17.sp,
111
-              letterSpacing: 2,
112
-              fontWeight: FontWeight.bold),
113
-        ),
114
-      ),
115
-      body: HomePage(),
116
-      bottomNavigationBar: Container(
117
-        padding: EdgeInsets.fromLTRB(0, 7.h, 0, 7.h),
118
-        decoration: BoxDecoration(
119
-          color: const Color(0xFFFFFFFF),
120
-          boxShadow: [
121
-            BoxShadow(
122
-              color: const Color(0x14000000),
123
-              offset: Offset(0, -2.w),
124
-              blurRadius: 3.w,
125
-            ),
126
-          ],
127
-        ),
128
-        child: Row(
129
-          children:_titles.asMap().keys.map((index) =>tabBar(index)).toList(),
130
-        ),
131
-      ),
132
-    );
133
-  }
134
-}
13
+}

+ 3
- 8
lib/pages/home/widgets/home/index.dart Parādīt failu

@@ -3,8 +3,6 @@ import 'package:farmer_client/pages/home/widgets/home/widgets/headers.dart';
3 3
 import 'package:flutter/material.dart';
4 4
 import 'package:flutter_screenutil/flutter_screenutil.dart';
5 5
 import 'package:get/get.dart';
6
-import 'package:get/get_core/src/get_main.dart';
7
-import '../../../../models/app.dart';
8 6
 import '../../../../models/entities/CardInfo.dart';
9 7
 import '../../../../services/homeAPI.dart';
10 8
 import '../../../../widgets/CarsCard.dart';
@@ -58,13 +56,10 @@ class _HomePageState extends State<HomePage> {
58 56
     return Container(
59 57
       alignment: Alignment.center,
60 58
       padding: EdgeInsets.fromLTRB(15.w, 0, 15.w, 0),
61
-      child: ListView(
59
+      child: Column(
62 60
         children: [
63
-          Container(
64
-            width: 20.w,
65
-            child: TypeHeader(
66
-              type: true,
67
-            ),
61
+          TypeHeader(
62
+            type: true,
68 63
           ),
69 64
           Container(
70 65
             margin: EdgeInsets.fromLTRB(0, 15, 0, 0),

+ 2
- 2
lib/pages/home/widgets/home/widgets/headers.dart Parādīt failu

@@ -81,9 +81,9 @@ class _initWidget extends StatelessWidget {
81 81
                 borderRadius: BorderRadius.all(Radius.circular(25)),
82 82
               ),
83 83
               child: Row(
84
-                children: const [
84
+                children: [
85 85
                   Padding(
86
-                    padding: EdgeInsets.fromLTRB(5, 0, 5, 0),
86
+                    padding: EdgeInsets.fromLTRB(10.w, 0, 5, 0),
87 87
                     child: Icon(
88 88
                       Icons.search,
89 89
                       size: 19,

+ 6
- 128
lib/pages/infomation/index.dart Parādīt failu

@@ -1,134 +1,12 @@
1 1
 import 'package:farmer_client/pages/infomation/widgets/Information/index.dart';
2
+import 'package:farmer_client/widgets/layout/BasicPage.dart';
2 3
 import 'package:flutter/material.dart';
3
-import 'package:flutter_screenutil/flutter_screenutil.dart';
4
-import 'package:get/get.dart';
5
-
6
-class Infomation extends StatefulWidget {
7
-  const Infomation({Key? key}) : super(key: key);
8
-
9
-  @override
10
-  _Infomation createState() => _Infomation();
11
-}
12
-
13
-class _Infomation extends State<Infomation> {
14
-  //下标   当前tab
15
-  int _tabIndex = 2;
16
-
17
-  final List _titles = ['首页', '订单', '资讯','我的'];
18
-  final tabTextStyleSelected = TextStyle(
19
-      color: const Color(0xFFFF703B),
20
-      fontSize: 15.sp,
21
-      fontWeight: FontWeight.bold); //选线卡选中字体颜色
22
-  final tabTextStyleNormal = TextStyle(
23
-      color: const Color(0xFF323232),
24
-      fontSize: 15.sp,
25
-      fontWeight: FontWeight.bold); //选项卡未选中字体颜色
26
-
27
-  TextStyle getTabTextStyle(int curIndex) {
28
-    //设置tabbar 选中和未选中的状态文本
29
-    if (curIndex == _tabIndex) {
30
-      return tabTextStyleSelected;
31
-    }
32
-    return tabTextStyleNormal;
33
-  }
34
-
35
-  // 切换底部选项卡,标题的变化设置
36
-  Text getTabTitle(int curIndex) {
37
-    return Text(_titles[curIndex], style: getTabTextStyle(curIndex));
38
-  }
39
-
40
-  List images = [
41
-    ['images/index/HomesOFFImgaes.png', 'images/index/HomesNOImgaes.png'],
42
-    ['images/index/OrdersOFFImgaes.png', 'images/index/OrdersNOImgaes.png'],
43
-    ['images/index/newsONImages.png', 'images/index/newsOFFImages.png'],
44
-    ['images/index/MineOFFImgaes.png', 'images/index/MineNOImgaes.png'],
45
-  ];
46
-  Image getTabIcon(int curIndex) {
47
-    //设置tabbar选中和未选中的状态图标
48
-    if (curIndex == _tabIndex) {
49
-      return Image.asset(
50
-        images[curIndex][1],
51
-        width: 22.w,
52
-        height: 22.w,
53
-      );
54
-    }
55
-    return Image.asset(
56
-      images[curIndex][0],
57
-      width: 22.w,
58
-      height: 22.w,
59
-    );
60
-  }
61
-
62
-  Image getTabImage(path) {
63
-    return Image.asset(path, width: 22.w, height: 22.w);
64
-  }
65
-
66
-  Widget tabBar(index) {
67
-    return GestureDetector(
68
-      behavior: HitTestBehavior.opaque,
69
-      onTap: () {
70
-        if(index!=_tabIndex){
71
-          if(index==0){
72
-            Get.offNamed('/');
73
-          }else if(index==1){
74
-            Get.offNamed('/order');
75
-          }else if(index==2){
76
-            Get.offNamed('/infomation');
77
-          }else{
78
-            Get.offNamed('/main');
79
-          }
80
-        }
81
-      },
82
-      child: Container(
83
-        width: 93.w,
84
-        height: 65.h,
85
-        child: Column(
86
-          children: [
87
-            getTabIcon(index),
88
-            Padding(
89
-              padding: EdgeInsets.fromLTRB(0, 6.h, 0, 0),
90
-              child: getTabTitle(index),
91
-            )
92
-          ],
93
-        ),
94
-      ),
95
-    );
96
-  }
97 4
 
5
+class Infomation extends BasicPage {
98 6
   @override
99
-  Widget build(BuildContext context) {
100
-    return Scaffold(
101
-      backgroundColor: Colors.white,
102
-      appBar: AppBar(
103
-        elevation: 0,
104
-        centerTitle: true,
105
-        backgroundColor: Colors.white,
106
-        title: Text(
107
-          '资讯',
108
-          style: TextStyle(
109
-              color: Colors.black,
110
-              fontSize: 17.sp,
111
-              letterSpacing: 2,
112
-              fontWeight: FontWeight.bold),
113
-        ),
114
-      ),
115
-      body: Information(),
116
-      bottomNavigationBar: Container(
117
-        padding: EdgeInsets.fromLTRB(0, 7.h, 0, 7.h),
118
-        decoration: BoxDecoration(
119
-          color: const Color(0xFFFFFFFF),
120
-          boxShadow: [
121
-            BoxShadow(
122
-              color: const Color(0x14000000),
123
-              offset: Offset(0, -2.w),
124
-              blurRadius: 3.w,
125
-            ),
126
-          ],
127
-        ),
128
-        child: Row(
129
-          children:_titles.asMap().keys.map((index) =>tabBar(index)).toList(),
130
-        ),
131
-      ),
132
-    );
7
+  Widget builder(BuildContext context) {
8
+    handleTabbar = 2;
9
+    naviTitle = '咨讯';
10
+    return  Information();
133 11
   }
134 12
 }

+ 1
- 3
lib/pages/infomation/widgets/Information/index.dart Parādīt failu

@@ -15,14 +15,13 @@ class Information extends StatefulWidget {
15 15
 class _InformationState extends State<Information> {
16 16
   @override
17 17
   Widget build(BuildContext context) {
18
-    return ListView(
18
+    return Column(
19 19
       children: [
20 20
         // ListTile用不好
21 21
 
22 22
         GestureDetector(
23 23
           child: Container(
24 24
               padding: EdgeInsets.fromLTRB(0, 30, 0, 30),
25
-              width: 310.w,
26 25
               decoration: const BoxDecoration(
27 26
                   border: Border(
28 27
                       bottom: BorderSide(width: 0.5, color: Color(0x20000000)
@@ -72,7 +71,6 @@ class _InformationState extends State<Information> {
72 71
         GestureDetector(
73 72
           child: Container(
74 73
               padding: EdgeInsets.fromLTRB(0, 30, 0, 30),
75
-              width: 310.w,
76 74
               decoration: const BoxDecoration(
77 75
                   border: Border(
78 76
                       bottom: BorderSide(width: 0.5, color: Color(0x20000000)

+ 6
- 128
lib/pages/main/index.dart Parādīt failu

@@ -1,134 +1,12 @@
1 1
 import 'package:farmer_client/pages/main/widgets/main/index.dart';
2
+import 'package:farmer_client/widgets/layout/BasicPage.dart';
2 3
 import 'package:flutter/material.dart';
3
-import 'package:flutter_screenutil/flutter_screenutil.dart';
4
-import 'package:get/get.dart';
5
-
6
-class Main extends StatefulWidget {
7
-  const Main({Key? key}) : super(key: key);
8
-
9
-  @override
10
-  _Main createState() => _Main();
11
-}
12
-
13
-class _Main extends State<Main> {
14
-  //下标   当前tab
15
-  int _tabIndex = 3;
16
-
17
-  final List _titles = ['首页', '订单', '资讯','我的'];
18
-  final tabTextStyleSelected = TextStyle(
19
-      color: const Color(0xFFFF703B),
20
-      fontSize: 15.sp,
21
-      fontWeight: FontWeight.bold); //选线卡选中字体颜色
22
-  final tabTextStyleNormal = TextStyle(
23
-      color: const Color(0xFF323232),
24
-      fontSize: 15.sp,
25
-      fontWeight: FontWeight.bold); //选项卡未选中字体颜色
26
-
27
-  TextStyle getTabTextStyle(int curIndex) {
28
-    //设置tabbar 选中和未选中的状态文本
29
-    if (curIndex == _tabIndex) {
30
-      return tabTextStyleSelected;
31
-    }
32
-    return tabTextStyleNormal;
33
-  }
34
-
35
-  // 切换底部选项卡,标题的变化设置
36
-  Text getTabTitle(int curIndex) {
37
-    return Text(_titles[curIndex], style: getTabTextStyle(curIndex));
38
-  }
39
-
40
-  List images = [
41
-    ['images/index/HomesOFFImgaes.png', 'images/index/HomesNOImgaes.png'],
42
-    ['images/index/OrdersOFFImgaes.png', 'images/index/OrdersNOImgaes.png'],
43
-    ['images/index/newsONImages.png', 'images/index/newsOFFImages.png'],
44
-    ['images/index/MineOFFImgaes.png', 'images/index/MineNOImgaes.png'],
45
-  ];
46
-  Image getTabIcon(int curIndex) {
47
-    //设置tabbar选中和未选中的状态图标
48
-    if (curIndex == _tabIndex) {
49
-      return Image.asset(
50
-        images[curIndex][1],
51
-        width: 22.w,
52
-        height: 22.w,
53
-      );
54
-    }
55
-    return Image.asset(
56
-      images[curIndex][0],
57
-      width: 22.w,
58
-      height: 22.w,
59
-    );
60
-  }
61
-
62
-  Image getTabImage(path) {
63
-    return Image.asset(path, width: 22.w, height: 22.w);
64
-  }
65
-
66
-  Widget tabBar(index) {
67
-    return GestureDetector(
68
-      behavior: HitTestBehavior.opaque,
69
-      onTap: () {
70
-        if(index!=_tabIndex){
71
-          if(index==0){
72
-            Get.offNamed('/');
73
-          }else if(index==1){
74
-            Get.offNamed('/order');
75
-          }else if(index==2){
76
-            Get.offNamed('/infomation');
77
-          }else{
78
-            Get.offNamed('/main');
79
-          }
80
-        }
81
-      },
82
-      child: Container(
83
-        width: 93.w,
84
-        height: 65.h,
85
-        child: Column(
86
-          children: [
87
-            getTabIcon(index),
88
-            Padding(
89
-              padding: EdgeInsets.fromLTRB(0, 6.h, 0, 0),
90
-              child: getTabTitle(index),
91
-            )
92
-          ],
93
-        ),
94
-      ),
95
-    );
96
-  }
97 4
 
5
+class Main extends BasicPage {
98 6
   @override
99
-  Widget build(BuildContext context) {
100
-    return Scaffold(
101
-      backgroundColor: Colors.white,
102
-      appBar: AppBar(
103
-        elevation: 0,
104
-        centerTitle: true,
105
-        backgroundColor: Colors.white,
106
-        title: Text(
107
-          '我的',
108
-          style: TextStyle(
109
-              color: Colors.black,
110
-              fontSize: 17.sp,
111
-              letterSpacing: 2,
112
-              fontWeight: FontWeight.bold),
113
-        ),
114
-      ),
115
-      body: MainPage(),
116
-      bottomNavigationBar: Container(
117
-        padding: EdgeInsets.fromLTRB(0, 7.h, 0, 7.h),
118
-        decoration: BoxDecoration(
119
-          color: const Color(0xFFFFFFFF),
120
-          boxShadow: [
121
-            BoxShadow(
122
-              color: const Color(0x14000000),
123
-              offset: Offset(0, -2.w),
124
-              blurRadius: 3.w,
125
-            ),
126
-          ],
127
-        ),
128
-        child: Row(
129
-          children:_titles.asMap().keys.map((index) =>tabBar(index)).toList(),
130
-        ),
131
-      ),
132
-    );
7
+  Widget builder(BuildContext context) {
8
+    handleTabbar = 3;
9
+    naviTitle = '我的';
10
+    return const MainPage();
133 11
   }
134 12
 }

+ 1
- 1
lib/pages/main/widgets/main/index.dart Parādīt failu

@@ -20,7 +20,7 @@ class _MainPageState extends State<MainPage> {
20 20
   Widget build(BuildContext context) {
21 21
     return Container(
22 22
       alignment: Alignment.center,
23
-      child: ListView(
23
+      child: Column(
24 24
         children: [
25 25
           Column(
26 26
             children: [

+ 6
- 127
lib/pages/order/index.dart Parādīt failu

@@ -1,134 +1,13 @@
1
+import 'package:farmer_client/widgets/layout/BasicPage.dart';
1 2
 import 'package:flutter/material.dart';
2
-import 'package:flutter_screenutil/flutter_screenutil.dart';
3
-import 'package:get/get.dart';
4 3
 import './widgets/order/index.dart';
5 4
 
6
-class Order extends StatefulWidget {
7
-  const Order({Key? key}) : super(key: key);
8 5
 
6
+class Order extends BasicPage {
9 7
   @override
10
-  _Order createState() => _Order();
11
-}
12
-
13
-class _Order extends State<Order> {
14
-  //下标   当前tab
15
-  final int _tabIndex = 1;
16
-
17
-  final List _titles = ['首页', '订单', '资讯','我的'];
18
-  final tabTextStyleSelected = TextStyle(
19
-      color: const Color(0xFFFF703B),
20
-      fontSize: 15.sp,
21
-      fontWeight: FontWeight.bold); //选线卡选中字体颜色
22
-  final tabTextStyleNormal = TextStyle(
23
-      color: const Color(0xFF323232),
24
-      fontSize: 15.sp,
25
-      fontWeight: FontWeight.bold); //选项卡未选中字体颜色
26
-
27
-  TextStyle getTabTextStyle(int curIndex) {
28
-    //设置tabbar 选中和未选中的状态文本
29
-    if (curIndex == _tabIndex) {
30
-      return tabTextStyleSelected;
31
-    }
32
-    return tabTextStyleNormal;
33
-  }
34
-
35
-  // 切换底部选项卡,标题的变化设置
36
-  Text getTabTitle(int curIndex) {
37
-    return Text(_titles[curIndex], style: getTabTextStyle(curIndex));
38
-  }
39
-
40
-  List images = [
41
-    ['images/index/HomesOFFImgaes.png', 'images/index/HomesNOImgaes.png'],
42
-    ['images/index/OrdersOFFImgaes.png', 'images/index/OrdersNOImgaes.png'],
43
-    ['images/index/newsONImages.png', 'images/index/newsOFFImages.png'],
44
-    ['images/index/MineOFFImgaes.png', 'images/index/MineNOImgaes.png'],
45
-  ];
46
-  Image getTabIcon(int curIndex) {
47
-    //设置tabbar选中和未选中的状态图标
48
-    if (curIndex == _tabIndex) {
49
-      return Image.asset(
50
-        images[curIndex][1],
51
-        width: 22.w,
52
-        height: 22.w,
53
-      );
54
-    }
55
-    return Image.asset(
56
-      images[curIndex][0],
57
-      width: 22.w,
58
-      height: 22.w,
59
-    );
60
-  }
61
-
62
-  Image getTabImage(path) {
63
-    return Image.asset(path, width: 22.w, height: 22.w);
64
-  }
65
-
66
-  Widget tabBar(index) {
67
-    return GestureDetector(
68
-      behavior: HitTestBehavior.opaque,
69
-      onTap: () {
70
-        if(index!=_tabIndex){
71
-          if(index==0){
72
-            Get.offNamed('/');
73
-          }else if(index==1){
74
-            Get.offNamed('/order');
75
-          }else if(index==2){
76
-            Get.offNamed('/infomation');
77
-          }else{
78
-            Get.offNamed('/main');
79
-          }
80
-        }
81
-      },
82
-      child: Container(
83
-        width: 93.w,
84
-        height: 65.h,
85
-        child: Column(
86
-          children: [
87
-            getTabIcon(index),
88
-            Padding(
89
-              padding: EdgeInsets.fromLTRB(0, 6.h, 0, 0),
90
-              child: getTabTitle(index),
91
-            )
92
-          ],
93
-        ),
94
-      ),
95
-    );
96
-  }
97
-
98
-  @override
99
-  Widget build(BuildContext context) {
100
-    return Scaffold(
101
-      backgroundColor: Colors.white,
102
-      appBar: AppBar(
103
-        elevation: 0,
104
-        centerTitle: true,
105
-        backgroundColor: Colors.white,
106
-        title: Text(
107
-          '订单',
108
-          style: TextStyle(
109
-              color: Colors.black,
110
-              fontSize: 17.sp,
111
-              letterSpacing: 2,
112
-              fontWeight: FontWeight.bold),
113
-        ),
114
-      ),
115
-      body: OrderPage(),
116
-      bottomNavigationBar: Container(
117
-        padding: EdgeInsets.fromLTRB(0, 7.h, 0, 7.h),
118
-        decoration: BoxDecoration(
119
-          color: const Color(0xFFFFFFFF),
120
-          boxShadow: [
121
-            BoxShadow(
122
-              color: const Color(0x14000000),
123
-              offset: Offset(0, -2.w),
124
-              blurRadius: 3.w,
125
-            ),
126
-          ],
127
-        ),
128
-        child: Row(
129
-          children:_titles.asMap().keys.map((index) =>tabBar(index)).toList(),
130
-        ),
131
-      ),
132
-    );
8
+  Widget builder(BuildContext context) {
9
+    handleTabbar = 1;
10
+    naviTitle = '订单';
11
+    return const OrderPage();
133 12
   }
134 13
 }

+ 1
- 1
lib/pages/order/widgets/order/index.dart Parādīt failu

@@ -32,7 +32,7 @@ class _OrderPageState extends State<OrderPage> {
32 32
 
33 33
   @override
34 34
   Widget build(BuildContext context) {
35
-    return ListView(
35
+    return Column(
36 36
       children: [
37 37
         Container(
38 38
           padding: EdgeInsets.fromLTRB(15, 0, 15, 0),

+ 113
- 0
lib/widgets/layout/BasicPage.dart Parādīt failu

@@ -1,14 +1,22 @@
1 1
 
2 2
 import 'package:flutter/material.dart';
3
+import 'package:flutter_screenutil/flutter_screenutil.dart';
3 4
 import 'package:get/get.dart';
4 5
 
5 6
 abstract class BasicPage extends StatefulWidget {
6 7
   // 导航标题
7 8
   // 用法 naviTitle = xxxx
8 9
   final _title = Rx<String>("");
10
+  final isTabBar = Rx<bool>(false);
11
+  final tabIndex =Rx<int>(0);
12
+
9 13
   set naviTitle(String t) {
10 14
     _title.value = t;
11 15
   }
16
+  set handleTabbar(int index) {
17
+    tabIndex.value=index;
18
+    isTabBar.value = true;
19
+  }
12 20
 
13 21
   // 允许滚动 - 不是响应式的
14 22
   bool canScroll;
@@ -91,6 +99,110 @@ class _BasicPageState extends State<BasicPage> {
91 99
     }
92 100
   }
93 101
 
102
+
103
+
104
+  final List _titles = ['首页', '订单', '资讯','我的'];
105
+  final tabTextStyleSelected = TextStyle(
106
+      color: const Color(0xFFFF703B),
107
+      fontSize: 15.sp,
108
+      fontWeight: FontWeight.bold); //选线卡选中字体颜色
109
+  final tabTextStyleNormal = TextStyle(
110
+      color: const Color(0xFF323232),
111
+      fontSize: 15.sp,
112
+      fontWeight: FontWeight.bold); //选项卡未选中字体颜色
113
+
114
+  TextStyle getTabTextStyle(int curIndex) {
115
+    //设置tabbar 选中和未选中的状态文本
116
+    if (curIndex == widget.tabIndex.value) {
117
+      return tabTextStyleSelected;
118
+    }
119
+    return tabTextStyleNormal;
120
+  }
121
+
122
+  // 切换底部选项卡,标题的变化设置
123
+  Text getTabTitle(int curIndex) {
124
+    return Text(_titles[curIndex], style: getTabTextStyle(curIndex));
125
+  }
126
+
127
+  List images = [
128
+    ['images/index/HomesOFFImgaes.png', 'images/index/HomesNOImgaes.png'],
129
+    ['images/index/OrdersOFFImgaes.png', 'images/index/OrdersNOImgaes.png'],
130
+    ['images/index/newsONImages.png', 'images/index/newsOFFImages.png'],
131
+    ['images/index/MineOFFImgaes.png', 'images/index/MineNOImgaes.png'],
132
+  ];
133
+  Image getTabIcon(int curIndex) {
134
+    //设置tabbar选中和未选中的状态图标
135
+    if (curIndex == widget.tabIndex.value) {
136
+      return Image.asset(
137
+        images[curIndex][1],
138
+        width: 22.w,
139
+        height: 22.w,
140
+      );
141
+    }
142
+    return Image.asset(
143
+      images[curIndex][0],
144
+      width: 22.w,
145
+      height: 22.w,
146
+    );
147
+  }
148
+
149
+  Image getTabImage(path) {
150
+    return Image.asset(path, width: 22.w, height: 22.w);
151
+  }
152
+
153
+  Widget tabBar(index) {
154
+    return GestureDetector(
155
+      behavior: HitTestBehavior.opaque,
156
+      onTap: () {
157
+        if(index!=widget.tabIndex.value){
158
+          if(index==0){
159
+            Get.offNamed('/');
160
+          }else if(index==1){
161
+            Get.offNamed('/order');
162
+          }else if(index==2){
163
+            Get.offNamed('/infomation');
164
+          }else{
165
+            Get.offNamed('/main');
166
+          }
167
+        }
168
+      },
169
+      child: Container(
170
+        width: 93.w,
171
+        height: 65.h,
172
+        child: Column(
173
+          children: [
174
+            getTabIcon(index),
175
+            Padding(
176
+              padding: EdgeInsets.fromLTRB(0, 6.h, 0, 0),
177
+              child: getTabTitle(index),
178
+            )
179
+          ],
180
+        ),
181
+      ),
182
+    );
183
+  }
184
+  Widget? _bottomBar(){
185
+    if(widget.isTabBar.value) {
186
+      return Container(
187
+      padding: EdgeInsets.fromLTRB(0, 7.h, 0, 7.h),
188
+      decoration: BoxDecoration(
189
+        color: const Color(0xFFFFFFFF),
190
+        boxShadow: [
191
+          BoxShadow(
192
+            color: const Color(0x14000000),
193
+            offset: Offset(0, -2.w),
194
+            blurRadius: 3.w,
195
+          ),
196
+        ],
197
+      ),
198
+      child: Row(
199
+        children:_titles.asMap().keys.map((index) =>tabBar(index)).toList(),
200
+      ),
201
+    );
202
+    } else {
203
+      return null;
204
+    }
205
+  }
94 206
   @override
95 207
   Widget build(BuildContext context) {
96 208
     return Scaffold(
@@ -98,6 +210,7 @@ class _BasicPageState extends State<BasicPage> {
98 210
       body: SafeArea(
99 211
         child: _buildChild(context),
100 212
       ),
213
+      bottomNavigationBar: _bottomBar(),
101 214
     );
102 215
   }
103 216
 }