/
shop_page.dart
executable file
·206 lines (196 loc) · 7.53 KB
/
shop_page.dart
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
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
import 'package:flutter/material.dart';
import 'package:flutter_deer/account/account_router.dart';
import 'package:flutter_deer/mvp/base_page_state.dart';
import 'package:flutter_deer/res/resources.dart';
import 'package:flutter_deer/routers/fluro_navigator.dart';
import 'package:flutter_deer/setting/setting_router.dart';
import 'package:flutter_deer/shop/shop_router.dart';
import 'package:flutter_deer/util/image_utils.dart';
import 'package:flutter_deer/widgets/load_image.dart';
import 'package:provider/provider.dart';
import 'models/user_entity.dart';
import 'presenter/shop_presenter.dart';
import 'provider/user_provider.dart';
class Shop extends StatefulWidget {
@override
ShopState createState() => ShopState();
}
class ShopState extends BasePageState<Shop, ShopPagePresenter> with AutomaticKeepAliveClientMixin<Shop>{
var menuTitle = ["账户流水", "资金管理", "提现账号"];
var menuImage = ["zhls", "zjgl", "txzh"];
UserProvider provider = UserProvider();
void setUser(UserEntity user){
provider.setUser(user);
}
@override
Widget build(BuildContext context) {
super.build(context);
return ChangeNotifierProvider<UserProvider>(
builder: (_) => provider,
child: Scaffold(
appBar: AppBar(
brightness: Brightness.light,
elevation: 0.0,
backgroundColor: Colors.white,
actions: <Widget>[
IconButton(
onPressed: (){
NavigatorUtils.push(context, ShopRouter.messagePage);
},
icon: const LoadAssetImage(
"shop/message",
width: 24.0,
height: 24.0,
),
),
IconButton(
onPressed: (){
NavigatorUtils.push(context, SettingRouter.settingPage);
},
icon: const LoadAssetImage(
"shop/setting",
width: 24.0,
height: 24.0,
),
)
],
),
body: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Gaps.vGap12,
Consumer<UserProvider>(
builder: (_, provider, __) {
return Padding(
padding: const EdgeInsets.symmetric(horizontal: 16.0),
child: Stack(
children: <Widget>[
const SizedBox(width: double.infinity, height: 56.0),
const Text(
"官方直营店",
style: TextStyles.textBoldDark24,
),
Positioned(
right: 0.0,
child: CircleAvatar(
radius: 28.0,
backgroundColor: Colors.transparent,
backgroundImage: ImageUtils.getImageProvider(provider.user?.avatarUrl, holderImg: 'shop/tx')
)
),
Positioned(
top: 38.0,
left: 0.0,
child: Row(
children: <Widget>[
const LoadAssetImage("shop/zybq", width: 40.0, height: 16.0,),
Gaps.hGap8,
const Text("店铺账号:15000000000", style: TextStyles.textDark12)
],
),
),
],
),
);
},
),
Gaps.vGap12,
Gaps.vGap12,
Container(height: 0.6, width: double.infinity, color: Colours.line, margin: const EdgeInsets.only(left: 16.0)),
Gaps.vGap12,
Gaps.vGap12,
const Padding(
padding: const EdgeInsets.symmetric(horizontal: 16.0),
child: const Text(
"账户",
style: TextStyles.textBoldDark18,
),
),
Flexible(
child: GridView.builder(
shrinkWrap: true,
padding: const EdgeInsets.fromLTRB(8.0, 0, 8.0, 12.0),
physics: NeverScrollableScrollPhysics(),
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: 4,
childAspectRatio: 1.18
),
itemCount: menuTitle.length,
itemBuilder: (_, index){
return InkWell(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
LoadAssetImage("shop/${menuImage[index]}", width: 32.0),
Gaps.vGap4,
Text(
menuTitle[index],
style: TextStyles.textDark12,
)
],
),
onTap: (){
if (index == 0){
NavigatorUtils.push(context, AccountRouter.accountRecordListPage);
}else if (index == 1){
NavigatorUtils.push(context, AccountRouter.accountPage);
}else if (index == 2){
NavigatorUtils.push(context, AccountRouter.withdrawalAccountPage);
}
},
);
},
),
),
Container(height: 0.6, width: double.infinity, color: Colours.line, margin: const EdgeInsets.only(left: 16.0)),
Gaps.vGap12,
Gaps.vGap12,
const Padding(
padding: const EdgeInsets.symmetric(horizontal: 16.0),
child: const Text(
"店铺",
style: TextStyles.textBoldDark18,
),
),
Flexible(
child: GridView.builder(
shrinkWrap: true,
padding: const EdgeInsets.fromLTRB(8.0, 0, 8.0, 12.0),
physics: NeverScrollableScrollPhysics(),
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: 4,
childAspectRatio: 1.18
),
itemCount: 1,
itemBuilder: (_, index){
return InkWell(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
const LoadAssetImage("shop/dpsz", width: 32.0),
Gaps.vGap4,
const Text(
"店铺设置",
style: TextStyles.textDark12,
)
],
),
onTap: (){
NavigatorUtils.push(context, ShopRouter.shopSettingPage);
},
);
},
),
),
],
)
),
);
}
@override
bool get wantKeepAlive => true;
@override
ShopPagePresenter createPresenter() {
return ShopPagePresenter();
}
}