|
|
|
1
|
+// import 'package:cached_network_image/cached_network_image.dart';
|
|
|
|
2
|
+// import 'package:flutter/material.dart';
|
|
|
|
3
|
+// import 'package:flutter_screenutil/flutter_screenutil.dart';
|
|
|
|
4
|
+// import 'package:one_key/pages/my/marketing_center/theme_model.dart';
|
|
|
|
5
|
+// import 'package:one_key/widgets/system_app_bar.dart';
|
|
|
|
6
|
+// import 'package:one_key/widgets/v_empty_view.dart';
|
|
|
|
7
|
+// import 'package:provider/provider.dart';
|
|
|
|
8
|
+
|
|
|
|
9
|
+// import '../../../models/seller_template_color_list_model.dart';
|
|
|
|
10
|
+// import '../../../provider/marketing_center_provider.dart';
|
|
|
|
11
|
+// import '../../../provider/user_model.dart';
|
|
|
|
12
|
+// import '../../../res/colors.dart';
|
|
|
|
13
|
+// import '../../../utils/dialog_util.dart';
|
|
|
|
14
|
+// import '../../../utils/event_bus.dart';
|
|
|
|
15
|
+// import '../../../utils/screen_util.dart';
|
|
|
|
16
|
+// import '../../../utils/utils.dart';
|
|
|
|
17
|
+// import '../../../widgets/MyDivider.dart';
|
|
|
|
18
|
+// import '../../../widgets/round_button.dart';
|
|
|
|
19
|
+// import '../../online_check/photo_view_wiget.dart';
|
|
|
|
20
|
+// import 'package:card_swiper/card_swiper.dart';
|
|
|
|
21
|
+
|
|
|
|
22
|
+// import 'dart:convert' as convert;
|
|
|
|
23
|
+
|
|
|
|
24
|
+// /**
|
|
|
|
25
|
+// *
|
|
|
|
26
|
+// * 邀请函主题选择页面预览
|
|
|
|
27
|
+// */
|
|
|
|
28
|
+
|
|
|
|
29
|
+// class InvitationThemeHomePage extends StatefulWidget {
|
|
|
|
30
|
+// // final SellerTemplateColorListSunModel themeSunModel;
|
|
|
|
31
|
+// InvitationThemeHomePage({Key key}) : super(key: key);
|
|
|
|
32
|
+
|
|
|
|
33
|
+// @override
|
|
|
|
34
|
+// _InvitationThemeHomePageState createState() =>
|
|
|
|
35
|
+// _InvitationThemeHomePageState();
|
|
|
|
36
|
+// }
|
|
|
|
37
|
+
|
|
|
|
38
|
+// class _InvitationThemeHomePageState extends State<InvitationThemeHomePage> {
|
|
|
|
39
|
+// MarketingCenterProvider marketingCenterProvider;
|
|
|
|
40
|
+// ScrollController controller = ScrollController();
|
|
|
|
41
|
+
|
|
|
|
42
|
+// //当前店铺选中的颜色和板式
|
|
|
|
43
|
+
|
|
|
|
44
|
+// String themeColor;
|
|
|
|
45
|
+// String themeType; //模版类型
|
|
|
|
46
|
+// String url;
|
|
|
|
47
|
+// String themeTitle = ''; //标题样式
|
|
|
|
48
|
+
|
|
|
|
49
|
+// ThemeModel themeModelCurrunt; //有配色对应的当前页面模版数据
|
|
|
|
50
|
+// SellerTemplateColorListSunModel themeSunModel;
|
|
|
|
51
|
+
|
|
|
|
52
|
+// @override
|
|
|
|
53
|
+// void initState() {
|
|
|
|
54
|
+// super.initState();
|
|
|
|
55
|
+// // if (themeSunModel.themeColorDefault != null) {
|
|
|
|
56
|
+// // themeColor = themeSunModel.themeColorDefault;
|
|
|
|
57
|
+// // url = themeSunModel
|
|
|
|
58
|
+// // .colors[themeSunModel.colors
|
|
|
|
59
|
+// // .indexWhere((element) => element.colorName == themeColor)]
|
|
|
|
60
|
+// // .url;
|
|
|
|
61
|
+// // } else {
|
|
|
|
62
|
+// // if (themeSunModel.colors.length > 0) {
|
|
|
|
63
|
+// // themeColor = themeSunModel.colors[0].colorName;
|
|
|
|
64
|
+// // url = themeSunModel.colors[0].url;
|
|
|
|
65
|
+// // } else {
|
|
|
|
66
|
+// // url = themeSunModel.url;
|
|
|
|
67
|
+// // }
|
|
|
|
68
|
+// // }
|
|
|
|
69
|
+
|
|
|
|
70
|
+// // themeType = themeSunModel.id;
|
|
|
|
71
|
+// }
|
|
|
|
72
|
+
|
|
|
|
73
|
+// // _selectTheme(String id) {
|
|
|
|
74
|
+// // List<ThemeSunModel> temp = [];
|
|
|
|
75
|
+// // temp.addAll(themeModelCurrunt.urls);
|
|
|
|
76
|
+// // temp.addAll(themeDatasno);
|
|
|
|
77
|
+// // List<String> tempUrls = temp.map((e) => e.url).toList();
|
|
|
|
78
|
+
|
|
|
|
79
|
+// // // List<String> temp =
|
|
|
|
80
|
+// // // themeModel.urls.map((e) => e.url).toList();
|
|
|
|
81
|
+// // // print(temp);
|
|
|
|
82
|
+
|
|
|
|
83
|
+// // // List<String> temp =
|
|
|
|
84
|
+// // // themeDatasno.map((e) => e.url).toList();
|
|
|
|
85
|
+// // print(temp);
|
|
|
|
86
|
+// // _showPhotoView(
|
|
|
|
87
|
+// // context, temp.indexWhere((element) => element.id == id), tempUrls,
|
|
|
|
88
|
+// // (index) {
|
|
|
|
89
|
+// // //选中的index
|
|
|
|
90
|
+// // themeType = temp[index].id; //当前选中模版的id
|
|
|
|
91
|
+// // setState(() {});
|
|
|
|
92
|
+// // });
|
|
|
|
93
|
+// // }
|
|
|
|
94
|
+
|
|
|
|
95
|
+// double _scale = 1.0;
|
|
|
|
96
|
+// double _previousScale = 1.0;
|
|
|
|
97
|
+// Offset _panOffset = Offset(0, 0);
|
|
|
|
98
|
+// Offset _previousPanOffset = Offset(0, 0);
|
|
|
|
99
|
+
|
|
|
|
100
|
+// void _onScaleUpdate(ScaleUpdateDetails details) {
|
|
|
|
101
|
+// setState(() {
|
|
|
|
102
|
+// _previousScale = _scale;
|
|
|
|
103
|
+// _scale *= details.scale;
|
|
|
|
104
|
+// _previousPanOffset = _panOffset;
|
|
|
|
105
|
+// _panOffset = _panOffset -
|
|
|
|
106
|
+// details.focalPoint -
|
|
|
|
107
|
+// _panOffset +
|
|
|
|
108
|
+// details.localFocalPoint;
|
|
|
|
109
|
+// });
|
|
|
|
110
|
+// }
|
|
|
|
111
|
+
|
|
|
|
112
|
+// _showPhotoView(BuildContext context, int index, List<String> imgs,
|
|
|
|
113
|
+// {isShow = false, List dashName}) async {
|
|
|
|
114
|
+// // if (imgs.length == 1 &&
|
|
|
|
115
|
+// // imgs[0] ==
|
|
|
|
116
|
+// // 'http://nosqn.colorcun.com/custom/lite-online/image/def-banner.png') {
|
|
|
|
117
|
+// // imgs[0] = 'http://nosqn.colorcun.com/app/seller-hj-empty.png';
|
|
|
|
118
|
+// // }
|
|
|
|
119
|
+// Utils.setBarStatus(false, color: Colors.black);
|
|
|
|
120
|
+// dynamic result = await showGeneralDialog(
|
|
|
|
121
|
+// context: context,
|
|
|
|
122
|
+// barrierDismissible: false,
|
|
|
|
123
|
+// // barrierColor: Colors.red,
|
|
|
|
124
|
+// barrierLabel:
|
|
|
|
125
|
+// MaterialLocalizations.of(context).modalBarrierDismissLabel,
|
|
|
|
126
|
+// transitionDuration: const Duration(milliseconds: 150),
|
|
|
|
127
|
+// pageBuilder: (BuildContext context, Animation animation,
|
|
|
|
128
|
+// Animation secondaryAnimation) {
|
|
|
|
129
|
+// Widget child = Stack(
|
|
|
|
130
|
+// alignment: Alignment.bottomCenter,
|
|
|
|
131
|
+// children: <Widget>[
|
|
|
|
132
|
+// PhotoPreview(
|
|
|
|
133
|
+// initialIndex: index,
|
|
|
|
134
|
+// photoList: imgs,
|
|
|
|
135
|
+// isShow: isShow,
|
|
|
|
136
|
+// dashName: dashName,
|
|
|
|
137
|
+// needMask: false,
|
|
|
|
138
|
+// needTap: false,
|
|
|
|
139
|
+// callback: (curruntIndex) {
|
|
|
|
140
|
+// //选中某个模版
|
|
|
|
141
|
+// // callback(curruntIndex);
|
|
|
|
142
|
+// },
|
|
|
|
143
|
+// ),
|
|
|
|
144
|
+// // Positioned(
|
|
|
|
145
|
+// // bottom: w(20),
|
|
|
|
146
|
+// // child: InkWell(
|
|
|
|
147
|
+// // onTap: () {
|
|
|
|
148
|
+// // callback(index);
|
|
|
|
149
|
+// // },
|
|
|
|
150
|
+// // child: Container(
|
|
|
|
151
|
+// // padding: EdgeInsets.symmetric(
|
|
|
|
152
|
+// // horizontal: w(30), vertical: w(10)),
|
|
|
|
153
|
+// // decoration: BoxDecoration(
|
|
|
|
154
|
+// // color: MyColours.color_ffffff,
|
|
|
|
155
|
+// // borderRadius: BorderRadius.circular(r(30)),
|
|
|
|
156
|
+// // ),
|
|
|
|
157
|
+// // child: Text(
|
|
|
|
158
|
+// // '应用',
|
|
|
|
159
|
+// // style: TextStyle(
|
|
|
|
160
|
+// // decoration: TextDecoration.none,
|
|
|
|
161
|
+// // color: MyColours.color_515151,
|
|
|
|
162
|
+// // fontSize: font(16)),
|
|
|
|
163
|
+// // ),
|
|
|
|
164
|
+// // ),
|
|
|
|
165
|
+// // ))
|
|
|
|
166
|
+// ],
|
|
|
|
167
|
+// );
|
|
|
|
168
|
+// return Material(child: child);
|
|
|
|
169
|
+// });
|
|
|
|
170
|
+// Utils.setBarStatus(true, color: Colors.white);
|
|
|
|
171
|
+// }
|
|
|
|
172
|
+
|
|
|
|
173
|
+// @override
|
|
|
|
174
|
+// Widget build(BuildContext context) {
|
|
|
|
175
|
+// marketingCenterProvider =
|
|
|
|
176
|
+// Provider.of<MarketingCenterProvider>(context, listen: true);
|
|
|
|
177
|
+// return Scaffold(
|
|
|
|
178
|
+// backgroundColor: MyColours.color_ffffff,
|
|
|
|
179
|
+// appBar: SystemAppBar('客户通知设置'),
|
|
|
|
180
|
+// body: Column(
|
|
|
|
181
|
+// children: [
|
|
|
|
182
|
+// Expanded(
|
|
|
|
183
|
+// child: SingleChildScrollView(
|
|
|
|
184
|
+// child: Column(
|
|
|
|
185
|
+// children: [
|
|
|
|
186
|
+// InkWell(
|
|
|
|
187
|
+// onTap: () {
|
|
|
|
188
|
+// DialogUtil.showThemeColorSelectDialogNew(
|
|
|
|
189
|
+// context, themeSunModel.colors, callback: (object) {
|
|
|
|
190
|
+// print(object);
|
|
|
|
191
|
+// setState(() {
|
|
|
|
192
|
+// themeColor = object;
|
|
|
|
193
|
+// url = themeSunModel
|
|
|
|
194
|
+// .colors[themeSunModel.colors.indexWhere(
|
|
|
|
195
|
+// (element) => element.colorName == object)]
|
|
|
|
196
|
+// .url;
|
|
|
|
197
|
+// });
|
|
|
|
198
|
+// });
|
|
|
|
199
|
+// },
|
|
|
|
200
|
+// child: Padding(
|
|
|
|
201
|
+// padding: EdgeInsets.only(
|
|
|
|
202
|
+// left: w(16), top: w(12), bottom: w(12), right: w(24)),
|
|
|
|
203
|
+// child: Row(
|
|
|
|
204
|
+// mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
205
|
+// children: [
|
|
|
|
206
|
+// Text(
|
|
|
|
207
|
+// '主题颜色选择',
|
|
|
|
208
|
+// style: TextStyle(
|
|
|
|
209
|
+// color: MyColours.color_515151,
|
|
|
|
210
|
+// fontSize: font(16)),
|
|
|
|
211
|
+// ),
|
|
|
|
212
|
+// Spacer(),
|
|
|
|
213
|
+// Text(
|
|
|
|
214
|
+// themeColor??'',
|
|
|
|
215
|
+// style: TextStyle(
|
|
|
|
216
|
+// color: themeColor == '当前主题不可用'
|
|
|
|
217
|
+// ? MyColours.color_BFC4D4
|
|
|
|
218
|
+// : MyColours.color_515151,
|
|
|
|
219
|
+// fontSize: font(16)),
|
|
|
|
220
|
+// ),
|
|
|
|
221
|
+// Container(
|
|
|
|
222
|
+// padding: EdgeInsets.symmetric(
|
|
|
|
223
|
+// horizontal: w(11), vertical: w(4)),
|
|
|
|
224
|
+// child: Image.asset(
|
|
|
|
225
|
+// "assets/arrow_right_new.png",
|
|
|
|
226
|
+// width: w(9),
|
|
|
|
227
|
+// height: w(16),
|
|
|
|
228
|
+// ),
|
|
|
|
229
|
+// )
|
|
|
|
230
|
+// // RoundButton(
|
|
|
|
231
|
+// // text: '预览',
|
|
|
|
232
|
+// // gradientStart: MyColours.color_ffffff,
|
|
|
|
233
|
+// // gradientEnd: MyColours.color_ffffff,
|
|
|
|
234
|
+// // borderColor: MyColours.color_438E93,
|
|
|
|
235
|
+// // textColor: MyColours.color_438E93,
|
|
|
|
236
|
+// // radius: ScreenUtil().setWidth(22),
|
|
|
|
237
|
+// // fontSize: 24,
|
|
|
|
238
|
+// // width: w(72),
|
|
|
|
239
|
+// // height: ScreenUtil().setWidth(44),
|
|
|
|
240
|
+// // isBold: true,
|
|
|
|
241
|
+// // onPressed: () {
|
|
|
|
242
|
+// // NavigatorUtil.goMarkingPreviewPage(context);
|
|
|
|
243
|
+// // },
|
|
|
|
244
|
+// // ),
|
|
|
|
245
|
+// ]))),
|
|
|
|
246
|
+// Padding(
|
|
|
|
247
|
+// padding: EdgeInsets.only(left: w(16)),
|
|
|
|
248
|
+// child: MyDivider(double.infinity, w(0.5),
|
|
|
|
249
|
+// color: MyColours.color_E7E7E7)),
|
|
|
|
250
|
+// // VEmptyView(24),
|
|
|
|
251
|
+// InkWell(
|
|
|
|
252
|
+// onTap: () {},
|
|
|
|
253
|
+// child: Padding(
|
|
|
|
254
|
+// padding: EdgeInsets.only(
|
|
|
|
255
|
+// left: w(16), top: w(12), bottom: w(12), right: w(16)),
|
|
|
|
256
|
+// child: Row(
|
|
|
|
257
|
+// mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
258
|
+// children: [
|
|
|
|
259
|
+// Text(
|
|
|
|
260
|
+// '介绍模块标题样式',
|
|
|
|
261
|
+// style: TextStyle(
|
|
|
|
262
|
+// color: MyColours.color_515151,
|
|
|
|
263
|
+// fontSize: font(16)),
|
|
|
|
264
|
+// ),
|
|
|
|
265
|
+// Spacer(),
|
|
|
|
266
|
+// Text(
|
|
|
|
267
|
+// '当前主题不可用',
|
|
|
|
268
|
+// style: TextStyle(
|
|
|
|
269
|
+// color: themeTitle == '当前主题不可用'
|
|
|
|
270
|
+// ? MyColours.color_BFC4D4
|
|
|
|
271
|
+// : MyColours.color_515151,
|
|
|
|
272
|
+// fontSize: font(16)),
|
|
|
|
273
|
+// ),
|
|
|
|
274
|
+// Container(
|
|
|
|
275
|
+// padding: EdgeInsets.symmetric(
|
|
|
|
276
|
+// horizontal: w(11), vertical: w(4)),
|
|
|
|
277
|
+// child: Image.asset(
|
|
|
|
278
|
+// "assets/arrow_right_new.png",
|
|
|
|
279
|
+// width: w(9),
|
|
|
|
280
|
+// height: w(16),
|
|
|
|
281
|
+// ),
|
|
|
|
282
|
+// )
|
|
|
|
283
|
+// // RoundButton(
|
|
|
|
284
|
+// // text: '预览',
|
|
|
|
285
|
+// // gradientStart: MyColours.color_ffffff,
|
|
|
|
286
|
+// // gradientEnd: MyColours.color_ffffff,
|
|
|
|
287
|
+// // borderColor: MyColours.color_438E93,
|
|
|
|
288
|
+// // textColor: MyColours.color_438E93,
|
|
|
|
289
|
+// // radius: ScreenUtil().setWidth(22),
|
|
|
|
290
|
+// // fontSize: 24,
|
|
|
|
291
|
+// // width: w(72),
|
|
|
|
292
|
+// // height: ScreenUtil().setWidth(44),
|
|
|
|
293
|
+// // isBold: true,
|
|
|
|
294
|
+// // onPressed: () {
|
|
|
|
295
|
+// // NavigatorUtil.goMarkingPreviewPage(context);
|
|
|
|
296
|
+// // },
|
|
|
|
297
|
+// // ),
|
|
|
|
298
|
+// ]))),
|
|
|
|
299
|
+// Padding(
|
|
|
|
300
|
+// padding: EdgeInsets.only(left: w(16)),
|
|
|
|
301
|
+// child: MyDivider(double.infinity, w(0.5),
|
|
|
|
302
|
+// color: MyColours.color_E7E7E7)),
|
|
|
|
303
|
+// Container(
|
|
|
|
304
|
+// width: double.infinity,
|
|
|
|
305
|
+// alignment: Alignment.centerLeft,
|
|
|
|
306
|
+// padding: EdgeInsets.only(
|
|
|
|
307
|
+// left: w(16), top: w(12), bottom: w(12), right: w(16)),
|
|
|
|
308
|
+// child: Text(
|
|
|
|
309
|
+// '通知主题选择(左右滑动选择要使用的主题)',
|
|
|
|
310
|
+// style: TextStyle(
|
|
|
|
311
|
+// color: MyColours.color_515151, fontSize: font(16)),
|
|
|
|
312
|
+// )),
|
|
|
|
313
|
+// VEmptyView(24),
|
|
|
|
314
|
+// Swiper(
|
|
|
|
315
|
+
|
|
|
|
316
|
+// itemBuilder: (BuildContext context,int index){
|
|
|
|
317
|
+// return Image.network("http://nosqn.colorcun.com/app/seller-hj-empty.png",fit: BoxFit.fill,);
|
|
|
|
318
|
+// },
|
|
|
|
319
|
+// itemCount: 3,
|
|
|
|
320
|
+// pagination: SwiperPagination(),
|
|
|
|
321
|
+// control: SwiperControl(),
|
|
|
|
322
|
+// ),
|
|
|
|
323
|
+// // GestureDetector(
|
|
|
|
324
|
+// // onScaleUpdate: _onScaleUpdate,
|
|
|
|
325
|
+// // child: Transform(
|
|
|
|
326
|
+// // alignment: Alignment.center,
|
|
|
|
327
|
+// // transform: Matrix4.identity()
|
|
|
|
328
|
+// // ..translate(_panOffset.dx, _panOffset.dy)
|
|
|
|
329
|
+// // ..scale(_scale),
|
|
|
|
330
|
+// // child: Image.network(
|
|
|
|
331
|
+// // 'http://nosqn.colorcun.com/app/seller-hj-empty.png',
|
|
|
|
332
|
+// // fit: BoxFit.contain,
|
|
|
|
333
|
+// // ),
|
|
|
|
334
|
+// // ),
|
|
|
|
335
|
+// // ),
|
|
|
|
336
|
+// // InkWell(
|
|
|
|
337
|
+// // onTap: () {
|
|
|
|
338
|
+// // _showPhotoView(context, 0, [url]);
|
|
|
|
339
|
+// // },
|
|
|
|
340
|
+// // child: CachedNetworkImage(
|
|
|
|
341
|
+// // imageUrl: url,
|
|
|
|
342
|
+// // width: ScreenUtil().screenWidth - w(32),
|
|
|
|
343
|
+// // fit: BoxFit.fitWidth,
|
|
|
|
344
|
+// // alignment: Alignment.topCenter,
|
|
|
|
345
|
+// // )),
|
|
|
|
346
|
+// ],
|
|
|
|
347
|
+// ))),
|
|
|
|
348
|
+// Container(
|
|
|
|
349
|
+// padding: EdgeInsets.only(
|
|
|
|
350
|
+// top: w(12), bottom: w(25), left: w(45), right: w(45)),
|
|
|
|
351
|
+// child: RoundButton(
|
|
|
|
352
|
+// onPressed: () async {
|
|
|
|
353
|
+// //接口成功后刷新并返回前一页
|
|
|
|
354
|
+// //接口
|
|
|
|
355
|
+
|
|
|
|
356
|
+// Map<String, String> params = {
|
|
|
|
357
|
+// 'sid': Provider.of<UserModel>(context, listen: false)
|
|
|
|
358
|
+// .user
|
|
|
|
359
|
+// .sellerid,
|
|
|
|
360
|
+// 'type': themeType,
|
|
|
|
361
|
+// 'lite_class': themeColor == null
|
|
|
|
362
|
+// ? null
|
|
|
|
363
|
+// : themeSunModel
|
|
|
|
364
|
+// .colors[themeSunModel.colors.indexWhere(
|
|
|
|
365
|
+// (element) => element.colorName == themeColor)]
|
|
|
|
366
|
+// .liteClass
|
|
|
|
367
|
+// };
|
|
|
|
368
|
+
|
|
|
|
369
|
+// bool success = await marketingCenterProvider
|
|
|
|
370
|
+// .setSellerTemplateConf(context, params,
|
|
|
|
371
|
+// showLoading: true);
|
|
|
|
372
|
+// if (success) {
|
|
|
|
373
|
+// Utils.showToast('设置成功');
|
|
|
|
374
|
+// //选择当前模版+主题色
|
|
|
|
375
|
+// bus.emit('theme_color_type', {
|
|
|
|
376
|
+// 'themeColor': themeColor,
|
|
|
|
377
|
+// 'themeType': themeType,
|
|
|
|
378
|
+// });
|
|
|
|
379
|
+// Navigator.pop(context);
|
|
|
|
380
|
+// }
|
|
|
|
381
|
+// },
|
|
|
|
382
|
+// text: '确定',
|
|
|
|
383
|
+// fontSize: 32,
|
|
|
|
384
|
+// isBold: true,
|
|
|
|
385
|
+// textColor: MyColours.color_F8F9FD,
|
|
|
|
386
|
+// height: ScreenUtil().setWidth(43 * 2),
|
|
|
|
387
|
+// // width: ScreenUtil().setWidth(130 * 2),
|
|
|
|
388
|
+// radius: ScreenUtil().setWidth(10),
|
|
|
|
389
|
+// )),
|
|
|
|
390
|
+// ],
|
|
|
|
391
|
+// ),
|
|
|
|
392
|
+// );
|
|
|
|
393
|
+// }
|
|
|
|
394
|
+// } |