Commit bbd09e59e5c12b4d54f688d65800f44fb0ae5e95

Authored by wdn127929
1 parent df52693b

邀请函配置增加视频

Too many changes to show.

To preserve performance only 9 of 9+ files are displayed.

@@ -18,19 +18,19 @@ if (flutterRoot == null) { @@ -18,19 +18,19 @@ if (flutterRoot == null) {
18 18
19 19
20 20
21 -def flutterVersionCode = "534" 21 +def flutterVersionCode = "542"
22 if (flutterVersionCode == null) { 22 if (flutterVersionCode == null) {
23 - flutterVersionCode = '534' 23 + flutterVersionCode = '542'
24 24
25 25
26 26
27 } 27 }
28 28
29 29
30 -def flutterVersionName = "5.3.4" 30 +def flutterVersionName = "5.4.2"
31 31
32 if (flutterVersionName == null) { 32 if (flutterVersionName == null) {
33 - flutterVersionName = '5.3.4' 33 + flutterVersionName = '5.4.2'
34 34
35 35
36 } 36 }
  1 +import 'package:flutter/material.dart';
  2 +import 'package:one_key/models/upload_img_model.dart';
  3 +
  4 +class AdditionModel {
  5 + String content;
  6 + String type; // 1图片 2文本
  7 + // int order; //顺序
  8 + UploadImgModel image;
  9 + TextEditingController infoC = TextEditingController();
  10 +
  11 + AdditionModel();
  12 +
  13 + factory AdditionModel.fromJson(Map<String, dynamic> json) => AdditionModel()
  14 + ..content = json["content"]
  15 + ..type = json["type"];
  16 + // ..order = json['order'];
  17 +
  18 + Map<String, dynamic> toJson() => <String, dynamic>{
  19 + "content": content, "type": type,
  20 + // 'order': order
  21 + };
  22 +}
1 import 'dart:convert' as convert; 1 import 'dart:convert' as convert;
  2 +import 'dart:convert';
2 3
3 import 'package:one_key/models/recharge_list_model.dart'; 4 import 'package:one_key/models/recharge_list_model.dart';
  5 +import 'package:one_key/models/reserve_img_text.dart';
4 6
5 import 'coupon_model.dart'; 7 import 'coupon_model.dart';
6 8
@@ -145,6 +147,10 @@ class MarkReserveModel { @@ -145,6 +147,10 @@ class MarkReserveModel {
145 String swichSlogan; // 147 String swichSlogan; //
146 String swichCustomer; // 148 String swichCustomer; //
147 List<String> parkImages; 149 List<String> parkImages;
  150 + String isIntroduceAll;
  151 + String title;
  152 +
  153 + List<ContentModel> content;
148 154
149 MarkReserveModel( 155 MarkReserveModel(
150 {this.swichPhone, 156 {this.swichPhone,
@@ -171,7 +177,10 @@ class MarkReserveModel { @@ -171,7 +177,10 @@ class MarkReserveModel {
171 this.swichWelcome, 177 this.swichWelcome,
172 this.swichSlogan, 178 this.swichSlogan,
173 this.swichCustomer, 179 this.swichCustomer,
174 - this.parkImages}); 180 + this.parkImages,
  181 + this.isIntroduceAll,
  182 + this.title,
  183 + this.content});
175 184
176 MarkReserveModel.fromJson(Map<String, dynamic> json) { 185 MarkReserveModel.fromJson(Map<String, dynamic> json) {
177 swichPhone = json['swich_phone']; 186 swichPhone = json['swich_phone'];
@@ -221,6 +230,27 @@ class MarkReserveModel { @@ -221,6 +230,27 @@ class MarkReserveModel {
221 }); 230 });
222 } 231 }
223 } 232 }
  233 +
  234 + if (json['content'] != null) {
  235 + content = [];
  236 +
  237 + if (json['content'] is List) {
  238 + List temp = json['content'];
  239 + temp.forEach((element) {
  240 + content.add(ContentModel.fromJson(element));
  241 + });
  242 + } else {
  243 + if (jsonDecode(json['content']) is List) {
  244 + List temp = jsonDecode(json['content']);
  245 + temp.forEach((element) {
  246 + content.add(ContentModel.fromJson(element));
  247 + });
  248 + }
  249 + }
  250 + }
  251 +
  252 + isIntroduceAll = json['is_introduce_all'];
  253 + title = json['title'];
224 } 254 }
225 255
226 Map<String, dynamic> toJson() { 256 Map<String, dynamic> toJson() {
@@ -250,11 +280,14 @@ class MarkReserveModel { @@ -250,11 +280,14 @@ class MarkReserveModel {
250 data['long'] = this.long; 280 data['long'] = this.long;
251 data['lat'] = this.lat; 281 data['lat'] = this.lat;
252 282
253 -data['swich_welcome'] = this.swichWelcome;  
254 -data['swich_slogan'] = this.swichSlogan;  
255 -data['swich_customer'] = this.swichCustomer;  
256 -data['park_info_images'] = this.parkImages;  
257 - 283 + data['swich_welcome'] = this.swichWelcome;
  284 + data['swich_slogan'] = this.swichSlogan;
  285 + data['swich_customer'] = this.swichCustomer;
  286 + data['park_info_images'] = this.parkImages;
  287 +
  288 + data['is_introduce_all'] = this.isIntroduceAll;
  289 + data['title'] = this.title;
  290 + data['content'] = this.content.map((e) => e.toJson()).toList();
258 291
259 return data; 292 return data;
260 } 293 }
@@ -268,6 +301,10 @@ class MarkStoreModel { @@ -268,6 +301,10 @@ class MarkStoreModel {
268 String isIntroduce; 301 String isIntroduce;
269 String isAbove; 302 String isAbove;
270 String isImages; 303 String isImages;
  304 + String isIntroduceAll;
  305 + String title;
  306 +
  307 + List<ContentModel> content;
271 308
272 MarkStoreModel( 309 MarkStoreModel(
273 {this.style, 310 {this.style,
@@ -276,7 +313,9 @@ class MarkStoreModel { @@ -276,7 +313,9 @@ class MarkStoreModel {
276 this.images, 313 this.images,
277 this.isIntroduce, 314 this.isIntroduce,
278 this.isAbove, 315 this.isAbove,
279 - this.isImages}); 316 + this.isImages,
  317 + this.isIntroduceAll,
  318 + this.title});
280 319
281 MarkStoreModel.fromJson(Map<String, dynamic> json) { 320 MarkStoreModel.fromJson(Map<String, dynamic> json) {
282 style = json['style']; 321 style = json['style'];
@@ -296,9 +335,22 @@ class MarkStoreModel { @@ -296,9 +335,22 @@ class MarkStoreModel {
296 } 335 }
297 } 336 }
298 337
  338 + if (json['content'] != null) {
  339 + content = [];
  340 + if (jsonDecode(json['content']) is List) {
  341 + List temp = jsonDecode(json['content']);
  342 + temp.forEach((element) {
  343 + content.add(ContentModel.fromJson(element));
  344 + });
  345 + }
  346 + }
  347 +
299 isIntroduce = json['is_introduce']; 348 isIntroduce = json['is_introduce'];
300 isAbove = json['is_above']; 349 isAbove = json['is_above'];
301 isImages = json['is_images']; 350 isImages = json['is_images'];
  351 +
  352 + isIntroduceAll = json['is_introduce_all'];
  353 + title = json['title'];
302 } 354 }
303 355
304 Map<String, dynamic> toJson() { 356 Map<String, dynamic> toJson() {
@@ -310,6 +362,9 @@ class MarkStoreModel { @@ -310,6 +362,9 @@ class MarkStoreModel {
310 data['is_introduce'] = this.isIntroduce; 362 data['is_introduce'] = this.isIntroduce;
311 data['is_above'] = this.isAbove; 363 data['is_above'] = this.isAbove;
312 data['is_images'] = this.isImages; 364 data['is_images'] = this.isImages;
  365 + data['is_introduce_all'] = this.isIntroduceAll;
  366 + data['title'] = this.title;
  367 + data['content'] = this.content;
313 368
314 return data; 369 return data;
315 } 370 }
@@ -324,6 +379,10 @@ class MarkChefModel { @@ -324,6 +379,10 @@ class MarkChefModel {
324 String isIntroduce; 379 String isIntroduce;
325 String isAbove; 380 String isAbove;
326 String isImages; 381 String isImages;
  382 + String isIntroduceAll;
  383 + String title;
  384 +
  385 + List<ContentModel> content;
327 386
328 MarkChefModel( 387 MarkChefModel(
329 {this.style, 388 {this.style,
@@ -333,7 +392,10 @@ class MarkChefModel { @@ -333,7 +392,10 @@ class MarkChefModel {
333 this.image, 392 this.image,
334 this.isIntroduce, 393 this.isIntroduce,
335 this.isAbove, 394 this.isAbove,
336 - this.isImages}); 395 + this.isImages,
  396 + this.isIntroduceAll,
  397 + this.title,
  398 + this.content});
337 399
338 MarkChefModel.fromJson(Map<String, dynamic> json) { 400 MarkChefModel.fromJson(Map<String, dynamic> json) {
339 style = json['style']; 401 style = json['style'];
@@ -344,6 +406,18 @@ class MarkChefModel { @@ -344,6 +406,18 @@ class MarkChefModel {
344 isIntroduce = json['is_introduce']; 406 isIntroduce = json['is_introduce'];
345 isAbove = json['is_above']; 407 isAbove = json['is_above'];
346 isImages = json['is_images']; 408 isImages = json['is_images'];
  409 + if (json['content'] != null) {
  410 + content = [];
  411 + if (jsonDecode(json['content']) is List) {
  412 + List temp = jsonDecode(json['content']);
  413 + temp.forEach((element) {
  414 + content.add(ContentModel.fromJson(element));
  415 + });
  416 + }
  417 + }
  418 +
  419 + isIntroduceAll = json['is_introduce_all'];
  420 + title = json['title'];
347 } 421 }
348 422
349 Map<String, dynamic> toJson() { 423 Map<String, dynamic> toJson() {
@@ -356,6 +430,9 @@ class MarkChefModel { @@ -356,6 +430,9 @@ class MarkChefModel {
356 data['is_introduce'] = this.isIntroduce; 430 data['is_introduce'] = this.isIntroduce;
357 data['is_above'] = this.isAbove; 431 data['is_above'] = this.isAbove;
358 data['is_images'] = this.isImages; 432 data['is_images'] = this.isImages;
  433 + data['is_introduce_all'] = this.isIntroduceAll;
  434 + data['title'] = this.title;
  435 + data['content'] = this.content;
359 return data; 436 return data;
360 } 437 }
361 } 438 }
@@ -365,10 +442,13 @@ class MarkSignboardModel { @@ -365,10 +442,13 @@ class MarkSignboardModel {
365 442
366 List<String> images; 443 List<String> images;
367 444
368 - MarkSignboardModel({  
369 - this.swich,  
370 - this.images,  
371 - }); 445 + String isIntroduceAll;
  446 + String title;
  447 +
  448 + List<ContentModel> content;
  449 +
  450 + MarkSignboardModel(
  451 + {this.swich, this.images, this.isIntroduceAll, this.title, this.content});
372 452
373 MarkSignboardModel.fromJson(Map<String, dynamic> json) { 453 MarkSignboardModel.fromJson(Map<String, dynamic> json) {
374 swich = json['swich']; 454 swich = json['swich'];
@@ -384,6 +464,18 @@ class MarkSignboardModel { @@ -384,6 +464,18 @@ class MarkSignboardModel {
384 }); 464 });
385 } 465 }
386 } 466 }
  467 + if (json['content'] != null) {
  468 + content = [];
  469 + if (jsonDecode(json['content']) is List) {
  470 + List temp = jsonDecode(json['content']);
  471 + temp.forEach((element) {
  472 + content.add(ContentModel.fromJson(element));
  473 + });
  474 + }
  475 + }
  476 +
  477 + isIntroduceAll = json['is_introduce_all'];
  478 + title = json['title'];
387 } 479 }
388 480
389 Map<String, dynamic> toJson() { 481 Map<String, dynamic> toJson() {
@@ -391,6 +483,9 @@ class MarkSignboardModel { @@ -391,6 +483,9 @@ class MarkSignboardModel {
391 data['swich'] = this.swich; 483 data['swich'] = this.swich;
392 484
393 data['images'] = this.images; 485 data['images'] = this.images;
  486 + data['is_introduce_all'] = this.isIntroduceAll;
  487 + data['title'] = this.title;
  488 + data['content'] = this.content;
394 return data; 489 return data;
395 } 490 }
396 } 491 }
@@ -66,12 +66,26 @@ class ReserveImgTextSunModel { @@ -66,12 +66,26 @@ class ReserveImgTextSunModel {
66 class ContentModel{ 66 class ContentModel{
67 String type; 67 String type;
68 String content; 68 String content;
  69 + String duration;
69 70
70 - ContentModel({this.type, this.content}); 71 +
  72 + ContentModel({this.type, this.content,
  73 + this.duration});
71 74
72 ContentModel.fromJson(Map<String, dynamic> json) { 75 ContentModel.fromJson(Map<String, dynamic> json) {
73 type = json["type"]; 76 type = json["type"];
74 content = json["content"]; 77 content = json["content"];
  78 + duration = json["duration"];
  79 + }
  80 +
  81 +
  82 + Map<String, dynamic> toJson() {
  83 + final Map<String, dynamic> _data = <String, dynamic>{};
  84 + _data["type"] = type;
  85 + _data["content"] = content;
  86 + _data["duration"] = duration;
  87 +
  88 + return _data;
75 } 89 }
76 90
77 } 91 }
@@ -22,7 +22,8 @@ import 'package:permission_handler/permission_handler.dart'; @@ -22,7 +22,8 @@ import 'package:permission_handler/permission_handler.dart';
22 22
23 import 'package:image_picker/image_picker.dart'; 23 import 'package:image_picker/image_picker.dart';
24 // import 'package:qiniu_flutter_sdk/qiniu_flutter_sdk.dart'; 24 // import 'package:qiniu_flutter_sdk/qiniu_flutter_sdk.dart';
25 -import 'package:qiniu_flutter_sdk_diox/qiniu_flutter_sdk_diox.dart'; 25 +// import 'package:qiniu_flutter_sdk_diox/qiniu_flutter_sdk_diox.dart';
  26 +import 'package:qiniu_flutter_sdk/qiniu_flutter_sdk.dart';
26 import 'package:wechat_assets_picker/wechat_assets_picker.dart'; 27 import 'package:wechat_assets_picker/wechat_assets_picker.dart';
27 import '../online_check/dispose.dart'; 28 import '../online_check/dispose.dart';
28 import 'package:photo_manager/photo_manager.dart'; 29 import 'package:photo_manager/photo_manager.dart';
@@ -14,6 +14,7 @@ import 'package:one_key/widgets/system_app_bar.dart'; @@ -14,6 +14,7 @@ import 'package:one_key/widgets/system_app_bar.dart';
14 import 'package:permission_handler/permission_handler.dart'; 14 import 'package:permission_handler/permission_handler.dart';
15 import 'package:provider/provider.dart'; 15 import 'package:provider/provider.dart';
16 16
  17 +import '../../models/addition_model.dart';
17 import '../../models/reserve_img_text.dart'; 18 import '../../models/reserve_img_text.dart';
18 import '../../models/upload_img_model.dart'; 19 import '../../models/upload_img_model.dart';
19 import '../../provider/marketing_center_provider.dart'; 20 import '../../provider/marketing_center_provider.dart';
@@ -30,25 +31,7 @@ import 'dart:io'; @@ -30,25 +31,7 @@ import 'dart:io';
30 * 预订信息模块设置-自定义图文默认 31 * 预订信息模块设置-自定义图文默认
31 */ 32 */
32 33
33 -class AdditionModel {  
34 - String content;  
35 - String type; // 1图片 2文本  
36 - // int order; //顺序  
37 - UploadImgModel image;  
38 - TextEditingController infoC = TextEditingController();  
39 34
40 - AdditionModel();  
41 -  
42 - factory AdditionModel.fromJson(Map<String, dynamic> json) => AdditionModel()  
43 - ..content = json["content"]  
44 - ..type = json["type"];  
45 - // ..order = json['order'];  
46 -  
47 - Map<String, dynamic> toJson() => <String, dynamic>{  
48 - "content": content, "type": type,  
49 - // 'order': order  
50 - };  
51 -}  
52 35
53 class InvicationAdditionPage extends StatefulWidget { 36 class InvicationAdditionPage extends StatefulWidget {
54 final String rid; 37 final String rid;
@@ -31,7 +31,7 @@ import '../../../../utils/upload_image_util.dart'; @@ -31,7 +31,7 @@ import '../../../../utils/upload_image_util.dart';
31 import '../../../../widgets/page_exception.dart'; 31 import '../../../../widgets/page_exception.dart';
32 import '../../../../widgets/round_button.dart'; 32 import '../../../../widgets/round_button.dart';
33 import '../../personnel_type/base_info_personnal_page.dart'; 33 import '../../personnel_type/base_info_personnal_page.dart';
34 -import 'dish_show_page.dart'; 34 +import 'dish_show_page_old.dart';
35 import 'img_picker_invitation_widget.dart'; 35 import 'img_picker_invitation_widget.dart';
36 36
37 /*** 37 /***
@@ -39,6 +39,23 @@ import 'img_picker_invitation_widget.dart'; @@ -39,6 +39,23 @@ import 'img_picker_invitation_widget.dart';
39 * 预订信息模块 39 * 预订信息模块
40 */ 40 */
41 41
  42 +class ChangeModel {
  43 + int index; //顺序
  44 + UploadImgModel image;
  45 +
  46 + // ChangeModel();
  47 +
  48 + // factory ChangeModel.fromJson(Map<String, dynamic> json) => ChangeModel()
  49 + // ..content = json["content"]
  50 + // ..type = json["type"];
  51 + // // ..order = json['order'];
  52 +
  53 + // Map<String, dynamic> toJson() => <String, dynamic>{
  54 + // "content": content, "type": type,
  55 + // // 'order': order
  56 + // };
  57 +}
  58 +
42 class BookInfoPage extends StatefulWidget { 59 class BookInfoPage extends StatefulWidget {
43 BookInfoPage({Key key}) : super(key: key); 60 BookInfoPage({Key key}) : super(key: key);
44 61
@@ -47,8 +64,8 @@ class BookInfoPage extends StatefulWidget { @@ -47,8 +64,8 @@ class BookInfoPage extends StatefulWidget {
47 } 64 }
48 65
49 class _BookInfoPageState extends State<BookInfoPage> { 66 class _BookInfoPageState extends State<BookInfoPage> {
50 - TextEditingController parkingIncoC = TextEditingController();  
51 - FocusNode parkingIncoNode = FocusNode(); 67 + // TextEditingController parkingIncoC = TextEditingController();
  68 + // FocusNode parkingIncoNode = FocusNode();
52 69
53 TextEditingController bookingIncoC = TextEditingController(); 70 TextEditingController bookingIncoC = TextEditingController();
54 FocusNode bookingIncoNode = FocusNode(); 71 FocusNode bookingIncoNode = FocusNode();
@@ -69,7 +86,7 @@ class _BookInfoPageState extends State<BookInfoPage> { @@ -69,7 +86,7 @@ class _BookInfoPageState extends State<BookInfoPage> {
69 86
70 StoreBaseIndoProvider _storeBaseIndoProvider; 87 StoreBaseIndoProvider _storeBaseIndoProvider;
71 bool addManager = false; 88 bool addManager = false;
72 - bool addParking = false; 89 + // bool addParking = false;
73 bool addPhone = true; 90 bool addPhone = true;
74 bool addBookingInfo = false; //预订信息致辞 91 bool addBookingInfo = false; //预订信息致辞
75 bool addVoiceInfo = false; //附加语音欢迎致辞 92 bool addVoiceInfo = false; //附加语音欢迎致辞
@@ -93,7 +110,7 @@ class _BookInfoPageState extends State<BookInfoPage> { @@ -93,7 +110,7 @@ class _BookInfoPageState extends State<BookInfoPage> {
93 110
94 UploadImageProvider _uploadImageProvider; 111 UploadImageProvider _uploadImageProvider;
95 List<SmsChangeFieldSunModel> changeFieldData = []; // 112 List<SmsChangeFieldSunModel> changeFieldData = []; //
96 - List<ChangeModel> data = []; //停车信息图片 113 + // List<ChangeModel> data = []; //停车信息图片
97 114
98 List<String> imgAll = []; 115 List<String> imgAll = [];
99 116
@@ -142,7 +159,7 @@ class _BookInfoPageState extends State<BookInfoPage> { @@ -142,7 +159,7 @@ class _BookInfoPageState extends State<BookInfoPage> {
142 changeFieldData.add(smsChangeFieldSunModel8); 159 changeFieldData.add(smsChangeFieldSunModel8);
143 160
144 WidgetsBinding.instance.addPostFrameCallback((_) async { 161 WidgetsBinding.instance.addPostFrameCallback((_) async {
145 - _initData(); 162 + // _initData();
146 voiceIncoC.text = 163 voiceIncoC.text =
147 '尊敬的贵宾,您好!\n感谢您选择${Provider.of<UserModel>(context, listen: false).user.sellername}!\n您的就餐安排在{预订日期},{餐段},坐席位于{桌位}。预祝您用餐愉快,期待您的光临!'; 164 '尊敬的贵宾,您好!\n感谢您选择${Provider.of<UserModel>(context, listen: false).user.sellername}!\n您的就餐安排在{预订日期},{餐段},坐席位于{桌位}。预祝您用餐愉快,期待您的光临!';
148 _getQiniuInfo(); 165 _getQiniuInfo();
@@ -160,21 +177,21 @@ class _BookInfoPageState extends State<BookInfoPage> { @@ -160,21 +177,21 @@ class _BookInfoPageState extends State<BookInfoPage> {
160 super.dispose(); 177 super.dispose();
161 } 178 }
162 179
163 - _initData() {  
164 - ChangeModel changeModel = ChangeModel();  
165 - changeModel.index = 5;  
166 - changeModel.image = _uploadImageProvider.storeImage1;  
167 - changeModel.image.process = 0;  
168 - changeModel.image.isUpload = false;  
169 - data.add(changeModel);  
170 -  
171 - ChangeModel changeModel6 = ChangeModel();  
172 - changeModel6.index = 6;  
173 - changeModel6.image = _uploadImageProvider.storeImage2;  
174 - changeModel6.image.process = 0;  
175 - changeModel6.image.isUpload = false;  
176 - data.add(changeModel6);  
177 - } 180 + // _initData() {
  181 + // ChangeModel changeModel = ChangeModel();
  182 + // changeModel.index = 5;
  183 + // changeModel.image = _uploadImageProvider.storeImage1;
  184 + // changeModel.image.process = 0;
  185 + // changeModel.image.isUpload = false;
  186 + // data.add(changeModel);
  187 +
  188 + // ChangeModel changeModel6 = ChangeModel();
  189 + // changeModel6.index = 6;
  190 + // changeModel6.image = _uploadImageProvider.storeImage2;
  191 + // changeModel6.image.process = 0;
  192 + // changeModel6.image.isUpload = false;
  193 + // data.add(changeModel6);
  194 + // }
178 195
179 ///获取七牛云token 196 ///获取七牛云token
180 /// 197 ///
@@ -217,12 +234,12 @@ class _BookInfoPageState extends State<BookInfoPage> { @@ -217,12 +234,12 @@ class _BookInfoPageState extends State<BookInfoPage> {
217 marketingCenterProvider.markDataModel.reserve.swichManager == '1' 234 marketingCenterProvider.markDataModel.reserve.swichManager == '1'
218 ? true 235 ? true
219 : false; 236 : false;
220 - addParking =  
221 - marketingCenterProvider.markDataModel.reserve.swichPark == '1'  
222 - ? true  
223 - : false;  
224 - parkingIncoC.text =  
225 - marketingCenterProvider.markDataModel.reserve.parkInfo ?? ''; 237 + // addParking =
  238 + // marketingCenterProvider.markDataModel.reserve.swichPark == '1'
  239 + // ? true
  240 + // : false;
  241 + // parkingIncoC.text =
  242 + // marketingCenterProvider.markDataModel.reserve.parkInfo ?? '';
226 243
227 addBookingInfo = 244 addBookingInfo =
228 marketingCenterProvider.markDataModel.reserve.swichBooking == '1' 245 marketingCenterProvider.markDataModel.reserve.swichBooking == '1'
@@ -247,28 +264,28 @@ class _BookInfoPageState extends State<BookInfoPage> { @@ -247,28 +264,28 @@ class _BookInfoPageState extends State<BookInfoPage> {
247 marketingCenterProvider.markDataModel.reserve.swichCustomer == '1' 264 marketingCenterProvider.markDataModel.reserve.swichCustomer == '1'
248 ? true 265 ? true
249 : false; 266 : false;
250 - if (marketingCenterProvider.markDataModel.reserve.parkImages.length >  
251 - 0) {  
252 - if (marketingCenterProvider.markDataModel.reserve.parkImages.length ==  
253 - 1) {  
254 - _uploadImageProvider.storeImage1.qiniuUrl =  
255 - marketingCenterProvider.markDataModel.reserve.parkImages[0];  
256 - _uploadImageProvider.storeImage1.process = 1;  
257 -  
258 - imgAll.add(_uploadImageProvider.storeImage1.qiniuUrl);  
259 - }  
260 - if (marketingCenterProvider.markDataModel.reserve.parkImages.length ==  
261 - 2) {  
262 - _uploadImageProvider.storeImage1.qiniuUrl =  
263 - marketingCenterProvider.markDataModel.reserve.parkImages[0];  
264 - _uploadImageProvider.storeImage1.process = 1;  
265 - _uploadImageProvider.storeImage2.qiniuUrl =  
266 - marketingCenterProvider.markDataModel.reserve.parkImages[1];  
267 - _uploadImageProvider.storeImage2.process = 1;  
268 - imgAll.add(_uploadImageProvider.storeImage1.qiniuUrl);  
269 - imgAll.add(_uploadImageProvider.storeImage2.qiniuUrl);  
270 - }  
271 - } 267 + // if (marketingCenterProvider.markDataModel.reserve.parkImages.length >
  268 + // 0) {
  269 + // if (marketingCenterProvider.markDataModel.reserve.parkImages.length ==
  270 + // 1) {
  271 + // _uploadImageProvider.storeImage1.qiniuUrl =
  272 + // marketingCenterProvider.markDataModel.reserve.parkImages[0];
  273 + // _uploadImageProvider.storeImage1.process = 1;
  274 +
  275 + // imgAll.add(_uploadImageProvider.storeImage1.qiniuUrl);
  276 + // }
  277 + // if (marketingCenterProvider.markDataModel.reserve.parkImages.length ==
  278 + // 2) {
  279 + // _uploadImageProvider.storeImage1.qiniuUrl =
  280 + // marketingCenterProvider.markDataModel.reserve.parkImages[0];
  281 + // _uploadImageProvider.storeImage1.process = 1;
  282 + // _uploadImageProvider.storeImage2.qiniuUrl =
  283 + // marketingCenterProvider.markDataModel.reserve.parkImages[1];
  284 + // _uploadImageProvider.storeImage2.process = 1;
  285 + // imgAll.add(_uploadImageProvider.storeImage1.qiniuUrl);
  286 + // imgAll.add(_uploadImageProvider.storeImage2.qiniuUrl);
  287 + // }
  288 + // }
272 289
273 _uploadImageProvider.logo.qiniuUrl = 290 _uploadImageProvider.logo.qiniuUrl =
274 marketingCenterProvider.markDataModel.marketing.logo ?? null; 291 marketingCenterProvider.markDataModel.marketing.logo ?? null;
@@ -1184,100 +1201,100 @@ class _BookInfoPageState extends State<BookInfoPage> { @@ -1184,100 +1201,100 @@ class _BookInfoPageState extends State<BookInfoPage> {
1184 }); 1201 });
1185 }), 1202 }),
1186 VEmptyView(24), 1203 VEmptyView(24),
1187 - _item('附加停车信息', select: addParking, onTap: () {  
1188 - setState(() {  
1189 - addParking = !addParking;  
1190 - });  
1191 - }),  
1192 - VEmptyView(24),  
1193 - //输入框  
1194 - Container(  
1195 - width: double.infinity,  
1196 - margin: EdgeInsets.symmetric(  
1197 - horizontal: ScreenUtil().setWidth(40)),  
1198 - padding: EdgeInsets.symmetric(  
1199 - horizontal: ScreenUtil().setWidth(40),  
1200 - vertical: ScreenUtil().setWidth(20)),  
1201 - alignment: Alignment.topLeft,  
1202 - decoration: BoxDecoration(  
1203 - color: MyColours.color_ffffff,  
1204 - border: Border.all(  
1205 - color: MyColours.color_DBDBDB,  
1206 - width: ScreenUtil().setWidth(2)),  
1207 - borderRadius: BorderRadius.circular(  
1208 - ScreenUtil().setWidth(20))),  
1209 - child: TextField(  
1210 - controller: parkingIncoC,  
1211 - focusNode: parkingIncoNode,  
1212 - style: TextStyle(  
1213 - color: MyColours.color_515151,  
1214 - fontSize: ScreenUtil().setSp(28),  
1215 - textBaseline: TextBaseline.alphabetic),  
1216 - textAlignVertical: TextAlignVertical.center,  
1217 - maxLines: 5,  
1218 - maxLength: 100,  
1219 - decoration: InputDecoration(  
1220 - hintText: "点击录入停车信息,最多38个汉字。",  
1221 - hintStyle: TextStyle(  
1222 - color: MyColours.color_999999,  
1223 - fontSize: ScreenUtil().setSp(28),  
1224 - ),  
1225 - contentPadding: EdgeInsets.zero,  
1226 - border: OutlineInputBorder(  
1227 - borderSide: BorderSide.none),  
1228 - ),  
1229 - keyboardType: TextInputType.multiline,  
1230 - onChanged: (value) {  
1231 - setState(() {  
1232 - // currentRemark = value ?? "";  
1233 - });  
1234 - }),  
1235 - ), 1204 + // _item('附加停车信息', select: addParking, onTap: () {
  1205 + // setState(() {
  1206 + // addParking = !addParking;
  1207 + // });
  1208 + // }),
  1209 + // VEmptyView(24),
  1210 + // //输入框
  1211 + // Container(
  1212 + // width: double.infinity,
  1213 + // margin: EdgeInsets.symmetric(
  1214 + // horizontal: ScreenUtil().setWidth(40)),
  1215 + // padding: EdgeInsets.symmetric(
  1216 + // horizontal: ScreenUtil().setWidth(40),
  1217 + // vertical: ScreenUtil().setWidth(20)),
  1218 + // alignment: Alignment.topLeft,
  1219 + // decoration: BoxDecoration(
  1220 + // color: MyColours.color_ffffff,
  1221 + // border: Border.all(
  1222 + // color: MyColours.color_DBDBDB,
  1223 + // width: ScreenUtil().setWidth(2)),
  1224 + // borderRadius: BorderRadius.circular(
  1225 + // ScreenUtil().setWidth(20))),
  1226 + // child: TextField(
  1227 + // controller: parkingIncoC,
  1228 + // focusNode: parkingIncoNode,
  1229 + // style: TextStyle(
  1230 + // color: MyColours.color_515151,
  1231 + // fontSize: ScreenUtil().setSp(28),
  1232 + // textBaseline: TextBaseline.alphabetic),
  1233 + // textAlignVertical: TextAlignVertical.center,
  1234 + // maxLines: 5,
  1235 + // maxLength: 100,
  1236 + // decoration: InputDecoration(
  1237 + // hintText: "点击录入停车信息,最多38个汉字。",
  1238 + // hintStyle: TextStyle(
  1239 + // color: MyColours.color_999999,
  1240 + // fontSize: ScreenUtil().setSp(28),
  1241 + // ),
  1242 + // contentPadding: EdgeInsets.zero,
  1243 + // border: OutlineInputBorder(
  1244 + // borderSide: BorderSide.none),
  1245 + // ),
  1246 + // keyboardType: TextInputType.multiline,
  1247 + // onChanged: (value) {
  1248 + // setState(() {
  1249 + // // currentRemark = value ?? "";
  1250 + // });
  1251 + // }),
  1252 + // ),
1236 1253
1237 - VEmptyView(24), 1254 + // VEmptyView(24),
1238 1255
1239 - Column(  
1240 - children: [  
1241 - for (ChangeModel item in data)  
1242 - Padding(  
1243 - padding: EdgeInsets.only(  
1244 - bottom: w(9), left: w(20), right: w(20)),  
1245 - child: ImgPickerInvitationWidget(  
1246 - // scrollController: controller,  
1247 - model: _uploadImageProvider,  
1248 - index: item.index,  
1249 - imageModel: item.image,  
1250 - height: 190,  
1251 - callback: () {  
1252 - if (item.index == 5) {  
1253 - imgAll.add(_uploadImageProvider  
1254 - .storeImage1.qiniuUrl);  
1255 - } else if (item.index == 6) {  
1256 - imgAll.add(_uploadImageProvider  
1257 - .storeImage2.qiniuUrl);  
1258 - }  
1259 -  
1260 - //完成  
1261 - },  
1262 - deleteCallback: () {  
1263 - item.image.qiniuUrl = null;  
1264 - item.image.file = null;  
1265 - item.image.isUpload = false;  
1266 - item.image.process = 0;  
1267 - setState(() {});  
1268 - })),  
1269 - ],  
1270 - ),  
1271 - VEmptyView(24),  
1272 - Padding(  
1273 - padding: EdgeInsets.symmetric(horizontal: w(20)),  
1274 - child: MyDivider(  
1275 - double.infinity,  
1276 - w(0.5),  
1277 - color: MyColours.color_DBDBDB,  
1278 - )), 1256 + // Column(
  1257 + // children: [
  1258 + // for (ChangeModel item in data)
  1259 + // Padding(
  1260 + // padding: EdgeInsets.only(
  1261 + // bottom: w(9), left: w(20), right: w(20)),
  1262 + // child: ImgPickerInvitationWidget(
  1263 + // // scrollController: controller,
  1264 + // model: _uploadImageProvider,
  1265 + // index: item.index,
  1266 + // imageModel: item.image,
  1267 + // height: 190,
  1268 + // callback: () {
  1269 + // if (item.index == 5) {
  1270 + // imgAll.add(_uploadImageProvider
  1271 + // .storeImage1.qiniuUrl);
  1272 + // } else if (item.index == 6) {
  1273 + // imgAll.add(_uploadImageProvider
  1274 + // .storeImage2.qiniuUrl);
  1275 + // }
  1276 +
  1277 + // //完成
  1278 + // },
  1279 + // deleteCallback: () {
  1280 + // item.image.qiniuUrl = null;
  1281 + // item.image.file = null;
  1282 + // item.image.isUpload = false;
  1283 + // item.image.process = 0;
  1284 + // setState(() {});
  1285 + // })),
  1286 + // ],
  1287 + // ),
  1288 + // VEmptyView(24),
  1289 + // Padding(
  1290 + // padding: EdgeInsets.symmetric(horizontal: w(20)),
  1291 + // child: MyDivider(
  1292 + // double.infinity,
  1293 + // w(0.5),
  1294 + // color: MyColours.color_DBDBDB,
  1295 + // )),
1279 1296
1280 - VEmptyView(24), 1297 + // VEmptyView(24),
1281 _item('附加语音欢迎致辞', select: addVoiceInfo, onTap: () { 1298 _item('附加语音欢迎致辞', select: addVoiceInfo, onTap: () {
1282 setState(() { 1299 setState(() {
1283 addVoiceInfo = !addVoiceInfo; 1300 addVoiceInfo = !addVoiceInfo;
@@ -1618,18 +1635,18 @@ class _BookInfoPageState extends State<BookInfoPage> { @@ -1618,18 +1635,18 @@ class _BookInfoPageState extends State<BookInfoPage> {
1618 return false; 1635 return false;
1619 } 1636 }
1620 1637
1621 - if (addParking && parkingIncoC.text.trim().length == 0) {  
1622 - Utils.showToast('请输入停车信息!');  
1623 - return false;  
1624 - } 1638 + // if (addParking && parkingIncoC.text.trim().length == 0) {
  1639 + // Utils.showToast('请输入停车信息!');
  1640 + // return false;
  1641 + // }
1625 if (addVoiceInfo && voiceIncoC.text.trim().length == 0) { 1642 if (addVoiceInfo && voiceIncoC.text.trim().length == 0) {
1626 Utils.showToast('请输入语音欢迎致辞!'); 1643 Utils.showToast('请输入语音欢迎致辞!');
1627 return false; 1644 return false;
1628 } 1645 }
1629 - if (addParking && parkingIncoC.text.trim().length == 0) {  
1630 - Utils.showToast('请输入停车信息!');  
1631 - return false;  
1632 - } 1646 + // if (addParking && parkingIncoC.text.trim().length == 0) {
  1647 + // Utils.showToast('请输入停车信息!');
  1648 + // return false;
  1649 + // }
1633 1650
1634 if (addFirstImage && 1651 if (addFirstImage &&
1635 _uploadImageProvider.firstImage.process < 1 && 1652 _uploadImageProvider.firstImage.process < 1 &&
@@ -1647,38 +1664,38 @@ class _BookInfoPageState extends State<BookInfoPage> { @@ -1647,38 +1664,38 @@ class _BookInfoPageState extends State<BookInfoPage> {
1647 Utils.showToast('正在上传餐厅logo,请稍等!'); 1664 Utils.showToast('正在上传餐厅logo,请稍等!');
1648 return false; 1665 return false;
1649 } 1666 }
1650 - if ((_uploadImageProvider.storeImage1.process < 1 &&  
1651 - _uploadImageProvider.storeImage1.process > 0) ||  
1652 - (_uploadImageProvider.storeImage2.process < 1 &&  
1653 - _uploadImageProvider.storeImage2.process > 0)) {  
1654 - Utils.showToast('正在上传停车信息图片,请稍等!');  
1655 - return false;  
1656 - } 1667 + // if ((_uploadImageProvider.storeImage1.process < 1 &&
  1668 + // _uploadImageProvider.storeImage1.process > 0) ||
  1669 + // (_uploadImageProvider.storeImage2.process < 1 &&
  1670 + // _uploadImageProvider.storeImage2.process > 0)) {
  1671 + // Utils.showToast('正在上传停车信息图片,请稍等!');
  1672 + // return false;
  1673 + // }
1657 1674
1658 - List<String> images = []; 1675 + // List<String> images = [];
1659 1676
1660 - for (int i = 0; i < data.length; i++) {  
1661 - ChangeModel imgModel = data[i];  
1662 - if (imgModel.image.qiniuUrl != null &&  
1663 - imgModel.image.qiniuUrl != '') {  
1664 - images.add(imgModel.image.qiniuUrl);  
1665 - }  
1666 - } 1677 + // for (int i = 0; i < data.length; i++) {
  1678 + // ChangeModel imgModel = data[i];
  1679 + // if (imgModel.image.qiniuUrl != null &&
  1680 + // imgModel.image.qiniuUrl != '') {
  1681 + // images.add(imgModel.image.qiniuUrl);
  1682 + // }
  1683 + // }
1667 1684
1668 //接口 1685 //接口
1669 Map reserveData = { 1686 Map reserveData = {
1670 'swich_phone': addPhone ? '1' : '0', 1687 'swich_phone': addPhone ? '1' : '0',
1671 'swich_manager': addManager ? '1' : '0', 1688 'swich_manager': addManager ? '1' : '0',
1672 - 'swich_park': addParking ? '1' : '0', 1689 + // 'swich_park': addParking ? '1' : '0',
1673 'swich_booking': addBookingInfo ? '1' : '0', 1690 'swich_booking': addBookingInfo ? '1' : '0',
1674 'swich_voice': addVoiceInfo ? '1' : '0', 1691 'swich_voice': addVoiceInfo ? '1' : '0',
1675 - 'park_info': parkingIncoC.text, 1692 + // 'park_info': parkingIncoC.text,
1676 'book_info': bookingIncoC.text, 1693 'book_info': bookingIncoC.text,
1677 'voice_info': voiceIncoC.text, 1694 'voice_info': voiceIncoC.text,
1678 'swich_welcome': addWelcome ? '1' : '0', 1695 'swich_welcome': addWelcome ? '1' : '0',
1679 'swich_slogan': addSlogan ? '1' : '0', 1696 'swich_slogan': addSlogan ? '1' : '0',
1680 - 'park_info_images':  
1681 - images.length > 0 ? json.encode(images) : null, 1697 + // 'park_info_images':
  1698 + // images.length > 0 ? json.encode(images) : null,
1682 'swich_customer': addCutomer ? '1' : '0' 1699 'swich_customer': addCutomer ? '1' : '0'
1683 // 'seller_name': sellername, 1700 // 'seller_name': sellername,
1684 // 'date': dateValue, 1701 // 'date': dateValue,
@@ -1755,7 +1772,7 @@ class _BookInfoPageState extends State<BookInfoPage> { @@ -1755,7 +1772,7 @@ class _BookInfoPageState extends State<BookInfoPage> {
1755 // imgAll和images 比较,挑出不一样的,删除七牛云 1772 // imgAll和images 比较,挑出不一样的,删除七牛云
1756 1773
1757 List<String> delImgs = []; 1774 List<String> delImgs = [];
1758 - delImgs.addAll(images); 1775 + // delImgs.addAll(images);
1759 delImgs.add(_uploadImageProvider.firstImage.qiniuUrl); 1776 delImgs.add(_uploadImageProvider.firstImage.qiniuUrl);
1760 delImgs.add(_uploadImageProvider.logo.qiniuUrl); 1777 delImgs.add(_uploadImageProvider.logo.qiniuUrl);
1761 Set<String> difference = Set.from(imgAll) 1778 Set<String> difference = Set.from(imgAll)
  1 +import 'dart:async';
1 import 'dart:convert'; 2 import 'dart:convert';
2 import 'dart:io'; 3 import 'dart:io';
3 4
  5 +import 'package:dio/dio.dart';
4 import 'package:flutter/material.dart'; 6 import 'package:flutter/material.dart';
  7 +import 'package:flutter/services.dart';
5 import 'package:flutter_keyboard_visibility/flutter_keyboard_visibility.dart'; 8 import 'package:flutter_keyboard_visibility/flutter_keyboard_visibility.dart';
6 import 'package:flutter_native_image/flutter_native_image.dart'; 9 import 'package:flutter_native_image/flutter_native_image.dart';
7 import 'package:flutter_screenutil/flutter_screenutil.dart'; 10 import 'package:flutter_screenutil/flutter_screenutil.dart';
8 -import 'package:image_picker/image_picker.dart'; 11 +import 'package:one_key/utils/video_utils.dart';
9 import 'package:one_key/widgets/v_empty_view.dart'; 12 import 'package:one_key/widgets/v_empty_view.dart';
10 import 'package:permission_handler/permission_handler.dart'; 13 import 'package:permission_handler/permission_handler.dart';
11 import 'package:provider/provider.dart'; 14 import 'package:provider/provider.dart';
  15 +import 'package:video_compress/video_compress.dart';
  16 +import 'package:video_thumbnail/video_thumbnail.dart';
12 17
13 import '../../../../app.dart'; 18 import '../../../../app.dart';
  19 +import '../../../../models/addition_model.dart';
  20 +import '../../../../models/reserve_img_text.dart';
  21 +import '../../../../models/set_seller_info_model.dart';
14 import '../../../../models/upload_img_model.dart'; 22 import '../../../../models/upload_img_model.dart';
  23 +import '../../../../provider/base_info_provider.dart';
15 import '../../../../provider/marketing_center_provider.dart'; 24 import '../../../../provider/marketing_center_provider.dart';
  25 +import '../../../../provider/store_base_info_provider.dart';
16 import '../../../../provider/upload_img_provider.dart'; 26 import '../../../../provider/upload_img_provider.dart';
17 import '../../../../provider/user_model.dart'; 27 import '../../../../provider/user_model.dart';
18 import '../../../../res/colors.dart'; 28 import '../../../../res/colors.dart';
19 -import '../../../../utils/dialog_util.dart'; 29 +import '../../../../route/navigator_util.dart';
20 import '../../../../utils/screen_util.dart'; 30 import '../../../../utils/screen_util.dart';
21 import '../../../../utils/upload_image_util.dart'; 31 import '../../../../utils/upload_image_util.dart';
22 import '../../../../utils/utils.dart'; 32 import '../../../../utils/utils.dart';
23 import '../../../../widgets/MyDivider.dart'; 33 import '../../../../widgets/MyDivider.dart';
24 import '../../../../widgets/common_button_flat.dart'; 34 import '../../../../widgets/common_button_flat.dart';
  35 +import '../../../../widgets/h_empty_view.dart';
25 import '../../../../widgets/round_button.dart'; 36 import '../../../../widgets/round_button.dart';
26 import '../../../../widgets/system_app_bar.dart'; 37 import '../../../../widgets/system_app_bar.dart';
  38 +import '../../../online_check/progress.dart';
  39 +import 'img_picker_invitation_widget.dart';
  40 +import 'package:image_picker/image_picker.dart';
27 41
28 /*** 42 /***
29 * 43 *
30 * 44 *
31 - * 主厨介绍 45 + * 店铺介绍
32 */ 46 */
33 47
  48 +// class ChangeModel {
  49 +// int index; //顺序
  50 +// UploadImgModel image;
  51 +
  52 +// // ChangeModel();
  53 +
  54 +// // factory ChangeModel.fromJson(Map<String, dynamic> json) => ChangeModel()
  55 +// // ..content = json["content"]
  56 +// // ..type = json["type"];
  57 +// // // ..order = json['order'];
  58 +
  59 +// // Map<String, dynamic> toJson() => <String, dynamic>{
  60 +// // "content": content, "type": type,
  61 +// // // 'order': order
  62 +// // };
  63 +// }
  64 +
34 class ChefIntroducePage extends StatefulWidget { 65 class ChefIntroducePage extends StatefulWidget {
35 ChefIntroducePage({Key key}) : super(key: key); 66 ChefIntroducePage({Key key}) : super(key: key);
36 67
@@ -39,34 +70,43 @@ class ChefIntroducePage extends StatefulWidget { @@ -39,34 +70,43 @@ class ChefIntroducePage extends StatefulWidget {
39 } 70 }
40 71
41 class _ChefIntroducePageState extends State<ChefIntroducePage> { 72 class _ChefIntroducePageState extends State<ChefIntroducePage> {
42 - // int currIndex = 0; //样式按钮默认选中第一个 73 + int currIndex = 0; //样式按钮默认选中第一个
43 74
44 - // String sellername; //店铺名称 75 + String sellername; //店铺名称
45 76
46 - TextEditingController chefIntroduceC = TextEditingController();  
47 - FocusNode chefIntroduceNode = FocusNode(); 77 + TextEditingController storeIntroduceC = TextEditingController();
  78 + FocusNode storeIntroduceNode = FocusNode();
48 79
49 - TextEditingController chefNameC = TextEditingController();  
50 - FocusNode chefNameNode = FocusNode();  
51 -  
52 - final picker = ImagePicker(); 80 + MarketingCenterProvider marketingCenterProvider;
53 81
54 UploadImageProvider _uploadImageProvider; 82 UploadImageProvider _uploadImageProvider;
55 - MarketingCenterProvider _marketingCenterProvider;  
56 - bool addChefIntroduce = false;  
57 - bool addChefImge = false;  
58 - bool addAbove = false; 83 + ScrollController controller = ScrollController();
  84 + bool addStoreIntroduce = false; //预订安排通知中附加餐厅文字介绍
  85 + // bool addStoreImge = false; //预订安排通知中附加餐厅文字图片
  86 + // bool addAbove = false; //餐厅介绍文字显示在第一张图片上
59 87
  88 + // StoreBaseIndoProvider _baseIndoProvider;
  89 +
  90 + List<AdditionModel> data = [];
60 List<String> imgAll = []; 91 List<String> imgAll = [];
  92 + TextEditingController titleC = TextEditingController();
  93 + FocusNode titleCNode = FocusNode();
  94 + final picker = ImagePicker();
  95 +
  96 + Subscription _subscription; //展示压缩进度
  97 +
  98 + bool showCompress = false;
61 99
62 @override 100 @override
63 void initState() { 101 void initState() {
64 super.initState(); 102 super.initState();
65 103
66 WidgetsBinding.instance.addPostFrameCallback((_) async { 104 WidgetsBinding.instance.addPostFrameCallback((_) async {
67 - // UserModel userModel = Provider.of<UserModel>(context, listen: false);  
68 - // sellername = userModel.user.sellername;  
69 - // setState(() {}); 105 + // _initData();
  106 +
  107 + UserModel userModel = Provider.of<UserModel>(context, listen: false);
  108 + sellername = userModel.user.sellername;
  109 + setState(() {});
70 _getQiniuInfo(); 110 _getQiniuInfo();
71 await getSellerTemplateConf(); 111 await getSellerTemplateConf();
72 }); 112 });
@@ -74,10 +114,36 @@ class _ChefIntroducePageState extends State<ChefIntroducePage> { @@ -74,10 +114,36 @@ class _ChefIntroducePageState extends State<ChefIntroducePage> {
74 114
75 @override 115 @override
76 void dispose() { 116 void dispose() {
77 - _uploadImageProvider.firstImage = UploadImgModel(); 117 + // _uploadImageProvider.chefImage1 = UploadImgModel();
  118 + // _uploadImageProvider.chefImage2 = UploadImgModel();
  119 + // _uploadImageProvider.chefImage3 = UploadImgModel();
  120 + // _uploadImageProvider.chefImage4 = UploadImgModel();
  121 +
78 super.dispose(); 122 super.dispose();
79 } 123 }
80 124
  125 + // _initData() {
  126 + // ChangeModel changeModel = ChangeModel();
  127 + // changeModel.index = 5;
  128 + // changeModel.image = _uploadImageProvider.chefImage1;
  129 + // data.add(changeModel);
  130 +
  131 + // ChangeModel changeModel6 = ChangeModel();
  132 + // changeModel6.index = 6;
  133 + // changeModel6.image = _uploadImageProvider.chefImage2;
  134 + // data.add(changeModel6);
  135 +
  136 + // ChangeModel changeModel7 = ChangeModel();
  137 + // changeModel7.index = 7;
  138 + // changeModel7.image = _uploadImageProvider.chefImage3;
  139 + // data.add(changeModel7);
  140 +
  141 + // ChangeModel changeModel8 = ChangeModel();
  142 + // changeModel8.index = 8;
  143 + // changeModel8.image = _uploadImageProvider.chefImage4;
  144 + // data.add(changeModel8);
  145 + // }
  146 +
81 ///获取七牛云token 147 ///获取七牛云token
82 /// 148 ///
83 _getQiniuInfo() async { 149 _getQiniuInfo() async {
@@ -85,50 +151,1044 @@ class _ChefIntroducePageState extends State<ChefIntroducePage> { @@ -85,50 +151,1044 @@ class _ChefIntroducePageState extends State<ChefIntroducePage> {
85 } 151 }
86 152
87 getSellerTemplateConf() async { 153 getSellerTemplateConf() async {
88 - bool success =  
89 - await _marketingCenterProvider.getSellerTemplateConf(context);  
90 - if (success && _marketingCenterProvider.markDataModel.chef != null) {  
91 - // currIndex = int.parse(_marketingCenterProvider.markDataModel.chef.style); 154 + bool success = await marketingCenterProvider.getSellerTemplateConf(context);
  155 + if (success && marketingCenterProvider.markDataModel.chef != null) {
  156 + // currIndex = int.parse(marketingCenterProvider.markDataModel.chef.style);
  157 +
  158 + // _uploadImageProvider.chefImage1.qiniuUrl =
  159 + // marketingCenterProvider.markDataModel.chef.images.length > 0
  160 + // ? marketingCenterProvider.markDataModel.chef.images[0]
  161 + // : null;
  162 +
  163 + // if (_uploadImageProvider.chefImage1.qiniuUrl != null) {
  164 + // imgAll.add(_uploadImageProvider.chefImage1.qiniuUrl);
  165 + // }
  166 + // _uploadImageProvider.chefImage1.process =
  167 + // _uploadImageProvider.chefImage1.qiniuUrl != null &&
  168 + // _uploadImageProvider.chefImage1.qiniuUrl != ''
  169 + // ? 1
  170 + // : null;
  171 + // _uploadImageProvider.chefImage2.qiniuUrl =
  172 + // marketingCenterProvider.markDataModel.chef.images.length > 1
  173 + // ? marketingCenterProvider.markDataModel.chef.images[1]
  174 + // : null;
  175 + // if (_uploadImageProvider.chefImage2.qiniuUrl != null) {
  176 + // imgAll.add(_uploadImageProvider.chefImage2.qiniuUrl);
  177 + // }
  178 + // _uploadImageProvider.chefImage2.process =
  179 + // _uploadImageProvider.chefImage2.qiniuUrl != null &&
  180 + // _uploadImageProvider.chefImage2.qiniuUrl != ''
  181 + // ? 1
  182 + // : null;
  183 + // _uploadImageProvider.chefImage3.qiniuUrl =
  184 + // marketingCenterProvider.markDataModel.chef.images.length > 2
  185 + // ? marketingCenterProvider.markDataModel.chef.images[2]
  186 + // : null;
  187 + // if (_uploadImageProvider.chefImage3.qiniuUrl != null) {
  188 + // imgAll.add(_uploadImageProvider.chefImage3.qiniuUrl);
  189 + // }
  190 + // _uploadImageProvider.chefImage3.process =
  191 + // _uploadImageProvider.chefImage3.qiniuUrl != null &&
  192 + // _uploadImageProvider.chefImage3.qiniuUrl != ''
  193 + // ? 1
  194 + // : null;
  195 + // _uploadImageProvider.chefImage4.qiniuUrl =
  196 + // marketingCenterProvider.markDataModel.chef.images.length > 3
  197 + // ? marketingCenterProvider.markDataModel.chef.images[3]
  198 + // : null;
  199 + // if (_uploadImageProvider.chefImage4.qiniuUrl != null) {
  200 + // imgAll.add(_uploadImageProvider.chefImage4.qiniuUrl);
  201 + // }
  202 + // _uploadImageProvider.chefImage4.process =
  203 + // _uploadImageProvider.chefImage4.qiniuUrl != null &&
  204 + // _uploadImageProvider.chefImage4.qiniuUrl != ''
  205 + // ? 1
  206 + // : null;
  207 + if (marketingCenterProvider.markDataModel.chef.content == null) {
  208 + //以前么有设置过,默认值
  209 + titleC.text = '主厨介绍';
  210 +
  211 + if (marketingCenterProvider.markDataModel.chef.introduce
  212 + .trim()
  213 + .length >
  214 + 0) {
  215 + //文字
  216 +
  217 + AdditionModel additionModel = AdditionModel();
  218 + additionModel.content =
  219 + marketingCenterProvider.markDataModel.chef.introduce;
  220 + additionModel.infoC.text =
  221 + marketingCenterProvider.markDataModel.chef.introduce;
  222 + additionModel.type = '2';
  223 +
  224 + data.add(additionModel);
  225 + }
  226 + if (marketingCenterProvider.markDataModel.chef.image != null &&marketingCenterProvider.markDataModel.chef.image.length > 0) {
  227 + //设置过图片
  228 + for (int i = 0;
  229 + i < marketingCenterProvider.markDataModel.chef.image.length;
  230 + i++) {
  231 + String imageUrl =
  232 + marketingCenterProvider.markDataModel.chef.image[i];
  233 + AdditionModel additionModel = AdditionModel();
  234 + additionModel.content = imageUrl;
  235 + additionModel.type = '1';
  236 +
  237 + additionModel.image = UploadImgModel();
  238 + additionModel.image.process = 1;
  239 + additionModel.image.qiniuUrl = imageUrl;
  240 + data.add(additionModel);
  241 +
  242 + imgAll.add(imageUrl);
  243 + }
  244 + }
  245 + } else {
  246 + addStoreIntroduce =
  247 + marketingCenterProvider.markDataModel.chef.isIntroduceAll == '1'
  248 + ? true
  249 + : false;
  250 + titleC.text = marketingCenterProvider.markDataModel.chef.title;
  251 + for (int i = 0;
  252 + i < marketingCenterProvider.markDataModel.chef.content.length;
  253 + i++) {
  254 + ContentModel contentModel =
  255 + marketingCenterProvider.markDataModel.chef.content[i];
  256 + if (contentModel.type == '1') {
  257 + //图片
  258 + AdditionModel additionModel = AdditionModel();
  259 + additionModel.content = contentModel.content;
  260 + additionModel.type = '1';
  261 +
  262 + additionModel.image = UploadImgModel();
  263 + additionModel.image.process = 1;
  264 + additionModel.image.qiniuUrl = contentModel.content;
  265 + data.add(additionModel);
  266 +
  267 + imgAll.add(contentModel.content);
  268 + } else if (contentModel.type == '2') {
  269 + //文本
  270 + AdditionModel additionModel = AdditionModel();
  271 + additionModel.content = contentModel.content;
  272 + additionModel.infoC.text = contentModel.content;
  273 + additionModel.type = contentModel.type;
92 274
93 - _uploadImageProvider.firstImage.qiniuUrl =  
94 - _marketingCenterProvider.markDataModel.chef.image ?? null; 275 + data.add(additionModel);
  276 + } else {
  277 + //视频
  278 + AdditionModel additionModel = AdditionModel();
  279 + String thumbnailPathString =
  280 + await VideoUtils.getThumbnailFile(contentModel.content);
  281 + File thumbnailPath = File(thumbnailPathString); //封面
  282 + additionModel.content = contentModel.content;
  283 + additionModel.type = '3';
95 284
96 - if (_uploadImageProvider.firstImage.qiniuUrl != null) {  
97 - imgAll.add(_uploadImageProvider.firstImage.qiniuUrl); 285 + additionModel.image = UploadImgModel();
  286 + additionModel.image.process = 1;
  287 + additionModel.image.duration = contentModel.duration;
  288 + additionModel.image.thumbnailPath = thumbnailPath;
  289 + additionModel.image.qiniuUrl = contentModel.content;
  290 + data.add(additionModel);
  291 +
  292 + imgAll.add(contentModel.content);
  293 + }
  294 + }
98 } 295 }
  296 + }
99 297
100 - _uploadImageProvider.firstImage.process =  
101 - _uploadImageProvider.firstImage.qiniuUrl != null &&  
102 - _uploadImageProvider.firstImage.qiniuUrl != ''  
103 - ? 1  
104 - : null;  
105 -  
106 - chefNameC.text = _marketingCenterProvider.markDataModel.chef.chefName;  
107 - chefIntroduceC.text =  
108 - _marketingCenterProvider.markDataModel.chef.introduce;  
109 - addChefIntroduce =  
110 - _marketingCenterProvider.markDataModel.chef.isIntroduce == '1'  
111 - ? true  
112 - : false;  
113 - addChefImge = _marketingCenterProvider.markDataModel.chef.isImages == '1'  
114 - ? true  
115 - : false;  
116 - addAbove = _marketingCenterProvider.markDataModel.chef.isAbove == '1'  
117 - ? true  
118 - : false; 298 + // addStoreImge = marketingCenterProvider.markDataModel.chef.isImages == '1'
  299 + // ? true
  300 + // : false;
  301 + // addAbove = marketingCenterProvider.markDataModel.chef.isAbove == '1'
  302 + // ? true
  303 + // : false;
119 304
120 - setState(() {}); 305 + setState(() {});
  306 + }
  307 +
  308 + ///图文合并,图文分开,无文字
  309 + // Widget _selectBtnWidget() {
  310 + // return Container(
  311 + // decoration: BoxDecoration(
  312 + // border: Border(
  313 + // bottom:
  314 + // BorderSide(color: MyColours.color_E7E7E7, width: w(0.5)))),
  315 + // margin: EdgeInsets.only(left: w(16)),
  316 + // padding: EdgeInsets.only(top: w(12), bottom: w(12), right: w(16)),
  317 + // child: Row(
  318 + // mainAxisAlignment: MainAxisAlignment.spaceBetween,
  319 + // children: [
  320 + // Text(
  321 + // '附加餐厅介绍',
  322 + // style: TextStyle(
  323 + // color: MyColours.color_515151,
  324 + // fontSize: ScreenUtil().setWidth(32)),
  325 + // ),
  326 + // Container(
  327 + // height: ScreenUtil().setWidth(74),
  328 + // decoration: BoxDecoration(
  329 + // color: Color.fromRGBO(232, 232, 232, 1),
  330 + // borderRadius: BorderRadius.circular(
  331 + // r(11),
  332 + // ),
  333 + // // border: Border.all(
  334 + // // width: w(1), color: MyColours.color_438E93),
  335 + // ),
  336 + // child: Row(
  337 + // // mainAxisAlignment: MainAxisAlignment.spaceEvenly,
  338 + // // crossAxisAlignment: CrossAxisAlignment.center,
  339 + // children: <Widget>[
  340 + // CommonButtonFlat(
  341 + // content: "无文字",
  342 + // state: currIndex == 0 ? 1 : 0,
  343 + // fontSize: 28,
  344 + // right: false,
  345 + // width: w(52),
  346 + // onPress: () {
  347 + // if (currIndex == 0) return;
  348 + // setState(() {
  349 + // currIndex = 0;
  350 + // });
  351 + // },
  352 + // ),
  353 + // currIndex == 2
  354 + // ? MyDivider(
  355 + // ScreenUtil().setWidth(4),
  356 + // ScreenUtil().setWidth(46),
  357 + // color: MyColours.color_dfdfdf,
  358 + // )
  359 + // : SizedBox(),
  360 + // CommonButtonFlat(
  361 + // content: "图文合并",
  362 + // state: currIndex == 1 ? 1 : 0,
  363 + // fontSize: 28,
  364 + // width: w(66),
  365 + // left: false,
  366 + // right: false,
  367 + // onPress: () {
  368 + // if (currIndex == 1) return;
  369 + // setState(() {
  370 + // currIndex = 1;
  371 + // });
  372 + // },
  373 + // ),
  374 + // currIndex == 0
  375 + // ? MyDivider(
  376 + // ScreenUtil().setWidth(4),
  377 + // ScreenUtil().setWidth(46),
  378 + // color: MyColours.color_dfdfdf,
  379 + // )
  380 + // : SizedBox(),
  381 + // Container(
  382 + // child: CommonButtonFlat(
  383 + // content: "图文分开",
  384 + // left: false,
  385 + // state: currIndex == 2 ? 1 : 0,
  386 + // fontSize: 28,
  387 + // width: w(66),
  388 + // onPress: () {
  389 + // if (currIndex == 2) return;
  390 + // setState(() {
  391 + // currIndex = 2;
  392 + // });
  393 + // },
  394 + // )),
  395 + // ],
  396 + // ),
  397 + // ),
  398 + // ],
  399 + // ));
  400 + // }
  401 +
  402 + // Widget _introduceWidget(EdgeInsets edgeInsets,
  403 + // {double width = double.infinity,
  404 + // Color textColor = MyColours.color_515151,
  405 + // Color hintColor = MyColours.color_999999,
  406 + // BoxDecoration boxDecoration}) {
  407 + // return Container(
  408 + // width: width,
  409 + // alignment: Alignment.centerLeft,
  410 + // padding: edgeInsets,
  411 + // decoration: boxDecoration,
  412 + // child: Column(
  413 + // crossAxisAlignment: CrossAxisAlignment.start,
  414 + // children: [
  415 + // Text(
  416 + // 'Introduce',
  417 + // style: TextStyle(color: MyColours.color_B39437, fontSize: font(14)),
  418 + // ),
  419 + // Text(
  420 + // '品牌介绍',
  421 + // style: TextStyle(color: MyColours.color_B39437, fontSize: font(14)),
  422 + // ),
  423 + // VEmptyView(16),
  424 + // Text(
  425 + // '${sellername}',
  426 + // style: TextStyle(color: textColor, fontSize: font(14)),
  427 + // ),
  428 + // VEmptyView(32),
  429 + // Container(
  430 + // width: double.infinity,
  431 + // // margin: EdgeInsets.symmetric(horizontal: w(10)),
  432 + // // padding: EdgeInsets.symmetric(horizontal: w(6)),
  433 + // decoration: BoxDecoration(
  434 + // border: Border(
  435 + // left: BorderSide(
  436 + // width: w(2), color: MyColours.color_EEAE74))),
  437 + // child: Container(
  438 + // width: double.infinity,
  439 + // padding: EdgeInsets.symmetric(
  440 + // horizontal: ScreenUtil().setWidth(12),
  441 + // ),
  442 + // alignment: Alignment.topLeft,
  443 + // child: TextField(
  444 + // textAlign: TextAlign.left,
  445 + // controller: storeIntroduceC,
  446 + // focusNode: storeIntroduceNode,
  447 + // style: TextStyle(
  448 + // height: 2,
  449 + // color: textColor,
  450 + // fontSize: ScreenUtil().setSp(20),
  451 + // textBaseline: TextBaseline.alphabetic),
  452 + // textAlignVertical: TextAlignVertical.center,
  453 + // maxLines: 7,
  454 + // decoration: InputDecoration(
  455 + // hintText: "点这里录入餐厅介绍文字",
  456 + // hintStyle: TextStyle(
  457 + // color: hintColor,
  458 + // fontSize: ScreenUtil().setSp(20),
  459 + // ),
  460 + // contentPadding: EdgeInsets.zero,
  461 + // border: OutlineInputBorder(borderSide: BorderSide.none),
  462 + // ),
  463 + // keyboardType: TextInputType.multiline,
  464 + // textInputAction: TextInputAction.newline,
  465 + // onChanged: (value) {
  466 + // setState(() {
  467 + // // currentRemark = value ?? "";
  468 + // });
  469 + // }),
  470 + // )),
  471 + // ],
  472 + // ),
  473 + // );
  474 + // }
  475 +
  476 + // ///无文字
  477 + // Widget _noTextWidget() {
  478 + // return Column(
  479 + // children: [
  480 + // ImgPickerInvitationWidget(
  481 + // scrollController: controller,
  482 + // uploadType: UploadType.InvitationStoreType,
  483 + // model: _uploadImageProvider,
  484 + // index: 5,
  485 + // imageModel: _uploadImageProvider.chefImage1,
  486 + // deleteCallback: () {
  487 + // _uploadImageProvider.chefImage1.qiniuUrl = null;
  488 + // _uploadImageProvider.chefImage1.file = null;
  489 + // _uploadImageProvider.chefImage1.isUpload = false;
  490 + // _uploadImageProvider.chefImage1.process = 0;
  491 + // setState(() {});
  492 + // }),
  493 + // VEmptyView(18),
  494 + // ImgPickerInvitationWidget(
  495 + // scrollController: controller,
  496 + // uploadType: UploadType.InvitationStoreType,
  497 + // model: _uploadImageProvider,
  498 + // index: 6,
  499 + // imageModel: _uploadImageProvider.chefImage2,
  500 + // deleteCallback: () {
  501 + // _uploadImageProvider.chefImage2.qiniuUrl = null;
  502 + // _uploadImageProvider.chefImage2.file = null;
  503 + // _uploadImageProvider.chefImage2.isUpload = false;
  504 + // _uploadImageProvider.chefImage2.process = 0;
  505 + // setState(() {});
  506 + // }),
  507 + // VEmptyView(18),
  508 + // ImgPickerInvitationWidget(
  509 + // scrollController: controller,
  510 + // uploadType: UploadType.InvitationStoreType,
  511 + // model: _uploadImageProvider,
  512 + // index: 7,
  513 + // imageModel: _uploadImageProvider.chefImage3,
  514 + // deleteCallback: () {
  515 + // _uploadImageProvider.chefImage3.qiniuUrl = null;
  516 + // _uploadImageProvider.chefImage3.file = null;
  517 + // _uploadImageProvider.chefImage3.isUpload = false;
  518 + // _uploadImageProvider.chefImage3.process = 0;
  519 + // setState(() {});
  520 + // }),
  521 + // VEmptyView(18),
  522 + // ImgPickerInvitationWidget(
  523 + // scrollController: controller,
  524 + // model: _uploadImageProvider,
  525 + // index: 8,
  526 + // uploadType: UploadType.InvitationStoreType,
  527 + // imageModel: _uploadImageProvider.chefImage4,
  528 + // deleteCallback: () {
  529 + // _uploadImageProvider.chefImage4.qiniuUrl = null;
  530 + // _uploadImageProvider.chefImage4.file = null;
  531 + // _uploadImageProvider.chefImage4.isUpload = false;
  532 + // _uploadImageProvider.chefImage4.process = 0;
  533 + // setState(() {});
  534 + // }),
  535 + // ],
  536 + // );
  537 + // }
  538 +
  539 + ///图文合并
  540 + // Widget _mergingWidget() {
  541 + // Color themColor = MyColours.color_0C0F0E;
  542 + // int colorValue = null;
  543 + // if (marketingCenterProvider.markDataModel.home != null &&
  544 + // marketingCenterProvider.markDataModel.home.themeColor != null) {
  545 + // colorValue =
  546 + // int.parse(marketingCenterProvider.markDataModel.home.themeColor);
  547 + // }
  548 +
  549 + // if (colorValue != null) {
  550 + // themColor = Color(colorValue);
  551 + // }
  552 + // return Column(
  553 + // children: [
  554 + // Stack(
  555 + // children: [
  556 + // ImgPickerInvitationWidget(
  557 + // scrollController: controller,
  558 + // uploadType: UploadType.InvitationStoreType,
  559 + // model: _uploadImageProvider,
  560 + // index: 5,
  561 + // padding: EdgeInsets.only(left: w(160)),
  562 + // imageModel: _uploadImageProvider.chefImage1),
  563 + // Positioned(
  564 + // child: _introduceWidget(
  565 + // EdgeInsets.only(
  566 + // left: w(15), top: w(23), right: w(7), bottom: w(42)),
  567 + // textColor: MyColours.color_ffffff,
  568 + // hintColor: MyColours.color_ffffff,
  569 + // boxDecoration: BoxDecoration(
  570 + // gradient: LinearGradient(
  571 + // stops: [0, 1],
  572 + // begin: Alignment.topCenter,
  573 + // end: Alignment.bottomCenter,
  574 + // colors: [
  575 + // themColor,
  576 + // MyColours.color_4D0C0F0E,
  577 + // ],
  578 + // ),
  579 + // )),
  580 + // width: w(160),
  581 + // ),
  582 + // ],
  583 + // ),
  584 + // VEmptyView(18),
  585 + // ImgPickerInvitationWidget(
  586 + // scrollController: controller,
  587 + // uploadType: UploadType.InvitationStoreType,
  588 + // model: _uploadImageProvider,
  589 + // index: 6,
  590 + // imageModel: _uploadImageProvider.chefImage2),
  591 + // VEmptyView(18),
  592 + // ImgPickerInvitationWidget(
  593 + // scrollController: controller,
  594 + // uploadType: UploadType.InvitationStoreType,
  595 + // model: _uploadImageProvider,
  596 + // index: 7,
  597 + // imageModel: _uploadImageProvider.chefImage3),
  598 + // VEmptyView(18),
  599 + // ImgPickerInvitationWidget(
  600 + // scrollController: controller,
  601 + // uploadType: UploadType.InvitationStoreType,
  602 + // model: _uploadImageProvider,
  603 + // index: 8,
  604 + // imageModel: _uploadImageProvider.chefImage4),
  605 + // ],
  606 + // );
  607 + // }
  608 +/**
  609 + ///图文分开
  610 + Widget _separateWidget() {
  611 + return ReorderableListView(
  612 + shrinkWrap: true,
  613 + scrollController: controller,
  614 + children: <Widget>[
  615 + // _introduceWidget(EdgeInsets.all(w(15)),
  616 + // boxDecoration: BoxDecoration(color: MyColours.color_ffffff)),
  617 + // VEmptyView(18),
  618 +
  619 + for (ChangeModel item in data)
  620 + Container(
  621 + key: ValueKey(item),
  622 + child: Padding(
  623 + padding:
  624 + EdgeInsets.only(bottom: item.index != 8 ? w(9) : 0),
  625 + child: ImgPickerInvitationWidget(
  626 + scrollController: controller,
  627 + uploadType: UploadType.InvitationStoreType,
  628 + model: _uploadImageProvider,
  629 + index: item.index,
  630 + imageModel: item.image,
  631 + callback: () {
  632 + //完成
  633 + if (item.index == 5) {
  634 + imgAll
  635 + .add(_uploadImageProvider.chefImage1.qiniuUrl);
  636 + } else if (item.index == 6) {
  637 + imgAll
  638 + .add(_uploadImageProvider.chefImage2.qiniuUrl);
  639 + } else if (item.index == 7) {
  640 + imgAll
  641 + .add(_uploadImageProvider.chefImage3.qiniuUrl);
  642 + } else if (item.index == 8) {
  643 + imgAll
  644 + .add(_uploadImageProvider.chefImage4.qiniuUrl);
  645 + }
  646 + },
  647 + deleteCallback: () {
  648 + item.image.qiniuUrl = null;
  649 + item.image.file = null;
  650 + item.image.isUpload = false;
  651 + item.image.process = 0.01;
  652 + setState(() {});
  653 + }))),
  654 +
  655 + // ImgPickerInvitationWidget(
  656 + // scrollController: controller,
  657 + // uploadType: UploadType.InvitationStoreType,
  658 + // model: _uploadImageProvider,
  659 + // index: 6,
  660 + // imageModel: _uploadImageProvider.chefImage2,
  661 + // deleteCallback: () {
  662 + // _uploadImageProvider.chefImage2.qiniuUrl = null;
  663 + // _uploadImageProvider.chefImage2.file = null;
  664 + // _uploadImageProvider.chefImage2.isUpload = false;
  665 + // _uploadImageProvider.chefImage2.process = 0.01;
  666 + // setState(() {});
  667 + // }),
  668 + // VEmptyView(18),
  669 + // ImgPickerInvitationWidget(
  670 + // scrollController: controller,
  671 + // uploadType: UploadType.InvitationStoreType,
  672 + // model: _uploadImageProvider,
  673 + // index: 7,
  674 + // imageModel: _uploadImageProvider.chefImage3,
  675 + // deleteCallback: () {
  676 + // _uploadImageProvider.chefImage3.qiniuUrl = null;
  677 + // _uploadImageProvider.chefImage3.file = null;
  678 + // _uploadImageProvider.chefImage3.isUpload = false;
  679 + // _uploadImageProvider.chefImage3.process = 0.01;
  680 + // setState(() {});
  681 + // }),
  682 + // VEmptyView(18),
  683 + // ImgPickerInvitationWidget(
  684 + // scrollController: controller,
  685 + // uploadType: UploadType.InvitationStoreType,
  686 + // model: _uploadImageProvider,
  687 + // index: 8,
  688 + // imageModel: _uploadImageProvider.chefImage4,
  689 + // deleteCallback: () {
  690 + // _uploadImageProvider.chefImage4.qiniuUrl = null;
  691 + // _uploadImageProvider.chefImage4.file = null;
  692 + // _uploadImageProvider.chefImage4.isUpload = false;
  693 + // _uploadImageProvider.chefImage4.process = 0.01;
  694 + // setState(() {});
  695 + // }),
  696 + ],
  697 + onReorder: (int oldIndex, int newIndex) async {
  698 + if (oldIndex < newIndex) {
  699 + newIndex -= 1;
  700 + }
  701 +
  702 + // var childold = tableManagerModel.areas[oldIndex];
  703 + // Map<String, String> params = {
  704 + // 'sid': Provider.of<UserModel>(context, listen: false)
  705 + // .user
  706 + // .sellerid,
  707 + // 'regionid': childold.rid,
  708 + // 'order_o': tableManagerModel.areas[newIndex].orderId,
  709 + // 'sort': oldIndex < newIndex ? '2' : '1'
  710 + // };
  711 + var child = data.removeAt(oldIndex);
  712 + data.insert(newIndex, child);
  713 + setState(() {});
  714 + // await tableManagerModel.sortByRegion(context, params);
  715 + // //刷新前一页数据
  716 + // bus.emit('refresh_table_area');
  717 + });
  718 + }
  719 + */
  720 +
  721 + ///输入框
  722 + Widget _textfield(String title, String hintText,
  723 + TextEditingController controller, FocusNode focusNode,
  724 + {TextInputType textInputType = TextInputType.text}) {
  725 + return Container(
  726 + decoration: BoxDecoration(
  727 + border: Border(
  728 + bottom:
  729 + BorderSide(color: MyColours.color_E7E7E7, width: w(0.5)))),
  730 + margin: EdgeInsets.only(left: w(16)),
  731 + padding: EdgeInsets.only(top: w(12), bottom: w(4), right: w(16)),
  732 + child: Row(
  733 + mainAxisAlignment: MainAxisAlignment.spaceBetween,
  734 + children: [
  735 + Container(
  736 + height: w(48),
  737 + alignment: Alignment.center,
  738 + child: Text(
  739 + title,
  740 + style: TextStyle(
  741 + color: MyColours.color_515151,
  742 + fontSize: ScreenUtil().setSp(32)),
  743 + ),
  744 + ),
  745 + HEmptyView(80),
  746 + Expanded(
  747 + // width: ScreenUtil().setWidth(231 * 2),
  748 + child: Container(
  749 + // height: w(54),
  750 + child: TextField(
  751 + controller: controller,
  752 + textAlign: TextAlign.right,
  753 + textAlignVertical: TextAlignVertical.bottom,
  754 + maxLines: 1,
  755 + // //光标颜色
  756 + // cursorColor:
  757 + // widget.isSelect ? Colors.white : MyColours.color_199095,
  758 + //输入文本的样式
  759 + inputFormatters: title == '标题名称'
  760 + ? [LengthLimitingTextInputFormatter(15)]
  761 + : [],
  762 + style: TextStyle(
  763 + color: MyColours.color_515151,
  764 + fontSize: ScreenUtil().setSp(32),
  765 + ),
  766 + focusNode: focusNode,
  767 + decoration: InputDecoration(
  768 + isCollapsed: true, //重点,相当于高度包裹的意思,必须设置为true,不然有默认奇妙的最小高度
  769 + border: OutlineInputBorder(borderSide: BorderSide.none),
  770 + hintText: hintText,
  771 + hintStyle: TextStyle(
  772 + color: MyColours.color_999999,
  773 + fontSize: ScreenUtil().setSp(32),
  774 + ),
  775 + enabledBorder: new UnderlineInputBorder(
  776 + borderSide: BorderSide.none,
  777 + ),
  778 + focusedBorder: new UnderlineInputBorder(
  779 + borderSide: BorderSide.none,
  780 + ),
  781 + ),
  782 + onChanged: (value) {},
  783 + onEditingComplete: () {
  784 + FocusScope.of(context).requestFocus(FocusNode()); //点击空白处隐藏键盘
  785 + },
  786 + keyboardType: textInputType),
  787 + )),
  788 + // HEmptyView(32)
  789 + ],
  790 + ),
  791 + );
  792 + }
  793 +
  794 + Widget _item(String title, {bool select, GestureTapCallback onTap}) {
  795 + return InkWell(
  796 + onTap: onTap,
  797 + child: Container(
  798 + decoration: BoxDecoration(
  799 + border: Border(
  800 + bottom: BorderSide(
  801 + color: MyColours.color_E7E7E7, width: w(0.5)))),
  802 + margin: EdgeInsets.only(left: w(16)),
  803 + padding: EdgeInsets.only(top: w(12), bottom: w(12), right: w(16)),
  804 + child: Row(
  805 + children: [
  806 + Text(
  807 + title,
  808 + style: TextStyle(
  809 + color: MyColours.color_515151,
  810 + fontSize: ScreenUtil().setWidth(32)),
  811 + ),
  812 + Spacer(),
  813 + Container(
  814 + padding:
  815 + EdgeInsets.symmetric(horizontal: w(7), vertical: w(4)),
  816 + child: Image.asset(
  817 + Utils.getImgPath(select ? 'swich_on' : 'swich_off'),
  818 + width: w(44),
  819 + ),
  820 + )
  821 + ],
  822 + )));
  823 + }
  824 +
  825 + /// 修改店铺基本信息
  826 + // _setSellerInfoById(String text) async {
  827 + // Map<String, dynamic> params = {
  828 + // 'id': Provider.of<UserModel>(context, listen: false).user.sellerid,
  829 + // };
  830 +
  831 + // params['sellerdesc'] = text;
  832 +
  833 + // FormData formData = FormData.fromMap(params);
  834 +
  835 + // SetSellerInfoSunModel sunModel =
  836 + // await _baseIndoProvider.setSellerInfoById(context, formData);
  837 + // if (sunModel != null) {
  838 + // //修改成功
  839 + // // Utils.showToast('保存店铺信息成功');
  840 + // // EventBus().emit('changeStatusColor');
  841 +
  842 + // } else {
  843 + // // Utils.showToast('保存失败');
  844 + // }
  845 + // }
  846 +
  847 + List<Widget> _scrolleWidget() {
  848 + List<Widget> temp = [];
  849 + for (AdditionModel item in data) {
  850 + if (item.type == '1') {
  851 + //图片
  852 + if (item.image.qiniuUrl == null && item.image.file == null) {
  853 + } else {
  854 + temp.add(Container(
  855 + key: ValueKey(item),
  856 + margin: EdgeInsets.only(bottom: w(12)),
  857 + child: InkWell(
  858 + onTap: () {
  859 + // double process;
  860 + // String qiniuUrl;
  861 + // List<String> tempList = [];
  862 + // // if (title == '头像') {
  863 + // process = item.image.process;
  864 + // qiniuUrl = item.image.qiniuUrl;
  865 + // // } else {
  866 + // // process = _uploadImageProvider.erweima.process;
  867 + // // qiniuUrl = _uploadImageProvider.erweima.qiniuUrl;
  868 + // // }
  869 +
  870 + // if (qiniuUrl != null &&
  871 + // qiniuUrl != '') {
  872 + // // tempList.add(qiniuUrl);
  873 +
  874 + // // ///没有上传完成的不可以点击
  875 + // // _showPhotoView(context, 0, tempList);
  876 +
  877 + // // _uploadImageProvider.firstImage.qiniuUrl = null;
  878 + // // _uploadImageProvider.firstImage.process = 0;
  879 + // // setState(() {});
  880 + // _openModalBottomSheet(context);
  881 + // // Utils.getPickPermission(context, () {
  882 + // // _getFromPictureOrCamera(
  883 + // // _uploadImageProvider.firstImage,
  884 + // // ImageSource.gallery);
  885 + // // },
  886 + // // Platform.isAndroid
  887 + // // ? Permission.storage
  888 + // // : Permission.photos);
  889 + // }
  890 + },
  891 + child: Stack(alignment: Alignment.bottomCenter, children: [
  892 + Stack(clipBehavior: Clip.none, children: [
  893 + item.image.qiniuUrl != null && item.image.qiniuUrl != ''
  894 + ? Image.network(
  895 + item.image.qiniuUrl,
  896 + fit: BoxFit.contain,
  897 + width: double.infinity,
  898 + // width: ScreenUtil()
  899 + // .setWidth(imgSize * 2),
  900 + // height: ScreenUtil().setWidth(
  901 + // _uploadImageProvider
  902 + // .imgSizefirstImage *
  903 + // 2),
  904 + )
  905 + : Image.file(
  906 + item.image.file,
  907 + fit: BoxFit.contain,
  908 + width: double.infinity,
  909 + // width: ScreenUtil()
  910 + // .setWidth(imgSize * 2),
  911 + // height: ScreenUtil().setWidth(
  912 + // _uploadImageProvider
  913 + // .imgSizefirstImage *
  914 + // 2),
  915 + ),
  916 + Positioned(
  917 + left: 0,
  918 + top: 0,
  919 + child: (item.image.file != null) &&
  920 + item.image.process != 1 &&
  921 + item.image.process != 0.01
  922 + ? Container(
  923 + width: ScreenUtil().screenWidth,
  924 + height:
  925 + w(_uploadImageProvider.imgSizefirstImage),
  926 + color: MyColours.color_4D000000,
  927 + child: Center(
  928 + child: Text('上传中',
  929 + style: TextStyle(
  930 + color: MyColours.color_F8F9FD)),
  931 + ),
  932 + )
  933 + : Container()),
  934 + ]),
  935 + // item.image.process == 1
  936 + // ? Container(
  937 + // width: w(150),
  938 + // height: w(30),
  939 + // color: MyColours.color_4D000000,
  940 + // alignment: Alignment.center,
  941 + // child: Text(
  942 + // '点击图片可以更换',
  943 + // style: TextStyle(
  944 + // color: MyColours
  945 + // .color_F8F9FD,
  946 + // fontSize: font(14),
  947 + // fontWeight:
  948 + // FontWeight.bold),
  949 + // ))
  950 + // : SizedBox(),
  951 + item.image.process == 1
  952 + ? Positioned(
  953 + top: 0,
  954 + right: 0,
  955 + child: InkWell(
  956 + onTap: () {
  957 + data.remove(item);
  958 + setState(() {});
  959 + },
  960 + child: Container(
  961 + width: w(20),
  962 + height: w(20),
  963 + color: Colors.transparent,
  964 + alignment: Alignment.center,
  965 + child: Image.asset(
  966 + Utils.getImgPath('delete')))))
  967 + : SizedBox(),
  968 + ]))));
  969 + }
  970 + } else if (item.type == '2') {
  971 + //文本
  972 + temp.add(Container(
  973 + key: ValueKey(item),
  974 + decoration: BoxDecoration(
  975 + border: Border.all(width: w(1), color: MyColours.color_DBDBDB)),
  976 + // child: Text(item.content),
  977 +
  978 + // color: Colors.red,
  979 + child: Stack(
  980 + children: [
  981 + Container(
  982 + // height: w(152),
  983 + decoration: BoxDecoration(
  984 + borderRadius: BorderRadius.circular(r(5)),
  985 + border: Border.all(
  986 + width: w(1), color: MyColours.color_DBDBDB)),
  987 + margin: EdgeInsets.only(
  988 + left: w(10), top: w(10), bottom: w(10), right: w(60)),
  989 + padding: EdgeInsets.only(
  990 + top: w(16), bottom: w(16), left: w(14), right: w(10)),
  991 + child: TextField(
  992 + controller: item.infoC,
  993 + // textAlign: TextAlign.right,
  994 + // focusNode: _cusdemNode,
  995 + style: TextStyle(
  996 + color: MyColours.color_515151,
  997 + fontSize: ScreenUtil().setSp(28),
  998 + // textBaseline: TextBaseline.alphabetic
  999 + ),
  1000 + // textAlignVertical: TextAlignVertical.center,
  1001 + maxLines: 5,
  1002 + maxLength: 200,
  1003 + // inputFormatters: [
  1004 + // LengthLimitingTextInputFormatter(10), // 设置输入长度限制
  1005 + // ],
  1006 + decoration: InputDecoration(
  1007 + hintText: "点击录入文字",
  1008 + hintStyle: TextStyle(
  1009 + color: MyColours.color_999999,
  1010 + fontSize: ScreenUtil().setSp(28),
  1011 + ),
  1012 + contentPadding: EdgeInsets.zero,
  1013 + border: OutlineInputBorder(borderSide: BorderSide.none),
  1014 + ),
  1015 + keyboardType: TextInputType.multiline,
  1016 + onChanged: (value) {
  1017 + item.content = value;
  1018 + })),
  1019 + Positioned(
  1020 + top: w(10),
  1021 + right: w(10),
  1022 + child: InkWell(
  1023 + onTap: () {
  1024 + data.remove(item);
  1025 + setState(() {});
  1026 + },
  1027 + child: Container(
  1028 + width: w(20),
  1029 + height: w(20),
  1030 + color: Colors.transparent,
  1031 + alignment: Alignment.center,
  1032 + child: Image.asset(Utils.getImgPath('delete')))))
  1033 + ],
  1034 + ),
  1035 + ));
  1036 + } else {
  1037 + //视频
  1038 + if (item.image.qiniuUrl == null && item.image.file == null) {
  1039 + } else {
  1040 + temp.add(Container(
  1041 + key: ValueKey(item),
  1042 + margin: EdgeInsets.only(bottom: w(12)),
  1043 + child: InkWell(
  1044 + onTap: () {
  1045 + if (item.image.process == 1) {
  1046 + NavigatorUtil.goPlayVideoPage(context,
  1047 + urlStr: item.image.qiniuUrl);
  1048 + }
  1049 + },
  1050 + child: Stack(alignment: Alignment.bottomRight, children: [
  1051 + Stack(
  1052 + alignment: Alignment.center,
  1053 + children: [
  1054 + Stack(
  1055 + alignment: Alignment.topRight,
  1056 + children: [
  1057 + Image.file(
  1058 + item.image.thumbnailPath,
  1059 + fit: BoxFit.contain,
  1060 + width: double.infinity,
  1061 + )
  1062 + // : FutureBuilder(
  1063 + // //显示缩略图
  1064 + // future: _initializeVideoPlayerFuture,
  1065 + // builder: (context, snapshot) {
  1066 + // print(snapshot.connectionState);
  1067 + // if (snapshot.hasError)
  1068 + // print(snapshot.error);
  1069 + // if (snapshot.connectionState ==
  1070 + // ConnectionState.done) {
  1071 + // return Container(
  1072 + // // width: ScreenUtil().setWidth(225),
  1073 + // child: AspectRatio(
  1074 + // aspectRatio: 1 / 1,
  1075 +
  1076 + // // aspectRatio: _controller.value.aspectRatio,
  1077 + // child: VideoPlayer(_controller),
  1078 + // ),
  1079 + // );
  1080 + // } else {
  1081 + // return Center(
  1082 + // child: CircularProgressIndicator(),
  1083 + // );
  1084 + // }
  1085 + // },
  1086 + // ),
  1087 + ,
  1088 + Offstage(
  1089 + offstage: item.image.process < 1,
  1090 + child: GestureDetector(
  1091 + child: Image.asset(
  1092 + Utils.getImgPath("delete"),
  1093 + width: ScreenUtil().setWidth(40),
  1094 + height: ScreenUtil().setWidth(40),
  1095 + ),
  1096 + onTap: () {
  1097 + //点击删除按钮
  1098 + data.remove(item);
  1099 + setState(() {});
  1100 + // setState(() {
  1101 + // widget.model.imageListDenvironment
  1102 + // .removeWhere((element) =>
  1103 + // element ==
  1104 + // widget.model
  1105 + // .imageListDenvironment[
  1106 + // index]);
  1107 + // widget.model.imageQiniuUrlList
  1108 + // .removeWhere((element) =>
  1109 + // element ==
  1110 + // widget.model
  1111 + // .imageQiniuUrlList[index]);
  1112 + // });
  1113 + },
  1114 + ),
  1115 + ),
  1116 + ],
  1117 + ),
  1118 + // Offstage(
  1119 + // offstage: widget.model.imageListDenvironment[index].process == 1,
  1120 + // child: Progress(widget.model.imageListDenvironment[index].process),
  1121 + // ),
  1122 +
  1123 + showCompress
  1124 + ? Container(
  1125 + width: ScreenUtil().setWidth(90.0 * 2),
  1126 + height: ScreenUtil().setWidth(90.0 * 2),
  1127 + decoration: BoxDecoration(
  1128 + color: Color.fromRGBO(0, 0, 0, 0.5),
  1129 + borderRadius: BorderRadius.circular(r(5))),
  1130 + child: Center(
  1131 + child: Text('压缩中...',
  1132 + style: TextStyle(
  1133 + fontSize: ScreenUtil().setSp(24),
  1134 + color: MyColours.color_fefefe)),
  1135 + ))
  1136 + : item.image.process == 1
  1137 + ? Align(
  1138 + alignment: Alignment.center,
  1139 + child: Image.asset(
  1140 + Utils.getImgPath('play'),
  1141 + width: ScreenUtil().setWidth(60),
  1142 + ))
  1143 + : Progress(
  1144 + item.image.process,
  1145 + size: 90.0,
  1146 + ),
  1147 + ],
  1148 + ),
  1149 + Align(
  1150 + alignment: Alignment.bottomRight,
  1151 + child: Padding(
  1152 + padding: EdgeInsets.only(
  1153 + bottom: ScreenUtil().setWidth(10),
  1154 + right: ScreenUtil().setWidth(10)),
  1155 + child: Text(
  1156 + item.image.duration,
  1157 + style: TextStyle(
  1158 + color: MyColours.color_fefefe,
  1159 + fontSize: ScreenUtil().setSp(24)),
  1160 + )),
  1161 + )
  1162 + ]))));
  1163 + }
  1164 + }
121 } 1165 }
  1166 + return temp;
122 } 1167 }
123 1168
124 ///#相机拍照,单图选择 1169 ///#相机拍照,单图选择
125 - Future _getFromPictureOrCamera(UploadImgModel imgModel, imageSource) async { 1170 + Future _getFromPictureOrCamera(int index, imageSource) async {
126 final pickedFile = await picker.pickImage(source: imageSource); 1171 final pickedFile = await picker.pickImage(source: imageSource);
127 if (pickedFile != null) { 1172 if (pickedFile != null) {
  1173 + UploadImgModel uploadImgModel = UploadImgModel(); //图
  1174 + _uploadImageProvider.setDynamicValue('${data.length}', uploadImgModel);
  1175 +
  1176 + AdditionModel additionModel = AdditionModel();
  1177 + // additionModel.content = imgModel.qiniuUrl;
  1178 + additionModel.type = '1';
  1179 + // additionModel.order = data.length;
  1180 + additionModel.image = uploadImgModel;
  1181 + // additionModel.image.process = 1;
  1182 + // additionModel.image.qiniuUrl =
  1183 + // 'https://inews.gtimg.com/om_bt/OGlQWfsaAoKkuCcMZ2o9IVEPqd-72DQy5EAN02XBHUwfYAA/641';
  1184 +
  1185 + data.add(additionModel);
128 File compressedFile = await FlutterNativeImage.compressImage( 1186 File compressedFile = await FlutterNativeImage.compressImage(
129 pickedFile.path, 1187 pickedFile.path,
130 quality: 50, 1188 quality: 50,
131 percentage: 50); 1189 percentage: 50);
  1190 + UploadImgModel imgModel =
  1191 + _uploadImageProvider.getDynamicValue('${index}');
132 setState(() { 1192 setState(() {
133 if (pickedFile != null) { 1193 if (pickedFile != null) {
134 imgModel.file = File(pickedFile.path); 1194 imgModel.file = File(pickedFile.path);
@@ -143,23 +1203,38 @@ class _ChefIntroducePageState extends State<ChefIntroducePage> { @@ -143,23 +1203,38 @@ class _ChefIntroducePageState extends State<ChefIntroducePage> {
143 // _uploadImageProvider.touxiang.qiniuUrl = null; 1203 // _uploadImageProvider.touxiang.qiniuUrl = null;
144 // } else { 1204 // } else {
145 // _uploadImageProvider.imgSizeErweima = 76; 1205 // _uploadImageProvider.imgSizeErweima = 76;
146 - _uploadImageProvider.firstImage.qiniuUrl = null; 1206 + imgModel.qiniuUrl = null;
147 // } 1207 // }
148 bool need = await Utils.sizeNeed(File(pickedFile.path)); 1208 bool need = await Utils.sizeNeed(File(pickedFile.path));
149 File file = File(pickedFile.path); 1209 File file = File(pickedFile.path);
150 if (need) { 1210 if (need) {
151 file = File(compressedFile.absolute.path); 1211 file = File(compressedFile.absolute.path);
152 } 1212 }
153 - UploadImageUtil()  
154 - .startUploadOnly(context, file, 4, true, _uploadImageProvider, () {  
155 - imgAll.add(_uploadImageProvider.firstImage.qiniuUrl); 1213 + UploadImageUtil().startUploadOnlyAddition(
  1214 + context, file, index, true, _uploadImageProvider, () {
  1215 + UploadImgModel imgModel =
  1216 + _uploadImageProvider.getDynamicValue('${index}');
  1217 + AdditionModel additionModel = AdditionModel();
  1218 + additionModel.content = imgModel.qiniuUrl;
  1219 + additionModel.type = '1';
  1220 + // additionModel.order = index;
  1221 + additionModel.image = imgModel;
  1222 + // additionModel.image.process = 1;
  1223 + // additionModel.image.qiniuUrl =
  1224 + // 'https://inews.gtimg.com/om_bt/OGlQWfsaAoKkuCcMZ2o9IVEPqd-72DQy5EAN02XBHUwfYAA/641';
  1225 +
  1226 + data[index] = additionModel;
  1227 +
  1228 + imgAll.add(imgModel.qiniuUrl);
  1229 + setState(() {});
156 }); 1230 });
157 } 1231 }
158 } 1232 }
159 } 1233 }
160 1234
161 ///添加图片UI弹出 1235 ///添加图片UI弹出
162 - Future _openModalBottomSheet(context) async { 1236 + Future _openModalBottomSheet(context, int index,
  1237 + {FileType fileType = FileType.image}) async {
163 final option = await showModalBottomSheet( 1238 final option = await showModalBottomSheet(
164 context: context, 1239 context: context,
165 backgroundColor: Colors.transparent, 1240 backgroundColor: Colors.transparent,
@@ -177,15 +1252,12 @@ class _ChefIntroducePageState extends State<ChefIntroducePage> { @@ -177,15 +1252,12 @@ class _ChefIntroducePageState extends State<ChefIntroducePage> {
177 children: <Widget>[ 1252 children: <Widget>[
178 InkWell( 1253 InkWell(
179 onTap: () { 1254 onTap: () {
180 - // Utils.getPickPermission(context, () {  
181 - // _getFromPictureOrCamera(  
182 - // _uploadImageProvider.firstImage, ImageSource.camera);  
183 -  
184 - // Navigator.pop(context);  
185 - // }, Permission.camera);  
186 Utils.getPickPermission(context, () { 1255 Utils.getPickPermission(context, () {
187 - _getFromPictureOrCamera(  
188 - _uploadImageProvider.firstImage, ImageSource.camera); 1256 + if (fileType == FileType.image) {
  1257 + _getFromPictureOrCamera(index, ImageSource.camera);
  1258 + } else {
  1259 + _getVideoFromPictureOrCamera(ImageSource.camera);
  1260 + }
189 if (Navigator.canPop(context)) { 1261 if (Navigator.canPop(context)) {
190 Navigator.pop(context); 1262 Navigator.pop(context);
191 } 1263 }
@@ -193,6 +1265,17 @@ class _ChefIntroducePageState extends State<ChefIntroducePage> { @@ -193,6 +1265,17 @@ class _ChefIntroducePageState extends State<ChefIntroducePage> {
193 Platform.isAndroid 1265 Platform.isAndroid
194 ? Permission.storage 1266 ? Permission.storage
195 : Permission.photos); 1267 : Permission.photos);
  1268 +
  1269 + // Utils.getPickPermission(context, () {
  1270 + // if (fileType == FileType.image) {
  1271 + // _getImageFromPictureOrCamera(ImageSource.camera);
  1272 + // } else {
  1273 + // _getVideoFromPictureOrCamera(ImageSource.camera);
  1274 + // }
  1275 + // if (Navigator.canPop(context)) {
  1276 + // Navigator.pop(context);
  1277 + // }
  1278 + // }, Permission.camera);
196 }, 1279 },
197 child: Container( 1280 child: Container(
198 width: double.infinity, 1281 width: double.infinity,
@@ -223,9 +1306,13 @@ class _ChefIntroducePageState extends State<ChefIntroducePage> { @@ -223,9 +1306,13 @@ class _ChefIntroducePageState extends State<ChefIntroducePage> {
223 // Platform.isAndroid 1306 // Platform.isAndroid
224 // ? Permission.storage 1307 // ? Permission.storage
225 // : Permission.photos); 1308 // : Permission.photos);
  1309 +
226 Utils.getPickPermission(context, () { 1310 Utils.getPickPermission(context, () {
227 - _getFromPictureOrCamera(  
228 - _uploadImageProvider.firstImage, ImageSource.gallery); 1311 + if (fileType == FileType.image) {
  1312 + _getFromPictureOrCamera(index, ImageSource.gallery);
  1313 + } else {
  1314 + _getVideoFromPictureOrCamera(ImageSource.gallery);
  1315 + }
229 if (Navigator.canPop(context)) { 1316 if (Navigator.canPop(context)) {
230 Navigator.pop(context); 1317 Navigator.pop(context);
231 } 1318 }
@@ -233,6 +1320,22 @@ class _ChefIntroducePageState extends State<ChefIntroducePage> { @@ -233,6 +1320,22 @@ class _ChefIntroducePageState extends State<ChefIntroducePage> {
233 Platform.isAndroid 1320 Platform.isAndroid
234 ? Permission.storage 1321 ? Permission.storage
235 : Permission.photos); 1322 : Permission.photos);
  1323 +
  1324 + // Utils.getPickPermission(context, () {
  1325 + // if (fileType == FileType.image) {
  1326 + // pickAsset(RequestType.image);
  1327 + // } else {
  1328 + // _getVideoFromPictureOrCamera(ImageSource.gallery);
  1329 + // }
  1330 + // // //
  1331 + // // _getFromPictureOrCamera(ImageSource.gallery);
  1332 + // if (Navigator.canPop(context)) {
  1333 + // Navigator.pop(context);
  1334 + // }
  1335 + // },
  1336 + // Platform.isAndroid
  1337 + // ? Permission.storage
  1338 + // : Permission.photos);
236 }, 1339 },
237 child: Container( 1340 child: Container(
238 width: double.infinity, 1341 width: double.infinity,
@@ -276,244 +1379,101 @@ class _ChefIntroducePageState extends State<ChefIntroducePage> { @@ -276,244 +1379,101 @@ class _ChefIntroducePageState extends State<ChefIntroducePage> {
276 }); 1379 });
277 } 1380 }
278 1381
279 - Widget _uploadImage({EdgeInsets padding = EdgeInsets.zero}) {  
280 - return _uploadImageProvider.firstImage.file != null ||  
281 - (_uploadImageProvider.firstImage.qiniuUrl != null &&  
282 - _uploadImageProvider.firstImage.qiniuUrl != '')  
283 - ? InkWell(  
284 - onTap: () {  
285 - double process;  
286 - String qiniuUrl;  
287 - List<String> tempList = [];  
288 - // if (title == '头像') {  
289 - process = _uploadImageProvider.firstImage.process;  
290 - qiniuUrl = _uploadImageProvider.firstImage.qiniuUrl;  
291 - // } else {  
292 - // process = _uploadImageProvider.erweima.process;  
293 - // qiniuUrl = _uploadImageProvider.erweima.qiniuUrl;  
294 - // }  
295 -  
296 - if (qiniuUrl != null && qiniuUrl != '') {  
297 - // tempList.add(qiniuUrl);  
298 -  
299 - // ///没有上传完成的不可以点击  
300 - // _showPhotoView(context, 0, tempList);  
301 -  
302 - // _uploadImageProvider.firstImage.qiniuUrl = null;  
303 - // _uploadImageProvider.firstImage.process = 0;  
304 - // setState(() {});  
305 - FocusScope.of(context).requestFocus(FocusNode());  
306 - _openModalBottomSheet(context);  
307 - // Utils.getPickPermission(context, () {  
308 - // _getFromPictureOrCamera(  
309 - // _uploadImageProvider.firstImage,  
310 - // ImageSource.gallery);  
311 - // },  
312 - // Platform.isAndroid  
313 - // ? Permission.storage  
314 - // : Permission.photos);  
315 - }  
316 - },  
317 - child: Stack(alignment: Alignment.bottomCenter, children: [  
318 - Stack(clipBehavior: Clip.none, children: [  
319 - _uploadImageProvider.firstImage.qiniuUrl != null &&  
320 - _uploadImageProvider.firstImage.qiniuUrl != ''  
321 - ? Center(  
322 - child: Image.network(  
323 - _uploadImageProvider.firstImage.qiniuUrl,  
324 - fit: BoxFit.contain,  
325 - // width: double.infinity,  
326 - // width: ScreenUtil()  
327 - // .setWidth(imgSize * 2),  
328 - // height: ScreenUtil().setWidth(  
329 - // _uploadImageProvider.imgSizefirstImage * 2),  
330 - ))  
331 - : Center(  
332 - child: Image.file(  
333 - _uploadImageProvider.firstImage.file,  
334 - fit: BoxFit.contain,  
335 - // width: double.infinity,  
336 - // width: ScreenUtil()  
337 - // .setWidth(imgSize * 2),  
338 - // height: ScreenUtil().setWidth(  
339 - // _uploadImageProvider.imgSizefirstImage * 2),  
340 - )),  
341 - Positioned(  
342 - left: 0,  
343 - top: 0,  
344 - right: padding.right,  
345 - child: (_uploadImageProvider.firstImage.file != null) &&  
346 - _uploadImageProvider.firstImage.process != 1 &&  
347 - _uploadImageProvider.firstImage.process != 0.01  
348 - ? Container(  
349 - width: ScreenUtil().screenWidth,  
350 - height: w(_uploadImageProvider.imgSizefirstImage),  
351 - color: MyColours.color_4D000000,  
352 - child: Center(  
353 - child: Text('上传中',  
354 - style:  
355 - TextStyle(color: MyColours.color_F8F9FD)),  
356 - ),  
357 - )  
358 - : Container()),  
359 - if (_uploadImageProvider.firstImage.process == 1)  
360 - Positioned(  
361 - top: 0,  
362 - right: 0,  
363 - child: GestureDetector(  
364 - child: Image.asset(  
365 - Utils.getImgPath("delete"),  
366 - width: ScreenUtil().setWidth(40),  
367 - height: ScreenUtil().setWidth(40),  
368 - ),  
369 - onTap: () {  
370 - //已经传到服务器,弹提醒窗口,是否删除  
371 - //修改之前有内容,则弹框  
372 - DialogUtil.cupertinoAlertDialog(context,  
373 - title: "", content: "是否确定删除该照片?", lCallback: () {  
374 - print("取消");  
375 - }, rCallback: () {  
376 - _uploadImageProvider.firstImage.qiniuUrl = null;  
377 - _uploadImageProvider.firstImage.file = null;  
378 - _uploadImageProvider.firstImage.isUpload = false;  
379 - _uploadImageProvider.firstImage.process = 0.01;  
380 - setState(() {});  
381 - });  
382 - },  
383 - ))  
384 - ]),  
385 - _uploadImageProvider.firstImage.process == 1  
386 - ? Container(  
387 - width: w(150),  
388 - height: w(30),  
389 - color: MyColours.color_4D000000,  
390 - alignment: Alignment.center,  
391 - margin: padding,  
392 - child: Text(  
393 - '点击图片可以更换',  
394 - style: TextStyle(  
395 - color: MyColours.color_F8F9FD,  
396 - fontSize: font(14),  
397 - fontWeight: FontWeight.bold),  
398 - ))  
399 - : SizedBox(),  
400 - ]))  
401 - : InkWell(  
402 - onTap: () {  
403 - // double process;  
404 - // String qiniuUrl;  
405 - // List<String> tempList = [];  
406 - // if (title == '头像') {  
407 - // process = _uploadImageProvider.touxiang.process;  
408 - // qiniuUrl = _uploadImageProvider.touxiang.qiniuUrl;  
409 - // } else {  
410 - // process = _uploadImageProvider.erweima.process;  
411 - // qiniuUrl = _uploadImageProvider.erweima.qiniuUrl;  
412 - // }  
413 -  
414 - // if (qiniuUrl != null && qiniuUrl != '') {  
415 - // tempList.add(qiniuUrl);  
416 -  
417 - // ///没有上传完成的不可以点击  
418 - // _showPhotoView(context, 0, tempList);  
419 - // } else {  
420 - // Utils.getPickPermission(context, () {  
421 - // _getFromPictureOrCamera(  
422 - // _uploadImageProvider.firstImage, ImageSource.gallery);  
423 - // }, Platform.isAndroid ? Permission.storage : Permission.photos);  
424 - FocusScope.of(context).requestFocus(FocusNode());  
425 - _openModalBottomSheet(context);  
426 - },  
427 - child: Container(  
428 - color: MyColours.color_d9d9d9,  
429 - width: double.infinity,  
430 - height: w(_uploadImageProvider.imgSizefirstImage),  
431 - margin: padding,  
432 - child: Column(  
433 - mainAxisAlignment: MainAxisAlignment.center,  
434 - children: [  
435 - // VEmptyView(80),  
436 - Image.asset(  
437 - Utils.getImgPath('add_img'),  
438 - width: w(63),  
439 - ),  
440 - VEmptyView(28),  
441 - Container(  
442 - width: w(139),  
443 - height: w(60),  
444 - child: Text(  
445 - '点击上传照片\n为了更好的效果\n建议上传4:3照片',  
446 - textAlign: TextAlign.center,  
447 - style: TextStyle(  
448 - height: 1.4,  
449 - color: MyColours.color_ffffff,  
450 - fontSize: font(14),  
451 - fontWeight: FontWeight.bold),  
452 - ))  
453 - ],  
454 - ),  
455 - ));  
456 - }  
457 -  
458 - ///无介绍  
459 - Widget _noTextWidget() {  
460 - return SizedBox();  
461 - // return Column(  
462 - // children: [  
463 - // _uploadImage(),  
464 - // VEmptyView(18),  
465 - // ],  
466 - // );  
467 - }  
468 -  
469 - ///图文分开  
470 - Widget _separateWidget() {  
471 - return Column(crossAxisAlignment: CrossAxisAlignment.start, children: [  
472 - // _introduceWidget(EdgeInsets.all(w(15)),  
473 - // boxDecoration: BoxDecoration(color: MyColours.color_ffffff)),  
474 - // VEmptyView(18),  
475 - _uploadImage(),  
476 - ]);  
477 - } 1382 + ///视频
  1383 + Future _getVideoFromPictureOrCamera(ImageSource imageSource) async {
  1384 + final pickedFile = await picker.pickVideo(
  1385 + source: imageSource, maxDuration: const Duration(minutes: 2));
  1386 + if (pickedFile != null) {
  1387 + int key = data.length; //上传变量key
  1388 + // String ddd = Utils.getPicSuffix(pickedFile.path); //获取后缀MP4
  1389 + // print(ddd);
  1390 + await VideoCompress.setLogLevel(0);
  1391 + final info = await VideoCompress.getMediaInfo(
  1392 + pickedFile.path); //视频信息:时长、像素(宽高)、大小、path
  1393 + String duration = '00:00';
  1394 + if (info != null) {
  1395 + //限制视频时长
  1396 + if (info.duration > 30000 || info.duration < 0) {
  1397 + Utils.showToast('请选择30秒以内的视频');
  1398 + return;
  1399 + }
  1400 + duration = VideoUtils.getDuration(
  1401 + info.duration,
  1402 + ); //转化视频时长单位(00:13、 02:00)
  1403 + }
  1404 + UploadImgModel uploadImgModel = UploadImgModel(); //图
  1405 + _uploadImageProvider.setDynamicValue('${key}', uploadImgModel);
478 1406
479 - Widget _item(String title, {bool select, GestureTapCallback onTap}) {  
480 - return InkWell(  
481 - onTap: onTap,  
482 - child: Container(  
483 - decoration: BoxDecoration(  
484 - border: Border(  
485 - bottom: BorderSide(  
486 - color: MyColours.color_E7E7E7, width: w(0.5)))),  
487 - margin: EdgeInsets.only(left: w(16)),  
488 - padding: EdgeInsets.only(top: w(12), bottom: w(12), right: w(16)),  
489 - child: Row(  
490 - children: [  
491 - Text(  
492 - title,  
493 - style: TextStyle(  
494 - color: MyColours.color_515151,  
495 - fontSize: ScreenUtil().setWidth(32)),  
496 - ),  
497 - Spacer(),  
498 - Container(  
499 - padding:  
500 - EdgeInsets.symmetric(horizontal: w(7), vertical: w(4)),  
501 - child: Image.asset(  
502 - Utils.getImgPath(select ? 'swich_on' : 'swich_off'),  
503 - width: w(44),  
504 - ),  
505 - )  
506 - ],  
507 - ))); 1407 + AdditionModel additionModel = AdditionModel();
  1408 + additionModel.type = '3';
  1409 + additionModel.image = uploadImgModel;
  1410 + data.add(additionModel);
  1411 + //获取视频封面图
  1412 + String thumbnailPathString =
  1413 + await VideoUtils.getThumbnailFile(pickedFile.path);
  1414 + File thumbnailPath = File(thumbnailPathString);
  1415 + //视频数据赋值:封面、时长、类型、进度、path
  1416 + UploadImgModel imgModel = _uploadImageProvider.getDynamicValue('${key}');
  1417 + setState(() {
  1418 + imgModel.file = File(pickedFile.path);
  1419 + imgModel.process = 0.01;
  1420 + imgModel.fileType = FileType.video;
  1421 + imgModel.thumbnailPath = thumbnailPath;
  1422 + imgModel.duration = duration;
  1423 + imgModel.qiniuUrl = null;
  1424 + });
  1425 + //上传文件准备
  1426 + File file = File(pickedFile.path);
  1427 + //是否需要压缩
  1428 + bool need = await VideoUtils.shouldCompress(pickedFile.path);
  1429 + if (need) {
  1430 + showCompress = true;
  1431 + setState(() {});
  1432 + //需要压缩
  1433 + // 订阅压缩进度
  1434 + _subscription = VideoCompress.compressProgress$.subscribe((progress) {
  1435 + debugPrint('progress: $progress');
  1436 + if (progress.toInt() == 100) {
  1437 + //压缩完成
  1438 + showCompress = false;
  1439 + _subscription.unsubscribe(); // 取消订阅
  1440 + setState(() {});
  1441 + }
  1442 + // 回调进度给外部
  1443 + // if (onProgress != null) {
  1444 + // onProgress!(progress);
  1445 + // }
  1446 + });
  1447 + file = await VideoUtils.compress(pickedFile.path); //压缩后的文件
  1448 + }
  1449 + //开始上传任务
  1450 + UploadImageUtil().startUploadOnlyAddition(
  1451 + context, file, key, true, _uploadImageProvider, () {
  1452 + //上传成功后赋值
  1453 + UploadImgModel imgModel =
  1454 + _uploadImageProvider.getDynamicValue('${key}');
  1455 + AdditionModel additionModel = AdditionModel();
  1456 + additionModel.content = imgModel.qiniuUrl;
  1457 + additionModel.type = '3';
  1458 + additionModel.image = imgModel;
  1459 + data[key] = additionModel;
  1460 + imgAll.add(imgModel.qiniuUrl);
  1461 + setState(() {});
  1462 + });
  1463 + } else {
  1464 + print('No image selected.');
  1465 + }
508 } 1466 }
509 1467
510 @override 1468 @override
511 Widget build(BuildContext context) { 1469 Widget build(BuildContext context) {
  1470 + // _baseIndoProvider =
  1471 + // Provider.of<StoreBaseIndoProvider>(context, listen: false);
512 _uploadImageProvider = 1472 _uploadImageProvider =
513 Provider.of<UploadImageProvider>(context, listen: true); 1473 Provider.of<UploadImageProvider>(context, listen: true);
514 -  
515 - _marketingCenterProvider = 1474 + marketingCenterProvider =
516 Provider.of<MarketingCenterProvider>(context, listen: true); 1475 Provider.of<MarketingCenterProvider>(context, listen: true);
  1476 + bool hasVedio = data.any((element) => element.type == '3');
517 return KeyboardDismissOnTap( 1477 return KeyboardDismissOnTap(
518 child: Scaffold( 1478 child: Scaffold(
519 backgroundColor: MyColours.color_ffffff, 1479 backgroundColor: MyColours.color_ffffff,
@@ -529,198 +1489,372 @@ class _ChefIntroducePageState extends State<ChefIntroducePage> { @@ -529,198 +1489,372 @@ class _ChefIntroducePageState extends State<ChefIntroducePage> {
529 children: [ 1489 children: [
530 Expanded( 1490 Expanded(
531 child: SingleChildScrollView( 1491 child: SingleChildScrollView(
  1492 + controller: controller,
532 child: Column( 1493 child: Column(
533 children: [ 1494 children: [
534 - // _selectBtnWidget(),  
535 - // VEmptyView(24),  
536 - // Container(  
537 - // alignment: Alignment.centerLeft,  
538 - // padding: EdgeInsets.only(left: w(16)),  
539 - // height: w(48),  
540 - // child: Text(  
541 - // '效果预览',  
542 - // style: TextStyle(  
543 - // fontSize: font(16),  
544 - // color: MyColours.color_515151),  
545 - // ),  
546 - // ),  
547 - // VEmptyView(24),  
548 - _item('预订安排通知中附加主厨文字介绍', select: addChefIntroduce, 1495 + _item('预订通知中展示主厨介绍', select: addStoreIntroduce,
549 onTap: () { 1496 onTap: () {
550 setState(() { 1497 setState(() {
551 - addChefIntroduce = !addChefIntroduce; 1498 + addStoreIntroduce = !addStoreIntroduce;
552 }); 1499 });
553 }), 1500 }),
554 1501
555 - VEmptyView(24),  
556 - //输入框  
557 - Container(  
558 - width: double.infinity,  
559 - margin: EdgeInsets.symmetric(  
560 - horizontal: ScreenUtil().setWidth(40)),  
561 - padding: EdgeInsets.symmetric(  
562 - horizontal: ScreenUtil().setWidth(40),  
563 - vertical: ScreenUtil().setWidth(20)),  
564 - alignment: Alignment.topLeft,  
565 - decoration: BoxDecoration(  
566 - color: MyColours.color_ffffff,  
567 - border: Border.all(  
568 - color: MyColours.color_DBDBDB,  
569 - width: ScreenUtil().setWidth(2)),  
570 - borderRadius: BorderRadius.circular(  
571 - ScreenUtil().setWidth(20))),  
572 - child: TextField(  
573 - controller: chefIntroduceC,  
574 - focusNode: chefIntroduceNode,  
575 - style: TextStyle(  
576 - color: MyColours.color_515151,  
577 - fontSize: ScreenUtil().setSp(28),  
578 - textBaseline: TextBaseline.alphabetic),  
579 - textAlignVertical: TextAlignVertical.center,  
580 - maxLines: 5,  
581 - maxLength: 100,  
582 - decoration: InputDecoration(  
583 - hintText: "点击录入餐厅介绍文字信息,最多100个汉字。",  
584 - hintStyle: TextStyle(  
585 - color: MyColours.color_999999,  
586 - fontSize: ScreenUtil().setSp(28),  
587 - ),  
588 - contentPadding: EdgeInsets.zero,  
589 - border: OutlineInputBorder(  
590 - borderSide: BorderSide.none),  
591 - ),  
592 - keyboardType: TextInputType.multiline,  
593 - onChanged: (value) {  
594 - setState(() {  
595 - // currentRemark = value ?? "";  
596 - });  
597 - }), 1502 + _textfield(
  1503 + '标题名称',
  1504 + '请输入',
  1505 + titleC,
  1506 + titleCNode,
598 ), 1507 ),
599 - VEmptyView(24),  
600 - Padding(  
601 - padding: EdgeInsets.symmetric(horizontal: w(20)),  
602 - child: MyDivider(  
603 - double.infinity,  
604 - w(0.5),  
605 - color: MyColours.color_DBDBDB,  
606 - )),  
607 - VEmptyView(24),  
608 - // _selectBtnWidget(),  
609 - _item('预订安排通知中附加主厨介绍图片', select: addChefImge, onTap: () {  
610 - setState(() {  
611 - addChefImge = !addChefImge;  
612 - });  
613 - }),  
614 1508
615 VEmptyView(24), 1509 VEmptyView(24),
616 - _separateWidget(),  
617 - VEmptyView(24),  
618 - _item('主厨介绍文字显示在图片上', select: addAbove, onTap: () {  
619 - setState(() {  
620 - addAbove = !addAbove;  
621 - });  
622 - }), 1510 + if (data.length > 0)
  1511 + Padding(
  1512 + padding: EdgeInsets.symmetric(
  1513 + // horizontal: ScreenUtil().setWidth(32),
  1514 + vertical: ScreenUtil().setWidth(26)),
  1515 + child: ReorderableListView(
  1516 + shrinkWrap: true,
  1517 + scrollController: controller,
  1518 + children: _scrolleWidget(),
  1519 + onReorder: (int oldIndex, int newIndex) async {
  1520 + print(newIndex);
  1521 + if (oldIndex < newIndex) {
  1522 + newIndex -= 1;
  1523 + }
  1524 + print(newIndex);
  1525 +
  1526 + // var childold = tableManagerModel.areas[oldIndex];
  1527 + // Map<String, String> params = {
  1528 + // 'sid': Provider.of<UserModel>(context, listen: false)
  1529 + // .user
  1530 + // .sellerid,
  1531 + // 'regionid': childold.rid,
  1532 + // 'order_o': tableManagerModel.areas[newIndex].orderId,
  1533 + // 'sort': oldIndex < newIndex ? '2' : '1'
  1534 + // };
  1535 + var child = data.removeAt(oldIndex);
  1536 + data.insert(newIndex, child);
  1537 + setState(() {});
  1538 + // await tableManagerModel.sortByRegion(context, params);
  1539 + // //刷新前一页数据
  1540 + // bus.emit('refresh_table_area');
  1541 + },
  1542 + )),
  1543 +
  1544 + //输入框
  1545 + // Container(
  1546 + // width: double.infinity,
  1547 + // margin: EdgeInsets.symmetric(
  1548 + // horizontal: ScreenUtil().setWidth(40)),
  1549 + // padding: EdgeInsets.symmetric(
  1550 + // horizontal: ScreenUtil().setWidth(40),
  1551 + // vertical: ScreenUtil().setWidth(20)),
  1552 + // alignment: Alignment.topLeft,
  1553 + // decoration: BoxDecoration(
  1554 + // color: MyColours.color_ffffff,
  1555 + // border: Border.all(
  1556 + // color: MyColours.color_DBDBDB,
  1557 + // width: ScreenUtil().setWidth(2)),
  1558 + // borderRadius: BorderRadius.circular(
  1559 + // ScreenUtil().setWidth(20))),
  1560 + // child: TextField(
  1561 + // controller: storeIntroduceC,
  1562 + // focusNode: storeIntroduceNode,
  1563 + // style: TextStyle(
  1564 + // color: MyColours.color_515151,
  1565 + // fontSize: ScreenUtil().setSp(28),
  1566 + // textBaseline: TextBaseline.alphabetic),
  1567 + // textAlignVertical: TextAlignVertical.center,
  1568 + // maxLines: 5,
  1569 + // maxLength: 500,
  1570 + // decoration: InputDecoration(
  1571 + // hintText: "点击录入餐厅介绍文字信息,最多100个汉字。",
  1572 + // hintStyle: TextStyle(
  1573 + // color: MyColours.color_999999,
  1574 + // fontSize: ScreenUtil().setSp(28),
  1575 + // ),
  1576 + // contentPadding: EdgeInsets.zero,
  1577 + // border: OutlineInputBorder(
  1578 + // borderSide: BorderSide.none),
  1579 + // ),
  1580 + // keyboardType: TextInputType.multiline,
  1581 + // onChanged: (value) {
  1582 + // setState(() {
  1583 + // // currentRemark = value ?? "";
  1584 + // });
  1585 + // }),
  1586 + // ),
  1587 + // VEmptyView(24),
  1588 + // Padding(
  1589 + // padding: EdgeInsets.symmetric(horizontal: w(20)),
  1590 + // child: MyDivider(
  1591 + // double.infinity,
  1592 + // w(0.5),
  1593 + // color: MyColours.color_DBDBDB,
  1594 + // )),
  1595 + // VEmptyView(24),
  1596 + // // _selectBtnWidget(),
  1597 + // _item('预订安排通知中附加餐厅介绍图片', select: addStoreImge, onTap: () {
  1598 + // setState(() {
  1599 + // addStoreImge = !addStoreImge;
  1600 + // });
  1601 + // }),
  1602 +
  1603 + // VEmptyView(24),
  1604 + // // Container(
  1605 + // // alignment: Alignment.centerLeft,
  1606 + // // padding: EdgeInsets.only(left: w(16)),
  1607 + // // height: w(48),
  1608 + // // child: Text(
  1609 + // // '效果预览',
  1610 + // // style: TextStyle(
  1611 + // // fontSize: font(16),
  1612 + // // color: MyColours.color_515151),
  1613 + // // ),
  1614 + // // ),
  1615 + // // VEmptyView(24),
  1616 + // // currIndex == 0
  1617 + // // ? _noTextWidget()
  1618 + // // : currIndex == 1
  1619 + // // ? _mergingWidget()
  1620 + // // :
  1621 + // _separateWidget(),
  1622 + // VEmptyView(24),
  1623 + // _item('餐厅介绍文字显示在第一张图片上', select: addAbove, onTap: () {
  1624 + // setState(() {
  1625 + // addAbove = !addAbove;
  1626 + // });
  1627 + // }),
623 1628
624 VEmptyView(24), 1629 VEmptyView(24),
625 ], 1630 ],
626 ), 1631 ),
627 )), 1632 )),
628 - Container(  
629 - color: MyColours.color_ffffff,  
630 - padding: EdgeInsets.only(  
631 - left: w(45), right: w(45), top: w(12), bottom: w(25)),  
632 - child: RoundButton(  
633 - text: '保存',  
634 - gradientStart: MyColours.color_199095,  
635 - gradientEnd: MyColours.color_199095,  
636 - // borderColor: MyColours.color_999999,  
637 - radius: r(5),  
638 - fontSize: 34,  
639 - height: w(40),  
640 - isBold: true,  
641 - onPressed: () async {  
642 - FocusScope.of(context)  
643 - .requestFocus(FocusNode()); //点击空白处隐藏键盘  
644 -  
645 - if (addChefIntroduce &&  
646 - chefIntroduceC.text.trim().length == 0) {  
647 - Utils.showToast('请输入主厨介绍文字!');  
648 - return false;  
649 - }  
650 - if (addChefImge &&  
651 - _uploadImageProvider.firstImage.qiniuUrl == null) {  
652 - Utils.showToast('请上传图片!');  
653 - return false;  
654 - } 1633 + Column(
  1634 + children: [
  1635 + Container(
  1636 + padding: EdgeInsets.only(top: w(15)),
  1637 + child: Row(
  1638 + mainAxisAlignment: MainAxisAlignment.center,
  1639 + children: [
  1640 + InkWell(
  1641 + onTap: () {
  1642 + if (!hasVedio) {
  1643 + _openModalBottomSheet(context, data.length,
  1644 + fileType: FileType.video);
  1645 + }
  1646 + },
  1647 + child: Container(
  1648 + width: w(77),
  1649 + height: w(34),
  1650 + alignment: Alignment.center,
  1651 + decoration: BoxDecoration(
  1652 + borderRadius: BorderRadius.circular(r(5)),
  1653 + border: Border.all(
  1654 + width: w(1),
  1655 + color: hasVedio
  1656 + ? MyColours.color_999999
  1657 + : MyColours.color_438E93)),
  1658 + child: Text(
  1659 + '+视频',
  1660 + style: TextStyle(
  1661 + color: hasVedio
  1662 + ? MyColours.color_999999
  1663 + : MyColours.color_000000,
  1664 + fontSize: font(14)),
  1665 + ),
  1666 + )),
  1667 + HEmptyView(20),
  1668 + InkWell(
  1669 + onTap: () {
  1670 + _openModalBottomSheet(context, data.length);
  1671 + },
  1672 + child: Container(
  1673 + width: w(77),
  1674 + height: w(34),
  1675 + alignment: Alignment.center,
  1676 + decoration: BoxDecoration(
  1677 + borderRadius: BorderRadius.circular(r(5)),
  1678 + border: Border.all(
  1679 + width: w(1),
  1680 + color: MyColours.color_438E93)),
  1681 + child: Text(
  1682 + '+图片',
  1683 + style: TextStyle(
  1684 + color: MyColours.color_000000,
  1685 + fontSize: font(14)),
  1686 + ),
  1687 + )),
  1688 + HEmptyView(20),
  1689 + InkWell(
  1690 + onTap: () {
  1691 + AdditionModel additionModel1 = AdditionModel();
  1692 + // additionModel1.content =
  1693 + // 'webenkjfkdfjakdfjaldfkjaldfjaldf';
  1694 + additionModel1.type = '2';
  1695 + // additionModel1.order = data.length;
655 1696
656 - if (addChefImge &&  
657 - _uploadImageProvider.firstImage.process < 1) {  
658 - Utils.showToast('正在上传图片,请稍等');  
659 - return false;  
660 - } 1697 + data.add(additionModel1);
  1698 + setState(() {});
  1699 + },
  1700 + child: Container(
  1701 + width: w(77),
  1702 + height: w(34),
  1703 + alignment: Alignment.center,
  1704 + decoration: BoxDecoration(
  1705 + borderRadius: BorderRadius.circular(r(5)),
  1706 + border: Border.all(
  1707 + width: w(1),
  1708 + color: MyColours.color_438E93)),
  1709 + child: Text(
  1710 + '+文字',
  1711 + style: TextStyle(
  1712 + color: MyColours.color_000000,
  1713 + fontSize: font(14)),
  1714 + ),
  1715 + )),
  1716 + ],
  1717 + ),
  1718 + ),
  1719 + VEmptyView(24),
  1720 + Text(
  1721 + '注:\n1. 为了保证客户访问速度,只能有1个视频,时常不超过2分钟\n2. 上下拖动可以调整展示顺序',
  1722 + style: TextStyle(
  1723 + height: 1.5,
  1724 + color: MyColours.color_999999,
  1725 + fontSize: font(12)),
  1726 + ),
  1727 + Container(
  1728 + color: MyColours.color_ffffff,
  1729 + padding: EdgeInsets.only(
  1730 + left: w(45), right: w(45), top: w(13), bottom: w(25)),
  1731 + child: RoundButton(
  1732 + text: '保存',
  1733 + gradientStart: MyColours.color_199095,
  1734 + gradientEnd: MyColours.color_199095,
  1735 + // borderColor: MyColours.color_999999,
  1736 + radius: r(5),
  1737 + fontSize: 34,
  1738 + height: w(40),
  1739 + isBold: true,
  1740 + onPressed: () async {
  1741 + FocusScope.of(context)
  1742 + .requestFocus(FocusNode()); //点击空白处隐藏键盘
661 1743
662 - // List<String> images = [];  
663 - // if (_uploadImageProvider.storeImage1.qiniuUrl != null &&  
664 - // _uploadImageProvider.storeImage1.qiniuUrl != '') {  
665 - // images.add(_uploadImageProvider.storeImage1.qiniuUrl);  
666 - // }  
667 - // if (_uploadImageProvider.storeImage2.qiniuUrl != null &&  
668 - // _uploadImageProvider.storeImage2.qiniuUrl != '') {  
669 - // images.add(_uploadImageProvider.storeImage2.qiniuUrl);  
670 - // }  
671 - // if (_uploadImageProvider.storeImage3.qiniuUrl != null &&  
672 - // _uploadImageProvider.storeImage3.qiniuUrl != '') {  
673 - // images.add(_uploadImageProvider.storeImage3.qiniuUrl);  
674 - // }  
675 - // if (_uploadImageProvider.storeImage3.qiniuUrl != null &&  
676 - // _uploadImageProvider.storeImage3.qiniuUrl != '') {  
677 - // images.add(_uploadImageProvider.storeImage3.qiniuUrl);  
678 - // }  
679 - // if (images.length == 0) {  
680 - // Utils.showToast('请至少上传一张图片!');  
681 - // return false;  
682 - // }  
683 -  
684 - //接口  
685 - Map chefData = {  
686 - 'introduce': chefIntroduceC.text,  
687 - 'image': _uploadImageProvider.firstImage.qiniuUrl,  
688 - 'is_introduce': addChefIntroduce ? '1' : '0',  
689 - 'is_images': addChefImge ? '1' : '0',  
690 - 'is_above': addAbove ? '1' : '0'  
691 - };  
692 -  
693 - Map<String, String> params = {  
694 - 'sid': Provider.of<UserModel>(context, listen: false)  
695 - .user  
696 - .sellerid,  
697 - 'chef': json.encode(chefData)  
698 - };  
699 -  
700 - bool success = await _marketingCenterProvider  
701 - .setSellerTemplateConf(context, params,  
702 - showLoading: true);  
703 - if (success) {  
704 - // imgAll和images 比较,挑出不一样的,删除七牛云  
705 - Set<String> difference = Set.from(imgAll)  
706 - ..removeAll(  
707 - [_uploadImageProvider.firstImage.qiniuUrl]);  
708 - List<String> differenceList =  
709 - difference.toList(); //需要删除的图片  
710 - if (differenceList.length > 0) {  
711 - String delImgs =  
712 - Utils.listToStringEnglish(differenceList);  
713 -  
714 - _uploadImageProvider.deleteImg(context, delImgs,  
715 - needToast: false);  
716 - }  
717 - Utils.showToast('保存成功');  
718 - if (Navigator.canPop(context)) {  
719 - Navigator.pop(context);  
720 - }  
721 - }  
722 - },  
723 - ), 1744 + if (titleC.text.trim().length == 0) {
  1745 + Utils.showToast('请输入标题名称!');
  1746 + return false;
  1747 + }
  1748 +
  1749 + if (addStoreIntroduce && data.length == 0) {
  1750 + Utils.showToast('请录入主厨介绍!');
  1751 + return false;
  1752 + }
  1753 +
  1754 + print(data);
  1755 +
  1756 + bool can = true;
  1757 + innerloop:
  1758 + for (AdditionModel item in data) {
  1759 + if (item.type == '1' && item.image.process < 1) {
  1760 + Utils.showToast('正在上传,请稍等');
  1761 + // return false;
  1762 + can = false;
  1763 + break innerloop;
  1764 + }
  1765 + }
  1766 + data.removeWhere((element) =>
  1767 + element.type == '2' &&
  1768 + (element.infoC.text.trim() == '' ||
  1769 + element.infoC.text == null));
  1770 + if (can) {
  1771 + List temp = [];
  1772 + List<String> delImgs = [];
  1773 + // String text = '';
  1774 + for (int i = 0; i < data.length; i++) {
  1775 + AdditionModel element = data[i];
  1776 + temp.add({
  1777 + 'type': element.type,
  1778 + 'content': element.type == '2'
  1779 + ? element.infoC.text
  1780 + : element.image.qiniuUrl,
  1781 + 'duration': element.type == '3'
  1782 + ? element.image.duration
  1783 + : ''
  1784 + });
  1785 + if (element.type == '2') {
  1786 + // text += '${element.infoC.text}\n';
  1787 + } else {
  1788 + delImgs.add(element.image.qiniuUrl);
  1789 + }
  1790 + }
  1791 +
  1792 + // List<String> images = [];
  1793 + // for (int i = 0; i < data.length; i++) {
  1794 + // ChangeModel imgModel = data[i];
  1795 + // if (imgModel.image.qiniuUrl != null &&
  1796 + // imgModel.image.qiniuUrl != '') {
  1797 + // images.add(imgModel.image.qiniuUrl);
  1798 + // }
  1799 + // }
  1800 +
  1801 + // if (images.length == 0) {
  1802 + // Utils.showToast('请至少上传一张图片!');
  1803 + // return false;
  1804 + // }
  1805 + // if (text.trim().length > 0) {
  1806 + // //同步店铺信息
  1807 + // _setSellerInfoById(text); //同步店铺简介
  1808 + // }
  1809 +
  1810 + //接口
  1811 + Map storeData = {
  1812 + // 'style': currIndex.toString(),
  1813 + // 'seller_name': sellername,
  1814 + 'content': jsonEncode(temp),
  1815 + 'title': titleC.text,
  1816 + // 'images': json.encode(images),
  1817 + 'is_introduce_all':
  1818 + addStoreIntroduce ? '1' : '0',
  1819 + // 'is_images': addStoreImge ? '1' : '0',
  1820 + // 'is_above': addAbove ? '1' : '0'
  1821 + };
  1822 +
  1823 + Map<String, String> params = {
  1824 + 'sid': Provider.of<UserModel>(context,
  1825 + listen: false)
  1826 + .user
  1827 + .sellerid,
  1828 + 'chef': json.encode(storeData)
  1829 + };
  1830 +
  1831 + bool success = await marketingCenterProvider
  1832 + .setSellerTemplateConf(context, params,
  1833 + showLoading: true);
  1834 + if (success) {
  1835 + // await VideoUtils.clearTemporaryDirectory();
  1836 + // imgAll和images 比较,挑出不一样的,删除七牛云
  1837 + Set<String> difference = Set.from(imgAll)
  1838 + ..removeAll(delImgs);
  1839 + List<String> differenceList =
  1840 + difference.toList(); //需要删除的图片
  1841 + if (differenceList.length > 0) {
  1842 + String delImgs =
  1843 + Utils.listToStringEnglish(differenceList);
  1844 +
  1845 + _uploadImageProvider.deleteImg(
  1846 + context, delImgs,
  1847 + needToast: false);
  1848 + }
  1849 +
  1850 + if (Navigator.canPop(context)) {
  1851 + Navigator.pop(context);
  1852 + }
  1853 + }
  1854 + }
  1855 + }),
  1856 + )
  1857 + ],
724 ) 1858 )
725 ], 1859 ],
726 ))); 1860 )));
  1 +// import 'dart:convert';
  2 +// import 'dart:io';
  3 +
  4 +// import 'package:flutter/material.dart';
  5 +// import 'package:flutter_keyboard_visibility/flutter_keyboard_visibility.dart';
  6 +// import 'package:flutter_native_image/flutter_native_image.dart';
  7 +// import 'package:flutter_screenutil/flutter_screenutil.dart';
  8 +// import 'package:image_picker/image_picker.dart';
  9 +// import 'package:one_key/widgets/v_empty_view.dart';
  10 +// import 'package:permission_handler/permission_handler.dart';
  11 +// import 'package:provider/provider.dart';
  12 +
  13 +// import '../../../../app.dart';
  14 +// import '../../../../models/upload_img_model.dart';
  15 +// import '../../../../provider/marketing_center_provider.dart';
  16 +// import '../../../../provider/upload_img_provider.dart';
  17 +// import '../../../../provider/user_model.dart';
  18 +// import '../../../../res/colors.dart';
  19 +// import '../../../../utils/dialog_util.dart';
  20 +// import '../../../../utils/screen_util.dart';
  21 +// import '../../../../utils/upload_image_util.dart';
  22 +// import '../../../../utils/utils.dart';
  23 +// import '../../../../widgets/MyDivider.dart';
  24 +// import '../../../../widgets/common_button_flat.dart';
  25 +// import '../../../../widgets/round_button.dart';
  26 +// import '../../../../widgets/system_app_bar.dart';
  27 +
  28 +// /***
  29 +// *
  30 +// *
  31 +// * 主厨介绍
  32 +// */
  33 +
  34 +// class ChefIntroducePage extends StatefulWidget {
  35 +// ChefIntroducePage({Key key}) : super(key: key);
  36 +
  37 +// @override
  38 +// _ChefIntroducePageState createState() => _ChefIntroducePageState();
  39 +// }
  40 +
  41 +// class _ChefIntroducePageState extends State<ChefIntroducePage> {
  42 +// // int currIndex = 0; //样式按钮默认选中第一个
  43 +
  44 +// // String sellername; //店铺名称
  45 +
  46 +// TextEditingController chefIntroduceC = TextEditingController();
  47 +// FocusNode chefIntroduceNode = FocusNode();
  48 +
  49 +// TextEditingController chefNameC = TextEditingController();
  50 +// FocusNode chefNameNode = FocusNode();
  51 +
  52 +// final picker = ImagePicker();
  53 +
  54 +// UploadImageProvider _uploadImageProvider;
  55 +// MarketingCenterProvider _marketingCenterProvider;
  56 +// bool addChefIntroduce = false;
  57 +// bool addChefImge = false;
  58 +// bool addAbove = false;
  59 +
  60 +// List<String> imgAll = [];
  61 +
  62 +// @override
  63 +// void initState() {
  64 +// super.initState();
  65 +
  66 +// WidgetsBinding.instance.addPostFrameCallback((_) async {
  67 +// // UserModel userModel = Provider.of<UserModel>(context, listen: false);
  68 +// // sellername = userModel.user.sellername;
  69 +// // setState(() {});
  70 +// _getQiniuInfo();
  71 +// await getSellerTemplateConf();
  72 +// });
  73 +// }
  74 +
  75 +// @override
  76 +// void dispose() {
  77 +// _uploadImageProvider.firstImage = UploadImgModel();
  78 +// super.dispose();
  79 +// }
  80 +
  81 +// ///获取七牛云token
  82 +// ///
  83 +// _getQiniuInfo() async {
  84 +// await _uploadImageProvider.getQiniuInfo(context, {});
  85 +// }
  86 +
  87 +// getSellerTemplateConf() async {
  88 +// bool success =
  89 +// await _marketingCenterProvider.getSellerTemplateConf(context);
  90 +// if (success && _marketingCenterProvider.markDataModel.chef != null) {
  91 +// // currIndex = int.parse(_marketingCenterProvider.markDataModel.chef.style);
  92 +
  93 +// _uploadImageProvider.firstImage.qiniuUrl =
  94 +// _marketingCenterProvider.markDataModel.chef.image ?? null;
  95 +
  96 +// if (_uploadImageProvider.firstImage.qiniuUrl != null) {
  97 +// imgAll.add(_uploadImageProvider.firstImage.qiniuUrl);
  98 +// }
  99 +
  100 +// _uploadImageProvider.firstImage.process =
  101 +// _uploadImageProvider.firstImage.qiniuUrl != null &&
  102 +// _uploadImageProvider.firstImage.qiniuUrl != ''
  103 +// ? 1
  104 +// : null;
  105 +
  106 +// chefNameC.text = _marketingCenterProvider.markDataModel.chef.chefName;
  107 +// chefIntroduceC.text =
  108 +// _marketingCenterProvider.markDataModel.chef.introduce;
  109 +// addChefIntroduce =
  110 +// _marketingCenterProvider.markDataModel.chef.isIntroduce == '1'
  111 +// ? true
  112 +// : false;
  113 +// addChefImge = _marketingCenterProvider.markDataModel.chef.isImages == '1'
  114 +// ? true
  115 +// : false;
  116 +// addAbove = _marketingCenterProvider.markDataModel.chef.isAbove == '1'
  117 +// ? true
  118 +// : false;
  119 +
  120 +// setState(() {});
  121 +// }
  122 +// }
  123 +
  124 +// ///#相机拍照,单图选择
  125 +// Future _getFromPictureOrCamera(UploadImgModel imgModel, imageSource) async {
  126 +// final pickedFile = await picker.pickImage(source: imageSource);
  127 +// if (pickedFile != null) {
  128 +// File compressedFile = await FlutterNativeImage.compressImage(
  129 +// pickedFile.path,
  130 +// quality: 50,
  131 +// percentage: 50);
  132 +// setState(() {
  133 +// if (pickedFile != null) {
  134 +// imgModel.file = File(pickedFile.path);
  135 +// imgModel.process = 0.01;
  136 +// } else {
  137 +// print('No image selected.');
  138 +// }
  139 +// });
  140 +// if (pickedFile != null) {
  141 +// // if (title == '头像') {
  142 +// // _uploadImageProvider.imgSizeTouxiang = 76;
  143 +// // _uploadImageProvider.touxiang.qiniuUrl = null;
  144 +// // } else {
  145 +// // _uploadImageProvider.imgSizeErweima = 76;
  146 +// _uploadImageProvider.firstImage.qiniuUrl = null;
  147 +// // }
  148 +// bool need = await Utils.sizeNeed(File(pickedFile.path));
  149 +// File file = File(pickedFile.path);
  150 +// if (need) {
  151 +// file = File(compressedFile.absolute.path);
  152 +// }
  153 +// UploadImageUtil()
  154 +// .startUploadOnly(context, file, 4, true, _uploadImageProvider, () {
  155 +// imgAll.add(_uploadImageProvider.firstImage.qiniuUrl);
  156 +// });
  157 +// }
  158 +// }
  159 +// }
  160 +
  161 +// ///添加图片UI弹出
  162 +// Future _openModalBottomSheet(context) async {
  163 +// final option = await showModalBottomSheet(
  164 +// context: context,
  165 +// backgroundColor: Colors.transparent,
  166 +// isDismissible: false,
  167 +// builder: (BuildContext context) {
  168 +// return Container(
  169 +// // height: ScreenUtil().setWidth(180 * 2),
  170 +// decoration: BoxDecoration(
  171 +// color: MyColours.color_ffffff,
  172 +// borderRadius: BorderRadius.only(
  173 +// topLeft: Radius.circular(ScreenUtil().setWidth(24)),
  174 +// topRight: Radius.circular(ScreenUtil().setWidth(24)))),
  175 +// child: Column(
  176 +// mainAxisSize: MainAxisSize.min,
  177 +// children: <Widget>[
  178 +// InkWell(
  179 +// onTap: () {
  180 +// // Utils.getPickPermission(context, () {
  181 +// // _getFromPictureOrCamera(
  182 +// // _uploadImageProvider.firstImage, ImageSource.camera);
  183 +
  184 +// // Navigator.pop(context);
  185 +// // }, Permission.camera);
  186 +// Utils.getPickPermission(context, () {
  187 +// _getFromPictureOrCamera(
  188 +// _uploadImageProvider.firstImage, ImageSource.camera);
  189 +// if (Navigator.canPop(context)) {
  190 +// Navigator.pop(context);
  191 +// }
  192 +// },
  193 +// Platform.isAndroid
  194 +// ? Permission.storage
  195 +// : Permission.photos);
  196 +// },
  197 +// child: Container(
  198 +// width: double.infinity,
  199 +// height: ScreenUtil().setWidth(58 * 2),
  200 +// child: Center(
  201 +// child: Text(
  202 +// '拍摄',
  203 +// style: TextStyle(
  204 +// fontSize: ScreenUtil().setSp(32),
  205 +// color: MyColours.color_353535,
  206 +// fontWeight: FontWeight.bold),
  207 +// ),
  208 +// )),
  209 +// ),
  210 +// MyDivider(
  211 +// double.infinity,
  212 +// ScreenUtil().setWidth(2),
  213 +// color: MyColours.color_EEEEEE,
  214 +// ),
  215 +// InkWell(
  216 +// onTap: () {
  217 +// // Utils.getPickPermission(context, () {
  218 +// // // pickAsset(RequestType.image);
  219 +// // _getFromPictureOrCamera(
  220 +// // _uploadImageProvider.firstImage, ImageSource.gallery);
  221 +// // Navigator.pop(context);
  222 +// // },
  223 +// // Platform.isAndroid
  224 +// // ? Permission.storage
  225 +// // : Permission.photos);
  226 +// Utils.getPickPermission(context, () {
  227 +// _getFromPictureOrCamera(
  228 +// _uploadImageProvider.firstImage, ImageSource.gallery);
  229 +// if (Navigator.canPop(context)) {
  230 +// Navigator.pop(context);
  231 +// }
  232 +// },
  233 +// Platform.isAndroid
  234 +// ? Permission.storage
  235 +// : Permission.photos);
  236 +// },
  237 +// child: Container(
  238 +// width: double.infinity,
  239 +// height: ScreenUtil().setWidth(58 * 2),
  240 +// child: Center(
  241 +// child: Text(
  242 +// '从相册选择',
  243 +// style: TextStyle(
  244 +// fontSize: ScreenUtil().setSp(32),
  245 +// color: MyColours.color_353535,
  246 +// fontWeight: FontWeight.bold),
  247 +// ),
  248 +// )),
  249 +// ),
  250 +// MyDivider(
  251 +// double.infinity,
  252 +// ScreenUtil().setWidth(10),
  253 +// color: MyColours.color_EEEEEE,
  254 +// ),
  255 +// InkWell(
  256 +// onTap: () {
  257 +// if (Navigator.canPop(context)) {
  258 +// Navigator.pop(context, '取消');
  259 +// }
  260 +// },
  261 +// child: Container(
  262 +// width: double.infinity,
  263 +// height: ScreenUtil().setWidth(58 * 2),
  264 +// child: Center(
  265 +// child: Text(
  266 +// '取消',
  267 +// style: TextStyle(
  268 +// fontSize: ScreenUtil().setSp(32),
  269 +// color: MyColours.color_353535,
  270 +// fontWeight: FontWeight.bold),
  271 +// ),
  272 +// )))
  273 +// ],
  274 +// ),
  275 +// );
  276 +// });
  277 +// }
  278 +
  279 +// Widget _uploadImage({EdgeInsets padding = EdgeInsets.zero}) {
  280 +// return _uploadImageProvider.firstImage.file != null ||
  281 +// (_uploadImageProvider.firstImage.qiniuUrl != null &&
  282 +// _uploadImageProvider.firstImage.qiniuUrl != '')
  283 +// ? InkWell(
  284 +// onTap: () {
  285 +// double process;
  286 +// String qiniuUrl;
  287 +// List<String> tempList = [];
  288 +// // if (title == '头像') {
  289 +// process = _uploadImageProvider.firstImage.process;
  290 +// qiniuUrl = _uploadImageProvider.firstImage.qiniuUrl;
  291 +// // } else {
  292 +// // process = _uploadImageProvider.erweima.process;
  293 +// // qiniuUrl = _uploadImageProvider.erweima.qiniuUrl;
  294 +// // }
  295 +
  296 +// if (qiniuUrl != null && qiniuUrl != '') {
  297 +// // tempList.add(qiniuUrl);
  298 +
  299 +// // ///没有上传完成的不可以点击
  300 +// // _showPhotoView(context, 0, tempList);
  301 +
  302 +// // _uploadImageProvider.firstImage.qiniuUrl = null;
  303 +// // _uploadImageProvider.firstImage.process = 0;
  304 +// // setState(() {});
  305 +// FocusScope.of(context).requestFocus(FocusNode());
  306 +// _openModalBottomSheet(context);
  307 +// // Utils.getPickPermission(context, () {
  308 +// // _getFromPictureOrCamera(
  309 +// // _uploadImageProvider.firstImage,
  310 +// // ImageSource.gallery);
  311 +// // },
  312 +// // Platform.isAndroid
  313 +// // ? Permission.storage
  314 +// // : Permission.photos);
  315 +// }
  316 +// },
  317 +// child: Stack(alignment: Alignment.bottomCenter, children: [
  318 +// Stack(clipBehavior: Clip.none, children: [
  319 +// _uploadImageProvider.firstImage.qiniuUrl != null &&
  320 +// _uploadImageProvider.firstImage.qiniuUrl != ''
  321 +// ? Center(
  322 +// child: Image.network(
  323 +// _uploadImageProvider.firstImage.qiniuUrl,
  324 +// fit: BoxFit.contain,
  325 +// // width: double.infinity,
  326 +// // width: ScreenUtil()
  327 +// // .setWidth(imgSize * 2),
  328 +// // height: ScreenUtil().setWidth(
  329 +// // _uploadImageProvider.imgSizefirstImage * 2),
  330 +// ))
  331 +// : Center(
  332 +// child: Image.file(
  333 +// _uploadImageProvider.firstImage.file,
  334 +// fit: BoxFit.contain,
  335 +// // width: double.infinity,
  336 +// // width: ScreenUtil()
  337 +// // .setWidth(imgSize * 2),
  338 +// // height: ScreenUtil().setWidth(
  339 +// // _uploadImageProvider.imgSizefirstImage * 2),
  340 +// )),
  341 +// Positioned(
  342 +// left: 0,
  343 +// top: 0,
  344 +// right: padding.right,
  345 +// child: (_uploadImageProvider.firstImage.file != null) &&
  346 +// _uploadImageProvider.firstImage.process != 1 &&
  347 +// _uploadImageProvider.firstImage.process != 0.01
  348 +// ? Container(
  349 +// width: ScreenUtil().screenWidth,
  350 +// height: w(_uploadImageProvider.imgSizefirstImage),
  351 +// color: MyColours.color_4D000000,
  352 +// child: Center(
  353 +// child: Text('上传中',
  354 +// style:
  355 +// TextStyle(color: MyColours.color_F8F9FD)),
  356 +// ),
  357 +// )
  358 +// : Container()),
  359 +// if (_uploadImageProvider.firstImage.process == 1)
  360 +// Positioned(
  361 +// top: 0,
  362 +// right: 0,
  363 +// child: GestureDetector(
  364 +// child: Image.asset(
  365 +// Utils.getImgPath("delete"),
  366 +// width: ScreenUtil().setWidth(40),
  367 +// height: ScreenUtil().setWidth(40),
  368 +// ),
  369 +// onTap: () {
  370 +// //已经传到服务器,弹提醒窗口,是否删除
  371 +// //修改之前有内容,则弹框
  372 +// DialogUtil.cupertinoAlertDialog(context,
  373 +// title: "", content: "是否确定删除该照片?", lCallback: () {
  374 +// print("取消");
  375 +// }, rCallback: () {
  376 +// _uploadImageProvider.firstImage.qiniuUrl = null;
  377 +// _uploadImageProvider.firstImage.file = null;
  378 +// _uploadImageProvider.firstImage.isUpload = false;
  379 +// _uploadImageProvider.firstImage.process = 0.01;
  380 +// setState(() {});
  381 +// });
  382 +// },
  383 +// ))
  384 +// ]),
  385 +// _uploadImageProvider.firstImage.process == 1
  386 +// ? Container(
  387 +// width: w(150),
  388 +// height: w(30),
  389 +// color: MyColours.color_4D000000,
  390 +// alignment: Alignment.center,
  391 +// margin: padding,
  392 +// child: Text(
  393 +// '点击图片可以更换',
  394 +// style: TextStyle(
  395 +// color: MyColours.color_F8F9FD,
  396 +// fontSize: font(14),
  397 +// fontWeight: FontWeight.bold),
  398 +// ))
  399 +// : SizedBox(),
  400 +// ]))
  401 +// : InkWell(
  402 +// onTap: () {
  403 +// // double process;
  404 +// // String qiniuUrl;
  405 +// // List<String> tempList = [];
  406 +// // if (title == '头像') {
  407 +// // process = _uploadImageProvider.touxiang.process;
  408 +// // qiniuUrl = _uploadImageProvider.touxiang.qiniuUrl;
  409 +// // } else {
  410 +// // process = _uploadImageProvider.erweima.process;
  411 +// // qiniuUrl = _uploadImageProvider.erweima.qiniuUrl;
  412 +// // }
  413 +
  414 +// // if (qiniuUrl != null && qiniuUrl != '') {
  415 +// // tempList.add(qiniuUrl);
  416 +
  417 +// // ///没有上传完成的不可以点击
  418 +// // _showPhotoView(context, 0, tempList);
  419 +// // } else {
  420 +// // Utils.getPickPermission(context, () {
  421 +// // _getFromPictureOrCamera(
  422 +// // _uploadImageProvider.firstImage, ImageSource.gallery);
  423 +// // }, Platform.isAndroid ? Permission.storage : Permission.photos);
  424 +// FocusScope.of(context).requestFocus(FocusNode());
  425 +// _openModalBottomSheet(context);
  426 +// },
  427 +// child: Container(
  428 +// color: MyColours.color_d9d9d9,
  429 +// width: double.infinity,
  430 +// height: w(_uploadImageProvider.imgSizefirstImage),
  431 +// margin: padding,
  432 +// child: Column(
  433 +// mainAxisAlignment: MainAxisAlignment.center,
  434 +// children: [
  435 +// // VEmptyView(80),
  436 +// Image.asset(
  437 +// Utils.getImgPath('add_img'),
  438 +// width: w(63),
  439 +// ),
  440 +// VEmptyView(28),
  441 +// Container(
  442 +// width: w(139),
  443 +// height: w(60),
  444 +// child: Text(
  445 +// '点击上传照片\n为了更好的效果\n建议上传4:3照片',
  446 +// textAlign: TextAlign.center,
  447 +// style: TextStyle(
  448 +// height: 1.4,
  449 +// color: MyColours.color_ffffff,
  450 +// fontSize: font(14),
  451 +// fontWeight: FontWeight.bold),
  452 +// ))
  453 +// ],
  454 +// ),
  455 +// ));
  456 +// }
  457 +
  458 +// ///无介绍
  459 +// Widget _noTextWidget() {
  460 +// return SizedBox();
  461 +// // return Column(
  462 +// // children: [
  463 +// // _uploadImage(),
  464 +// // VEmptyView(18),
  465 +// // ],
  466 +// // );
  467 +// }
  468 +
  469 +// ///图文分开
  470 +// Widget _separateWidget() {
  471 +// return Column(crossAxisAlignment: CrossAxisAlignment.start, children: [
  472 +// // _introduceWidget(EdgeInsets.all(w(15)),
  473 +// // boxDecoration: BoxDecoration(color: MyColours.color_ffffff)),
  474 +// // VEmptyView(18),
  475 +// _uploadImage(),
  476 +// ]);
  477 +// }
  478 +
  479 +// Widget _item(String title, {bool select, GestureTapCallback onTap}) {
  480 +// return InkWell(
  481 +// onTap: onTap,
  482 +// child: Container(
  483 +// decoration: BoxDecoration(
  484 +// border: Border(
  485 +// bottom: BorderSide(
  486 +// color: MyColours.color_E7E7E7, width: w(0.5)))),
  487 +// margin: EdgeInsets.only(left: w(16)),
  488 +// padding: EdgeInsets.only(top: w(12), bottom: w(12), right: w(16)),
  489 +// child: Row(
  490 +// children: [
  491 +// Text(
  492 +// title,
  493 +// style: TextStyle(
  494 +// color: MyColours.color_515151,
  495 +// fontSize: ScreenUtil().setWidth(32)),
  496 +// ),
  497 +// Spacer(),
  498 +// Container(
  499 +// padding:
  500 +// EdgeInsets.symmetric(horizontal: w(7), vertical: w(4)),
  501 +// child: Image.asset(
  502 +// Utils.getImgPath(select ? 'swich_on' : 'swich_off'),
  503 +// width: w(44),
  504 +// ),
  505 +// )
  506 +// ],
  507 +// )));
  508 +// }
  509 +
  510 +// @override
  511 +// Widget build(BuildContext context) {
  512 +// _uploadImageProvider =
  513 +// Provider.of<UploadImageProvider>(context, listen: true);
  514 +
  515 +// _marketingCenterProvider =
  516 +// Provider.of<MarketingCenterProvider>(context, listen: true);
  517 +// return KeyboardDismissOnTap(
  518 +// child: Scaffold(
  519 +// backgroundColor: MyColours.color_ffffff,
  520 +// appBar: SystemAppBar(
  521 +// '主厨介绍',
  522 +// onTap: () {
  523 +// if (Navigator.canPop(context)) {
  524 +// Navigator.pop(context);
  525 +// }
  526 +// },
  527 +// ),
  528 +// body: Column(
  529 +// children: [
  530 +// Expanded(
  531 +// child: SingleChildScrollView(
  532 +// child: Column(
  533 +// children: [
  534 +// // _selectBtnWidget(),
  535 +// // VEmptyView(24),
  536 +// // Container(
  537 +// // alignment: Alignment.centerLeft,
  538 +// // padding: EdgeInsets.only(left: w(16)),
  539 +// // height: w(48),
  540 +// // child: Text(
  541 +// // '效果预览',
  542 +// // style: TextStyle(
  543 +// // fontSize: font(16),
  544 +// // color: MyColours.color_515151),
  545 +// // ),
  546 +// // ),
  547 +// // VEmptyView(24),
  548 +// _item('预订安排通知中附加主厨文字介绍', select: addChefIntroduce,
  549 +// onTap: () {
  550 +// setState(() {
  551 +// addChefIntroduce = !addChefIntroduce;
  552 +// });
  553 +// }),
  554 +
  555 +// VEmptyView(24),
  556 +// //输入框
  557 +// Container(
  558 +// width: double.infinity,
  559 +// margin: EdgeInsets.symmetric(
  560 +// horizontal: ScreenUtil().setWidth(40)),
  561 +// padding: EdgeInsets.symmetric(
  562 +// horizontal: ScreenUtil().setWidth(40),
  563 +// vertical: ScreenUtil().setWidth(20)),
  564 +// alignment: Alignment.topLeft,
  565 +// decoration: BoxDecoration(
  566 +// color: MyColours.color_ffffff,
  567 +// border: Border.all(
  568 +// color: MyColours.color_DBDBDB,
  569 +// width: ScreenUtil().setWidth(2)),
  570 +// borderRadius: BorderRadius.circular(
  571 +// ScreenUtil().setWidth(20))),
  572 +// child: TextField(
  573 +// controller: chefIntroduceC,
  574 +// focusNode: chefIntroduceNode,
  575 +// style: TextStyle(
  576 +// color: MyColours.color_515151,
  577 +// fontSize: ScreenUtil().setSp(28),
  578 +// textBaseline: TextBaseline.alphabetic),
  579 +// textAlignVertical: TextAlignVertical.center,
  580 +// maxLines: 5,
  581 +// maxLength: 100,
  582 +// decoration: InputDecoration(
  583 +// hintText: "点击录入餐厅介绍文字信息,最多100个汉字。",
  584 +// hintStyle: TextStyle(
  585 +// color: MyColours.color_999999,
  586 +// fontSize: ScreenUtil().setSp(28),
  587 +// ),
  588 +// contentPadding: EdgeInsets.zero,
  589 +// border: OutlineInputBorder(
  590 +// borderSide: BorderSide.none),
  591 +// ),
  592 +// keyboardType: TextInputType.multiline,
  593 +// onChanged: (value) {
  594 +// setState(() {
  595 +// // currentRemark = value ?? "";
  596 +// });
  597 +// }),
  598 +// ),
  599 +// VEmptyView(24),
  600 +// Padding(
  601 +// padding: EdgeInsets.symmetric(horizontal: w(20)),
  602 +// child: MyDivider(
  603 +// double.infinity,
  604 +// w(0.5),
  605 +// color: MyColours.color_DBDBDB,
  606 +// )),
  607 +// VEmptyView(24),
  608 +// // _selectBtnWidget(),
  609 +// _item('预订安排通知中附加主厨介绍图片', select: addChefImge, onTap: () {
  610 +// setState(() {
  611 +// addChefImge = !addChefImge;
  612 +// });
  613 +// }),
  614 +
  615 +// VEmptyView(24),
  616 +// _separateWidget(),
  617 +// VEmptyView(24),
  618 +// _item('主厨介绍文字显示在图片上', select: addAbove, onTap: () {
  619 +// setState(() {
  620 +// addAbove = !addAbove;
  621 +// });
  622 +// }),
  623 +
  624 +// VEmptyView(24),
  625 +// ],
  626 +// ),
  627 +// )),
  628 +// Container(
  629 +// color: MyColours.color_ffffff,
  630 +// padding: EdgeInsets.only(
  631 +// left: w(45), right: w(45), top: w(12), bottom: w(25)),
  632 +// child: RoundButton(
  633 +// text: '保存',
  634 +// gradientStart: MyColours.color_199095,
  635 +// gradientEnd: MyColours.color_199095,
  636 +// // borderColor: MyColours.color_999999,
  637 +// radius: r(5),
  638 +// fontSize: 34,
  639 +// height: w(40),
  640 +// isBold: true,
  641 +// onPressed: () async {
  642 +// FocusScope.of(context)
  643 +// .requestFocus(FocusNode()); //点击空白处隐藏键盘
  644 +
  645 +// if (addChefIntroduce &&
  646 +// chefIntroduceC.text.trim().length == 0) {
  647 +// Utils.showToast('请输入主厨介绍文字!');
  648 +// return false;
  649 +// }
  650 +// if (addChefImge &&
  651 +// _uploadImageProvider.firstImage.qiniuUrl == null) {
  652 +// Utils.showToast('请上传图片!');
  653 +// return false;
  654 +// }
  655 +
  656 +// if (addChefImge &&
  657 +// _uploadImageProvider.firstImage.process < 1) {
  658 +// Utils.showToast('正在上传图片,请稍等');
  659 +// return false;
  660 +// }
  661 +
  662 +// // List<String> images = [];
  663 +// // if (_uploadImageProvider.storeImage1.qiniuUrl != null &&
  664 +// // _uploadImageProvider.storeImage1.qiniuUrl != '') {
  665 +// // images.add(_uploadImageProvider.storeImage1.qiniuUrl);
  666 +// // }
  667 +// // if (_uploadImageProvider.storeImage2.qiniuUrl != null &&
  668 +// // _uploadImageProvider.storeImage2.qiniuUrl != '') {
  669 +// // images.add(_uploadImageProvider.storeImage2.qiniuUrl);
  670 +// // }
  671 +// // if (_uploadImageProvider.storeImage3.qiniuUrl != null &&
  672 +// // _uploadImageProvider.storeImage3.qiniuUrl != '') {
  673 +// // images.add(_uploadImageProvider.storeImage3.qiniuUrl);
  674 +// // }
  675 +// // if (_uploadImageProvider.storeImage3.qiniuUrl != null &&
  676 +// // _uploadImageProvider.storeImage3.qiniuUrl != '') {
  677 +// // images.add(_uploadImageProvider.storeImage3.qiniuUrl);
  678 +// // }
  679 +// // if (images.length == 0) {
  680 +// // Utils.showToast('请至少上传一张图片!');
  681 +// // return false;
  682 +// // }
  683 +
  684 +// //接口
  685 +// Map chefData = {
  686 +// 'introduce': chefIntroduceC.text,
  687 +// 'image': _uploadImageProvider.firstImage.qiniuUrl,
  688 +// 'is_introduce': addChefIntroduce ? '1' : '0',
  689 +// 'is_images': addChefImge ? '1' : '0',
  690 +// 'is_above': addAbove ? '1' : '0'
  691 +// };
  692 +
  693 +// Map<String, String> params = {
  694 +// 'sid': Provider.of<UserModel>(context, listen: false)
  695 +// .user
  696 +// .sellerid,
  697 +// 'chef': json.encode(chefData)
  698 +// };
  699 +
  700 +// bool success = await _marketingCenterProvider
  701 +// .setSellerTemplateConf(context, params,
  702 +// showLoading: true);
  703 +// if (success) {
  704 +// // imgAll和images 比较,挑出不一样的,删除七牛云
  705 +// Set<String> difference = Set.from(imgAll)
  706 +// ..removeAll(
  707 +// [_uploadImageProvider.firstImage.qiniuUrl]);
  708 +// List<String> differenceList =
  709 +// difference.toList(); //需要删除的图片
  710 +// if (differenceList.length > 0) {
  711 +// String delImgs =
  712 +// Utils.listToStringEnglish(differenceList);
  713 +
  714 +// _uploadImageProvider.deleteImg(context, delImgs,
  715 +// needToast: false);
  716 +// }
  717 +// Utils.showToast('保存成功');
  718 +// if (Navigator.canPop(context)) {
  719 +// Navigator.pop(context);
  720 +// }
  721 +// }
  722 +// },
  723 +// ),
  724 +// )
  725 +// ],
  726 +// )));
  727 +// }
  728 +// }