store_audit_page.dart
5.94 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
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
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:one_poem/res/resources.dart';
import 'package:one_poem/routers/fluro_navigator.dart';
import 'package:one_poem/util/other_utils.dart';
import 'package:one_poem/util/theme_utils.dart';
import 'package:one_poem/widgets/my_app_bar.dart';
import 'package:one_poem/widgets/my_button.dart';
import 'package:one_poem/widgets/my_scroll_view.dart';
import 'package:one_poem/widgets/selected_image.dart';
import 'package:one_poem/widgets/selected_item.dart';
import 'package:one_poem/widgets/text_field_item.dart';
import 'package:image_picker/image_picker.dart';
import 'package:keyboard_actions/keyboard_actions.dart';
import '../store_router.dart';
/// design/2店铺审核/index.html
class StoreAuditPage extends StatefulWidget {
const StoreAuditPage({Key? key}) : super(key: key);
@override
_StoreAuditPageState createState() => _StoreAuditPageState();
}
class _StoreAuditPageState extends State<StoreAuditPage> {
final GlobalKey<SelectedImageState> _imageGlobalKey = GlobalKey<SelectedImageState>();
final FocusNode _nodeText1 = FocusNode();
final FocusNode _nodeText2 = FocusNode();
final FocusNode _nodeText3 = FocusNode();
final ImagePicker picker = ImagePicker();
final String _address = '陕西省 西安市 雁塔区 高新六路201号';
KeyboardActionsConfig _buildConfig(BuildContext context) {
return KeyboardActionsConfig(
keyboardActionsPlatform: KeyboardActionsPlatform.IOS,
keyboardBarColor: ThemeUtils.getKeyboardActionsColor(context),
actions: [
KeyboardActionsItem(
focusNode: _nodeText1,
displayDoneButton: false,
),
KeyboardActionsItem(
focusNode: _nodeText2,
displayDoneButton: false,
),
KeyboardActionsItem(
focusNode: _nodeText3,
toolbarButtons: [
(node) {
return GestureDetector(
onTap: () => node.unfocus(),
child: Padding(
padding: const EdgeInsets.only(right: 16.0),
child: Text(Utils.getCurrLocale() == 'zh' ? '关闭' : 'Close'),
),
);
},
],
),
],
);
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: const MyAppBar(
centerTitle: '店铺审核资料',
),
body: MyScrollView(
padding: const EdgeInsets.symmetric(vertical: 16.0),
keyboardConfig: _buildConfig(context),
tapOutsideToDismiss: true,
bottomButton: Padding(
padding: const EdgeInsets.only(left: 16.0, right: 16.0, bottom: 8.0),
child: MyButton(
onPressed: () {
debugPrint('文件路径:${_imageGlobalKey.currentState?.pickedFile?.path}');
NavigatorUtils.push(context, StoreRouter.auditResultPage);
},
text: '提交',
),
),
children: _buildBody(),
),
/// 同时存在底部按钮与keyboardConfig配置时,为保证Android与iOS平台软键盘弹出高度正常,添加下面的代码。
resizeToAvoidBottomInset: defaultTargetPlatform != TargetPlatform.iOS,
);
}
List<Widget> _buildBody() {
return [
Gaps.vGap5,
const Padding(
padding: EdgeInsets.only(left: 16.0),
child: Text('店铺资料', style: TextStyles.textBold18),
),
Gaps.vGap16,
Center(
child: SelectedImage(
key: _imageGlobalKey,
),
),
Gaps.vGap10,
Center(
child: Text(
'店主手持身份证或营业执照',
style: Theme.of(context).textTheme.subtitle2?.copyWith(fontSize: Dimens.font_sp14),
),
),
Gaps.vGap16,
TextFieldItem(
focusNode: _nodeText1,
title: '店铺名称',
hintText: '填写店铺名称'
),
SelectedItem(
title: '主营范围',
content: _sortName,
onTap: () => _showBottomSheet()
),
SelectedItem(
title: '店铺地址',
content: _address,
onTap: () {
}
),
Gaps.vGap32,
const Padding(
padding:EdgeInsets.only(left: 16.0),
child: Text('店主信息', style: TextStyles.textBold18),
),
Gaps.vGap16,
TextFieldItem(
focusNode: _nodeText2,
title: '店主姓名',
hintText: '填写店主姓名'
),
TextFieldItem(
focusNode: _nodeText3,
keyboardType: TextInputType.phone,
title: '联系电话',
hintText: '填写店主联系电话'
)
];
}
String _sortName = '';
final List<String> _list = ['水果生鲜', '家用电器', '休闲食品', '茶酒饮料', '美妆个护', '粮油调味', '家庭清洁', '厨具用品', '儿童玩具', '床上用品'];
void _showBottomSheet() {
showModalBottomSheet<void>(
context: context,
builder: (BuildContext context) {
// 可滑动ListView关闭BottomSheet
return DraggableScrollableSheet(
key: const Key('goods_sort'),
initialChildSize: 0.7,
minChildSize: 0.65,
expand: false,
builder: (_, scrollController) {
return ListView.builder(
controller: scrollController,
itemExtent: 48.0,
itemBuilder: (_, index) {
return InkWell(
child: Container(
padding: const EdgeInsets.symmetric(horizontal: 16.0),
alignment: Alignment.centerLeft,
child: Text(_list[index]),
),
onTap: () {
setState(() {
_sortName = _list[index];
});
NavigatorUtils.goBack(context);
},
);
},
itemCount: _list.length,
);
},
);
},
);
}
}