my_page.dart
4.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:one_key/provider/update_model.dart';
import 'package:one_key/provider/user_model.dart';
import 'package:one_key/res/colors.dart';
import 'package:one_key/utils/utils.dart';
import 'package:one_key/widgets/MyDivider.dart';
import 'package:one_key/widgets/app_bar.dart';
import 'package:one_key/widgets/h_empty_view.dart';
import 'package:one_key/widgets/my_item.dart';
import 'package:one_key/widgets/v_empty_view.dart';
import 'package:provider/provider.dart';
class MyPage extends StatefulWidget{
@override
State<StatefulWidget> createState() {
// TODO: implement createState
return new MyPageState();
}
}
class MyPageState extends State<MyPage>{
String cur_version="";
@override
void initState() {
// TODO: implement initState
super.initState();
Utils.getCurrVersion().then((version){
setState(() {
cur_version="v"+version;
});
});
}
//检查版本更新
checkUpdate(){
UpdateModel updateModel=new UpdateModel();
updateModel.checkUpdate(context);
}
@override
Widget build(BuildContext context) {
// TODO: implement build
return Container(
width: double.infinity,
height: double.infinity,
color: MyColours.color_f5f5f5,
child: Column(
children: <Widget>[
MyAppBar("我的",showBack: false,backgroundColor: MyColours.color_2bb5b7,fontColor: MyColours.color_fefefe,),
Container(
width: double.infinity,
height: ScreenUtil().setHeight(242),
alignment: Alignment.centerLeft,
padding: EdgeInsets.only(left: ScreenUtil().setWidth(40)),
color: MyColours.color_2bb5b7,
child: Consumer<UserModel>(builder: (BuildContext context,UserModel model,Widget child){
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
VEmptyView(38),
Text(model.user.sellername,style: TextStyle(color: MyColours.color_ffffff,fontSize: ScreenUtil().setSp(36)),),
VEmptyView(38),
Text(model.user.account+" | "+model.user.role_name,style: TextStyle(color: MyColours.color_ffffff,fontSize: ScreenUtil().setSp(30)),),
],
);
},)
),
VEmptyView(44),
MyItem(title:"联系客服",content:"09:00~21:00",callback: (){
Utils.goPhone("400-000-9690");
},),
MyDivider(double.infinity,ScreenUtil().setHeight(1),color: MyColours.color_f3f3f3,),
MyItem(title:"帮助与反馈",content:"",callback: (){
Utils.goHelp();
},),
MyDivider(double.infinity,ScreenUtil().setHeight(1),color: MyColours.color_f3f3f3),
GestureDetector(
onTap: checkUpdate,
child: Container(
width: double.infinity,
height: ScreenUtil().setHeight(122),
color: MyColours.color_ffffff,
padding: EdgeInsets.symmetric(horizontal: ScreenUtil().setWidth(40)),
alignment: Alignment.center,
child: Row(
children: <Widget>[
Text("版本更新",style: TextStyle(fontSize: ScreenUtil().setSp(30),color: MyColours.color_353535),),
Spacer(),
Text(cur_version,style: TextStyle(fontSize: ScreenUtil().setSp(28),color: MyColours.color_666666),),
HEmptyView(20),
Image.asset("assets/arr_right_gray.png",width: ScreenUtil().setWidth(14),height: ScreenUtil().setWidth(22),)
],
),
),
),
MyDivider(double.infinity,ScreenUtil().setHeight(1),color: MyColours.color_f3f3f3,),
VEmptyView(40),
Consumer<UserModel>(builder: (BuildContext context,UserModel model,Widget child){
return GestureDetector(
onTap: (){
model.showLoginOutDialog(context);
},
child: Container(
height: ScreenUtil().setHeight(122),
color: MyColours.color_ffffff,
child: Center(
child: Row(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
Image.asset("assets/icon_exist.png",width: ScreenUtil().setWidth(30),height: ScreenUtil().setWidth(30),),
HEmptyView(18),
Text("退出登录",style: TextStyle(color: MyColours.color_2bb5b7,fontSize: ScreenUtil().setSp(34),))
],
),
),
),
);
},)
],
),
);
}
}