|
|
|
1
|
+import 'package:flutter/material.dart';
|
|
|
|
2
|
+import 'package:flutter_screenutil/flutter_screenutil.dart';
|
|
|
|
3
|
+import 'package:one_key/widgets/v_empty_view.dart';
|
|
|
|
4
|
+import 'package:provider/provider.dart';
|
|
|
|
5
|
+
|
|
|
|
6
|
+import '../../../../provider/user_model.dart';
|
|
|
|
7
|
+import '../../../../res/colors.dart';
|
|
|
|
8
|
+import '../../../../utils/screen_util.dart';
|
|
|
|
9
|
+import '../../../../utils/utils.dart';
|
|
|
|
10
|
+import '../../../../widgets/MyDivider.dart';
|
|
|
|
11
|
+import '../../../../widgets/common_button_flat.dart';
|
|
|
|
12
|
+import '../../../../widgets/round_button.dart';
|
|
|
|
13
|
+import '../../../../widgets/system_app_bar.dart';
|
|
|
|
14
|
+
|
|
|
|
15
|
+/***
|
|
|
|
16
|
+ *
|
|
|
|
17
|
+ *
|
|
|
|
18
|
+ * 店铺介绍
|
|
|
|
19
|
+ */
|
|
|
|
20
|
+
|
|
|
|
21
|
+class StoreIntroducePage extends StatefulWidget {
|
|
|
|
22
|
+ StoreIntroducePage({Key key}) : super(key: key);
|
|
|
|
23
|
+
|
|
|
|
24
|
+ @override
|
|
|
|
25
|
+ _StoreIntroducePageState createState() => _StoreIntroducePageState();
|
|
|
|
26
|
+}
|
|
|
|
27
|
+
|
|
|
|
28
|
+class _StoreIntroducePageState extends State<StoreIntroducePage> {
|
|
|
|
29
|
+ int currIndex = 0; //样式按钮默认选中第一个
|
|
|
|
30
|
+
|
|
|
|
31
|
+ String sellername; //店铺名称
|
|
|
|
32
|
+
|
|
|
|
33
|
+ TextEditingController storeIntroduceC = TextEditingController();
|
|
|
|
34
|
+ FocusNode storeIntroduceNode = FocusNode();
|
|
|
|
35
|
+
|
|
|
|
36
|
+ @override
|
|
|
|
37
|
+ void initState() {
|
|
|
|
38
|
+ super.initState();
|
|
|
|
39
|
+
|
|
|
|
40
|
+ WidgetsBinding.instance.addPostFrameCallback((_) async {
|
|
|
|
41
|
+ UserModel userModel = Provider.of<UserModel>(context, listen: false);
|
|
|
|
42
|
+ sellername = userModel.user.sellername;
|
|
|
|
43
|
+ setState(() {});
|
|
|
|
44
|
+ });
|
|
|
|
45
|
+ }
|
|
|
|
46
|
+
|
|
|
|
47
|
+ ///图文合并,图文分开,无文字
|
|
|
|
48
|
+ Widget _selectBtnWidget() {
|
|
|
|
49
|
+ return Container(
|
|
|
|
50
|
+ decoration: BoxDecoration(
|
|
|
|
51
|
+ border: Border(
|
|
|
|
52
|
+ bottom:
|
|
|
|
53
|
+ BorderSide(color: MyColours.color_E7E7E7, width: w(0.5)))),
|
|
|
|
54
|
+ margin: EdgeInsets.only(left: w(16)),
|
|
|
|
55
|
+ padding: EdgeInsets.only(top: w(12), bottom: w(12), right: w(16)),
|
|
|
|
56
|
+ child: Row(
|
|
|
|
57
|
+ mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
58
|
+ children: [
|
|
|
|
59
|
+ Text(
|
|
|
|
60
|
+ '附加餐厅介绍',
|
|
|
|
61
|
+ style: TextStyle(
|
|
|
|
62
|
+ color: MyColours.color_515151,
|
|
|
|
63
|
+ fontSize: ScreenUtil().setWidth(32)),
|
|
|
|
64
|
+ ),
|
|
|
|
65
|
+ Container(
|
|
|
|
66
|
+ height: ScreenUtil().setWidth(74),
|
|
|
|
67
|
+ decoration: BoxDecoration(
|
|
|
|
68
|
+ color: Color.fromRGBO(232, 232, 232, 1),
|
|
|
|
69
|
+ borderRadius: BorderRadius.circular(
|
|
|
|
70
|
+ r(11),
|
|
|
|
71
|
+ ),
|
|
|
|
72
|
+ // border: Border.all(
|
|
|
|
73
|
+ // width: w(1), color: MyColours.color_438E93),
|
|
|
|
74
|
+ ),
|
|
|
|
75
|
+ child: Row(
|
|
|
|
76
|
+ // mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
|
|
|
77
|
+ // crossAxisAlignment: CrossAxisAlignment.center,
|
|
|
|
78
|
+ children: <Widget>[
|
|
|
|
79
|
+ CommonButtonFlat(
|
|
|
|
80
|
+ content: "无文字",
|
|
|
|
81
|
+ state: currIndex == 0 ? 1 : 0,
|
|
|
|
82
|
+ fontSize: 28,
|
|
|
|
83
|
+ right: false,
|
|
|
|
84
|
+ width: w(52),
|
|
|
|
85
|
+ onPress: () {
|
|
|
|
86
|
+ if (currIndex == 0) return;
|
|
|
|
87
|
+ setState(() {
|
|
|
|
88
|
+ currIndex = 0;
|
|
|
|
89
|
+ });
|
|
|
|
90
|
+ },
|
|
|
|
91
|
+ ),
|
|
|
|
92
|
+ currIndex == 2
|
|
|
|
93
|
+ ? MyDivider(
|
|
|
|
94
|
+ ScreenUtil().setWidth(4),
|
|
|
|
95
|
+ ScreenUtil().setWidth(46),
|
|
|
|
96
|
+ color: MyColours.color_dfdfdf,
|
|
|
|
97
|
+ )
|
|
|
|
98
|
+ : SizedBox(),
|
|
|
|
99
|
+ CommonButtonFlat(
|
|
|
|
100
|
+ content: "图文合并",
|
|
|
|
101
|
+ state: currIndex == 1 ? 1 : 0,
|
|
|
|
102
|
+ fontSize: 28,
|
|
|
|
103
|
+ width: w(66),
|
|
|
|
104
|
+ left: false,
|
|
|
|
105
|
+ right: false,
|
|
|
|
106
|
+ onPress: () {
|
|
|
|
107
|
+ if (currIndex == 1) return;
|
|
|
|
108
|
+ setState(() {
|
|
|
|
109
|
+ currIndex = 1;
|
|
|
|
110
|
+ });
|
|
|
|
111
|
+ },
|
|
|
|
112
|
+ ),
|
|
|
|
113
|
+ currIndex == 0
|
|
|
|
114
|
+ ? MyDivider(
|
|
|
|
115
|
+ ScreenUtil().setWidth(4),
|
|
|
|
116
|
+ ScreenUtil().setWidth(46),
|
|
|
|
117
|
+ color: MyColours.color_dfdfdf,
|
|
|
|
118
|
+ )
|
|
|
|
119
|
+ : SizedBox(),
|
|
|
|
120
|
+ Container(
|
|
|
|
121
|
+ child: CommonButtonFlat(
|
|
|
|
122
|
+ content: "图文分开",
|
|
|
|
123
|
+ left: false,
|
|
|
|
124
|
+ state: currIndex == 2 ? 1 : 0,
|
|
|
|
125
|
+ fontSize: 28,
|
|
|
|
126
|
+ width: w(66),
|
|
|
|
127
|
+ onPress: () {
|
|
|
|
128
|
+ if (currIndex == 2) return;
|
|
|
|
129
|
+ setState(() {
|
|
|
|
130
|
+ currIndex = 2;
|
|
|
|
131
|
+ });
|
|
|
|
132
|
+ },
|
|
|
|
133
|
+ )),
|
|
|
|
134
|
+ ],
|
|
|
|
135
|
+ ),
|
|
|
|
136
|
+ ),
|
|
|
|
137
|
+ ],
|
|
|
|
138
|
+ ));
|
|
|
|
139
|
+ }
|
|
|
|
140
|
+
|
|
|
|
141
|
+ Widget _introduceWidget() {
|
|
|
|
142
|
+ return Container(
|
|
|
|
143
|
+ alignment: Alignment.centerLeft,
|
|
|
|
144
|
+ padding: EdgeInsets.all(w(15)),
|
|
|
|
145
|
+ child: Column(
|
|
|
|
146
|
+ crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
147
|
+ children: [
|
|
|
|
148
|
+ Text(
|
|
|
|
149
|
+ 'Introduce',
|
|
|
|
150
|
+ style: TextStyle(color: MyColours.color_B39437, fontSize: font(14)),
|
|
|
|
151
|
+ ),
|
|
|
|
152
|
+ Text(
|
|
|
|
153
|
+ '品牌介绍',
|
|
|
|
154
|
+ style: TextStyle(color: MyColours.color_B39437, fontSize: font(14)),
|
|
|
|
155
|
+ ),
|
|
|
|
156
|
+ VEmptyView(16),
|
|
|
|
157
|
+ Text(
|
|
|
|
158
|
+ '${sellername}',
|
|
|
|
159
|
+ style: TextStyle(color: MyColours.color_515151, fontSize: font(14)),
|
|
|
|
160
|
+ ),
|
|
|
|
161
|
+ VEmptyView(32),
|
|
|
|
162
|
+ Container(
|
|
|
|
163
|
+ width: double.infinity,
|
|
|
|
164
|
+ margin: EdgeInsets.symmetric(horizontal: w(10)),
|
|
|
|
165
|
+ padding: EdgeInsets.symmetric(horizontal: w(8)),
|
|
|
|
166
|
+ decoration: BoxDecoration(
|
|
|
|
167
|
+ border: Border(
|
|
|
|
168
|
+ left: BorderSide(
|
|
|
|
169
|
+ width: w(2), color: MyColours.color_EEAE74))),
|
|
|
|
170
|
+ child: Container(
|
|
|
|
171
|
+ width: double.infinity,
|
|
|
|
172
|
+ padding: EdgeInsets.symmetric(
|
|
|
|
173
|
+ horizontal: ScreenUtil().setWidth(12),
|
|
|
|
174
|
+ ),
|
|
|
|
175
|
+ alignment: Alignment.topLeft,
|
|
|
|
176
|
+ child: TextField(
|
|
|
|
177
|
+ textAlign: TextAlign.left,
|
|
|
|
178
|
+ controller: storeIntroduceC,
|
|
|
|
179
|
+ focusNode: storeIntroduceNode,
|
|
|
|
180
|
+ style: TextStyle(
|
|
|
|
181
|
+ height: 2,
|
|
|
|
182
|
+ color: MyColours.color_515151,
|
|
|
|
183
|
+ fontSize: ScreenUtil().setSp(20),
|
|
|
|
184
|
+ textBaseline: TextBaseline.alphabetic),
|
|
|
|
185
|
+ textAlignVertical: TextAlignVertical.center,
|
|
|
|
186
|
+ maxLines: 7,
|
|
|
|
187
|
+ decoration: InputDecoration(
|
|
|
|
188
|
+ hintText: "点这里录入餐厅介绍文字",
|
|
|
|
189
|
+ hintStyle: TextStyle(
|
|
|
|
190
|
+ color: MyColours.color_999999,
|
|
|
|
191
|
+ fontSize: ScreenUtil().setSp(20),
|
|
|
|
192
|
+ ),
|
|
|
|
193
|
+ contentPadding: EdgeInsets.zero,
|
|
|
|
194
|
+ border: OutlineInputBorder(borderSide: BorderSide.none),
|
|
|
|
195
|
+ ),
|
|
|
|
196
|
+ keyboardType: TextInputType.text,
|
|
|
|
197
|
+ onChanged: (value) {
|
|
|
|
198
|
+ setState(() {
|
|
|
|
199
|
+ // currentRemark = value ?? "";
|
|
|
|
200
|
+ });
|
|
|
|
201
|
+ }),
|
|
|
|
202
|
+ )),
|
|
|
|
203
|
+ ],
|
|
|
|
204
|
+ ),
|
|
|
|
205
|
+ );
|
|
|
|
206
|
+ }
|
|
|
|
207
|
+
|
|
|
|
208
|
+ Widget _uploadImage(bool hasupload) {
|
|
|
|
209
|
+ return InkWell(
|
|
|
|
210
|
+ onTap: () {},
|
|
|
|
211
|
+ child: hasupload
|
|
|
|
212
|
+ ? InkWell(
|
|
|
|
213
|
+ onTap: () {
|
|
|
|
214
|
+ print('object');
|
|
|
|
215
|
+ },
|
|
|
|
216
|
+ child: Stack(alignment: Alignment.bottomCenter, children: [
|
|
|
|
217
|
+ Image.network(
|
|
|
|
218
|
+ 'https://www.ssfiction.com/wp-content/uploads/2020/08/20200805_5f2b1669e9a24.jpg',
|
|
|
|
219
|
+ fit: BoxFit.cover,
|
|
|
|
220
|
+ height: w(280),
|
|
|
|
221
|
+ ),
|
|
|
|
222
|
+ Container(
|
|
|
|
223
|
+ height: w(25),
|
|
|
|
224
|
+ alignment: Alignment.center,
|
|
|
|
225
|
+ child: Text(
|
|
|
|
226
|
+ '点击图片可以更换',
|
|
|
|
227
|
+ style: TextStyle(
|
|
|
|
228
|
+ color: MyColours.color_F8F9FD,
|
|
|
|
229
|
+ fontSize: font(14),
|
|
|
|
230
|
+ fontWeight: FontWeight.bold),
|
|
|
|
231
|
+ )),
|
|
|
|
232
|
+ ]))
|
|
|
|
233
|
+ : Container(
|
|
|
|
234
|
+ color: MyColours.color_d9d9d9,
|
|
|
|
235
|
+ width: double.infinity,
|
|
|
|
236
|
+ height: w(280),
|
|
|
|
237
|
+ child: Column(
|
|
|
|
238
|
+ children: [
|
|
|
|
239
|
+ VEmptyView(80),
|
|
|
|
240
|
+ Image.asset(
|
|
|
|
241
|
+ Utils.getImgPath('add_img'),
|
|
|
|
242
|
+ width: w(63),
|
|
|
|
243
|
+ ),
|
|
|
|
244
|
+ VEmptyView(28),
|
|
|
|
245
|
+ Container(
|
|
|
|
246
|
+ width: w(139),
|
|
|
|
247
|
+ height: w(60),
|
|
|
|
248
|
+ child: Text(
|
|
|
|
249
|
+ '点击上传照片\n为了更好的效果\n建议上传4:3照片',
|
|
|
|
250
|
+ textAlign: TextAlign.center,
|
|
|
|
251
|
+ style: TextStyle(
|
|
|
|
252
|
+ height: 1.4,
|
|
|
|
253
|
+ color: MyColours.color_ffffff,
|
|
|
|
254
|
+ fontSize: font(14),
|
|
|
|
255
|
+ fontWeight: FontWeight.bold),
|
|
|
|
256
|
+ ))
|
|
|
|
257
|
+ ],
|
|
|
|
258
|
+ ),
|
|
|
|
259
|
+ ));
|
|
|
|
260
|
+ }
|
|
|
|
261
|
+
|
|
|
|
262
|
+ @override
|
|
|
|
263
|
+ Widget build(BuildContext context) {
|
|
|
|
264
|
+ return Scaffold(
|
|
|
|
265
|
+ backgroundColor: MyColours.color_ffffff,
|
|
|
|
266
|
+ appBar: SystemAppBar(
|
|
|
|
267
|
+ '店铺介绍',
|
|
|
|
268
|
+ onTap: () {
|
|
|
|
269
|
+ Navigator.pop(context);
|
|
|
|
270
|
+ },
|
|
|
|
271
|
+ ),
|
|
|
|
272
|
+ body: Column(
|
|
|
|
273
|
+ children: [
|
|
|
|
274
|
+ Expanded(
|
|
|
|
275
|
+ child: SingleChildScrollView(
|
|
|
|
276
|
+ child: Column(
|
|
|
|
277
|
+ children: [
|
|
|
|
278
|
+ _selectBtnWidget(),
|
|
|
|
279
|
+ VEmptyView(24),
|
|
|
|
280
|
+ Container(
|
|
|
|
281
|
+ alignment: Alignment.centerLeft,
|
|
|
|
282
|
+ padding: EdgeInsets.only(left: w(16)),
|
|
|
|
283
|
+ height: w(48),
|
|
|
|
284
|
+ child: Text(
|
|
|
|
285
|
+ '效果预览',
|
|
|
|
286
|
+ style: TextStyle(
|
|
|
|
287
|
+ fontSize: font(16), color: MyColours.color_515151),
|
|
|
|
288
|
+ ),
|
|
|
|
289
|
+ ),
|
|
|
|
290
|
+ VEmptyView(24),
|
|
|
|
291
|
+ _introduceWidget(),
|
|
|
|
292
|
+ VEmptyView(18),
|
|
|
|
293
|
+ _uploadImage(false),
|
|
|
|
294
|
+ VEmptyView(18),
|
|
|
|
295
|
+ _uploadImage(true),
|
|
|
|
296
|
+ VEmptyView(18),
|
|
|
|
297
|
+ _uploadImage(false),
|
|
|
|
298
|
+ VEmptyView(18),
|
|
|
|
299
|
+ _uploadImage(true),
|
|
|
|
300
|
+ VEmptyView(18),
|
|
|
|
301
|
+ ],
|
|
|
|
302
|
+ ),
|
|
|
|
303
|
+ )),
|
|
|
|
304
|
+ Container(
|
|
|
|
305
|
+ color: MyColours.color_ffffff,
|
|
|
|
306
|
+ padding: EdgeInsets.only(
|
|
|
|
307
|
+ left: w(45), right: w(45), top: w(12), bottom: w(25)),
|
|
|
|
308
|
+ child: RoundButton(
|
|
|
|
309
|
+ text: '保存',
|
|
|
|
310
|
+ gradientStart: MyColours.color_199095,
|
|
|
|
311
|
+ gradientEnd: MyColours.color_199095,
|
|
|
|
312
|
+ // borderColor: MyColours.color_999999,
|
|
|
|
313
|
+ radius: r(5),
|
|
|
|
314
|
+ fontSize: 34,
|
|
|
|
315
|
+ height: w(40),
|
|
|
|
316
|
+ isBold: true,
|
|
|
|
317
|
+ onPressed: () {},
|
|
|
|
318
|
+ ),
|
|
|
|
319
|
+ )
|
|
|
|
320
|
+ ],
|
|
|
|
321
|
+ ));
|
|
|
|
322
|
+ }
|
|
|
|
323
|
+} |