Commit ee8fa1e15de2934e05974f099c63dcc59f177ec9

Authored by wdn127929
1 parent 842836d6

iOS视频[拍摄,麦克风权限申请 && 优惠券菜品图5:4裁剪压缩

@@ -78,6 +78,7 @@ post_install do |installer| @@ -78,6 +78,7 @@ post_install do |installer|
78 'PERMISSION_NOTIFICATIONS=1', 78 'PERMISSION_NOTIFICATIONS=1',
79 # dart: PermissionGroup.mediaLibrary 79 # dart: PermissionGroup.mediaLibrary
80 'PERMISSION_MEDIA_LIBRARY=1', 80 'PERMISSION_MEDIA_LIBRARY=1',
  81 + 'PERMISSION_MICROPHONE=1',
81 ] 82 ]
82 end 83 end
83 end 84 end
@@ -402,6 +402,6 @@ SPEC CHECKSUMS: @@ -402,6 +402,6 @@ SPEC CHECKSUMS:
402 webview_flutter: 3603125dfd3bcbc9d8d418c3f80aeecf331c068b 402 webview_flutter: 3603125dfd3bcbc9d8d418c3f80aeecf331c068b
403 WechatOpenSDK-XCFramework: 36fb2bea0754266c17184adf4963d7e6ff98b69f 403 WechatOpenSDK-XCFramework: 36fb2bea0754266c17184adf4963d7e6ff98b69f
404 404
405 -PODFILE CHECKSUM: 9f0bd7dbe9f70039fe4541e505d6b5d2ad23ffd6 405 +PODFILE CHECKSUM: 1cefd2e71f0fcfa4f2430db723fe500dadb93e92
406 406
407 COCOAPODS: 1.16.2 407 COCOAPODS: 1.16.2
@@ -3,7 +3,7 @@ @@ -3,7 +3,7 @@
3 archiveVersion = 1; 3 archiveVersion = 1;
4 classes = { 4 classes = {
5 }; 5 };
6 - objectVersion = 46; 6 + objectVersion = 50;
7 objects = { 7 objects = {
8 8
9 /* Begin PBXBuildFile section */ 9 /* Begin PBXBuildFile section */
@@ -547,9 +547,9 @@ @@ -547,9 +547,9 @@
547 CLANG_ENABLE_MODULES = YES; 547 CLANG_ENABLE_MODULES = YES;
548 CODE_SIGN_ENTITLEMENTS = Runner/RunnerProfile.entitlements; 548 CODE_SIGN_ENTITLEMENTS = Runner/RunnerProfile.entitlements;
549 CODE_SIGN_IDENTITY = "Apple Development"; 549 CODE_SIGN_IDENTITY = "Apple Development";
550 - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Distribution"; 550 + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
551 CODE_SIGN_STYLE = Manual; 551 CODE_SIGN_STYLE = Manual;
552 - CURRENT_PROJECT_VERSION = 534; 552 + CURRENT_PROJECT_VERSION = 5420;
553 DEVELOPMENT_TEAM = 8J59HM8B82; 553 DEVELOPMENT_TEAM = 8J59HM8B82;
554 "DEVELOPMENT_TEAM[sdk=iphoneos*]" = 8J59HM8B82; 554 "DEVELOPMENT_TEAM[sdk=iphoneos*]" = 8J59HM8B82;
555 ENABLE_BITCODE = NO; 555 ENABLE_BITCODE = NO;
@@ -566,12 +566,12 @@ @@ -566,12 +566,12 @@
566 "$(inherited)", 566 "$(inherited)",
567 "$(PROJECT_DIR)/Flutter", 567 "$(PROJECT_DIR)/Flutter",
568 ); 568 );
569 - MARKETING_VERSION = 5.3.4; 569 + MARKETING_VERSION = 5.4.2;
570 PODS_ROOT = "$(inherited)"; 570 PODS_ROOT = "$(inherited)";
571 PRODUCT_BUNDLE_IDENTIFIER = com.naji.reserveLine; 571 PRODUCT_BUNDLE_IDENTIFIER = com.naji.reserveLine;
572 PRODUCT_NAME = Runner; 572 PRODUCT_NAME = Runner;
573 PROVISIONING_PROFILE_SPECIFIER = "11.12 naji"; 573 PROVISIONING_PROFILE_SPECIFIER = "11.12 naji";
574 - "PROVISIONING_PROFILE_SPECIFIER[sdk=iphoneos*]" = "11.12 naji appstore"; 574 + "PROVISIONING_PROFILE_SPECIFIER[sdk=iphoneos*]" = "11.12 naji";
575 SWIFT_ENABLE_BATCH_MODE = NO; 575 SWIFT_ENABLE_BATCH_MODE = NO;
576 SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; 576 SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
577 SWIFT_VERSION = 5.0; 577 SWIFT_VERSION = 5.0;
@@ -701,13 +701,13 @@ @@ -701,13 +701,13 @@
701 CLANG_ENABLE_MODULES = YES; 701 CLANG_ENABLE_MODULES = YES;
702 CODE_SIGN_ENTITLEMENTS = "Runner/一键订Debug.entitlements"; 702 CODE_SIGN_ENTITLEMENTS = "Runner/一键订Debug.entitlements";
703 CODE_SIGN_IDENTITY = "Apple Development"; 703 CODE_SIGN_IDENTITY = "Apple Development";
704 - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Distribution"; 704 + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
705 CODE_SIGN_STYLE = Manual; 705 CODE_SIGN_STYLE = Manual;
706 - CURRENT_PROJECT_VERSION = 534; 706 + CURRENT_PROJECT_VERSION = 5420;
707 DEVELOPMENT_TEAM = 8J59HM8B82; 707 DEVELOPMENT_TEAM = 8J59HM8B82;
708 "DEVELOPMENT_TEAM[sdk=iphoneos*]" = 8J59HM8B82; 708 "DEVELOPMENT_TEAM[sdk=iphoneos*]" = 8J59HM8B82;
709 ENABLE_BITCODE = NO; 709 ENABLE_BITCODE = NO;
710 - FLUTTER_BUILD_MODE = release; 710 + FLUTTER_BUILD_MODE = debug;
711 FLUTTER_ROOT = /Users/naji2021/Documents/flutter; 711 FLUTTER_ROOT = /Users/naji2021/Documents/flutter;
712 FLUTTER_TARGET = "/Users/naji2021/Desktop/Flutter-ReserveApp/lib/main.dart"; 712 FLUTTER_TARGET = "/Users/naji2021/Desktop/Flutter-ReserveApp/lib/main.dart";
713 FRAMEWORK_SEARCH_PATHS = ( 713 FRAMEWORK_SEARCH_PATHS = (
@@ -721,13 +721,13 @@ @@ -721,13 +721,13 @@
721 "$(inherited)", 721 "$(inherited)",
722 "$(PROJECT_DIR)/Flutter", 722 "$(PROJECT_DIR)/Flutter",
723 ); 723 );
724 - MARKETING_VERSION = 5.3.4; 724 + MARKETING_VERSION = 5.4.2;
725 PACKAGE_CONFIG = "/Users/naji2021/Desktop/Flutter-ReserveApp/.dart_tool/package_config.json"; 725 PACKAGE_CONFIG = "/Users/naji2021/Desktop/Flutter-ReserveApp/.dart_tool/package_config.json";
726 PODS_ROOT = "$(inherited)"; 726 PODS_ROOT = "$(inherited)";
727 PRODUCT_BUNDLE_IDENTIFIER = com.naji.reserveLine; 727 PRODUCT_BUNDLE_IDENTIFIER = com.naji.reserveLine;
728 PRODUCT_NAME = Runner; 728 PRODUCT_NAME = Runner;
729 PROVISIONING_PROFILE_SPECIFIER = "11.12 naji"; 729 PROVISIONING_PROFILE_SPECIFIER = "11.12 naji";
730 - "PROVISIONING_PROFILE_SPECIFIER[sdk=iphoneos*]" = "11.12 naji appstore"; 730 + "PROVISIONING_PROFILE_SPECIFIER[sdk=iphoneos*]" = "11.12 naji";
731 SWIFT_ENABLE_BATCH_MODE = NO; 731 SWIFT_ENABLE_BATCH_MODE = NO;
732 SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; 732 SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
733 SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 733 SWIFT_OPTIMIZATION_LEVEL = "-Onone";
@@ -746,9 +746,9 @@ @@ -746,9 +746,9 @@
746 CLANG_ENABLE_MODULES = YES; 746 CLANG_ENABLE_MODULES = YES;
747 CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; 747 CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
748 CODE_SIGN_IDENTITY = "Apple Development"; 748 CODE_SIGN_IDENTITY = "Apple Development";
749 - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Distribution"; 749 + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
750 CODE_SIGN_STYLE = Manual; 750 CODE_SIGN_STYLE = Manual;
751 - CURRENT_PROJECT_VERSION = 534; 751 + CURRENT_PROJECT_VERSION = 5420;
752 DEVELOPMENT_TEAM = 8J59HM8B82; 752 DEVELOPMENT_TEAM = 8J59HM8B82;
753 "DEVELOPMENT_TEAM[sdk=iphoneos*]" = 8J59HM8B82; 753 "DEVELOPMENT_TEAM[sdk=iphoneos*]" = 8J59HM8B82;
754 ENABLE_BITCODE = NO; 754 ENABLE_BITCODE = NO;
@@ -765,12 +765,12 @@ @@ -765,12 +765,12 @@
765 "$(inherited)", 765 "$(inherited)",
766 "$(PROJECT_DIR)/Flutter", 766 "$(PROJECT_DIR)/Flutter",
767 ); 767 );
768 - MARKETING_VERSION = 5.3.4; 768 + MARKETING_VERSION = 5.4.2;
769 PODS_ROOT = "$(inherited)"; 769 PODS_ROOT = "$(inherited)";
770 PRODUCT_BUNDLE_IDENTIFIER = com.naji.reserveLine; 770 PRODUCT_BUNDLE_IDENTIFIER = com.naji.reserveLine;
771 PRODUCT_NAME = Runner; 771 PRODUCT_NAME = Runner;
772 PROVISIONING_PROFILE_SPECIFIER = "11.12 naji"; 772 PROVISIONING_PROFILE_SPECIFIER = "11.12 naji";
773 - "PROVISIONING_PROFILE_SPECIFIER[sdk=iphoneos*]" = "11.12 naji appstore"; 773 + "PROVISIONING_PROFILE_SPECIFIER[sdk=iphoneos*]" = "11.12 naji";
774 SWIFT_ENABLE_BATCH_MODE = NO; 774 SWIFT_ENABLE_BATCH_MODE = NO;
775 SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; 775 SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
776 SWIFT_VERSION = 5.0; 776 SWIFT_VERSION = 5.0;
@@ -78,6 +78,9 @@ @@ -78,6 +78,9 @@
78 <key>NSAllowsArbitraryLoads</key> 78 <key>NSAllowsArbitraryLoads</key>
79 <true/> 79 <true/>
80 </dict> 80 </dict>
  81 +
  82 + <key>NSMicrophoneUsageDescription</key>
  83 + <string>需要您的同意,APP才能使用您的麦克风来录制店铺视频介绍</string>
81 <key>NSAppleMusicUsageDescription</key> 84 <key>NSAppleMusicUsageDescription</key>
82 <string>需要您的同意,APP才能访问媒体资料库</string> 85 <string>需要您的同意,APP才能访问媒体资料库</string>
83 <key>NSCalendarsUsageDescription</key> 86 <key>NSCalendarsUsageDescription</key>
@@ -337,11 +337,20 @@ class MarkStoreModel { @@ -337,11 +337,20 @@ class MarkStoreModel {
337 337
338 if (json['content'] != null) { 338 if (json['content'] != null) {
339 content = []; 339 content = [];
340 - if (jsonDecode(json['content']) is List) {  
341 - List temp = jsonDecode(json['content']); 340 +
  341 +
  342 + if (json['content'] is List) {
  343 + List temp = json['content'];
342 temp.forEach((element) { 344 temp.forEach((element) {
343 content.add(ContentModel.fromJson(element)); 345 content.add(ContentModel.fromJson(element));
344 }); 346 });
  347 + } else {
  348 + if (jsonDecode(json['content']) is List) {
  349 + List temp = jsonDecode(json['content']);
  350 + temp.forEach((element) {
  351 + content.add(ContentModel.fromJson(element));
  352 + });
  353 + }
345 } 354 }
346 } 355 }
347 356
@@ -408,11 +417,18 @@ class MarkChefModel { @@ -408,11 +417,18 @@ class MarkChefModel {
408 isImages = json['is_images']; 417 isImages = json['is_images'];
409 if (json['content'] != null) { 418 if (json['content'] != null) {
410 content = []; 419 content = [];
411 - if (jsonDecode(json['content']) is List) {  
412 - List temp = jsonDecode(json['content']); 420 + if (json['content'] is List) {
  421 + List temp = json['content'];
413 temp.forEach((element) { 422 temp.forEach((element) {
414 content.add(ContentModel.fromJson(element)); 423 content.add(ContentModel.fromJson(element));
415 }); 424 });
  425 + } else {
  426 + if (jsonDecode(json['content']) is List) {
  427 + List temp = jsonDecode(json['content']);
  428 + temp.forEach((element) {
  429 + content.add(ContentModel.fromJson(element));
  430 + });
  431 + }
416 } 432 }
417 } 433 }
418 434
@@ -466,11 +482,18 @@ class MarkSignboardModel { @@ -466,11 +482,18 @@ class MarkSignboardModel {
466 } 482 }
467 if (json['content'] != null) { 483 if (json['content'] != null) {
468 content = []; 484 content = [];
469 - if (jsonDecode(json['content']) is List) {  
470 - List temp = jsonDecode(json['content']); 485 + if (json['content'] is List) {
  486 + List temp = json['content'];
471 temp.forEach((element) { 487 temp.forEach((element) {
472 content.add(ContentModel.fromJson(element)); 488 content.add(ContentModel.fromJson(element));
473 }); 489 });
  490 + } else {
  491 + if (jsonDecode(json['content']) is List) {
  492 + List temp = jsonDecode(json['content']);
  493 + temp.forEach((element) {
  494 + content.add(ContentModel.fromJson(element));
  495 + });
  496 + }
474 } 497 }
475 } 498 }
476 499
@@ -93,9 +93,10 @@ class _ChefIntroducePageState extends State<ChefIntroducePage> { @@ -93,9 +93,10 @@ class _ChefIntroducePageState extends State<ChefIntroducePage> {
93 FocusNode titleCNode = FocusNode(); 93 FocusNode titleCNode = FocusNode();
94 final picker = ImagePicker(); 94 final picker = ImagePicker();
95 95
96 - Subscription _subscription; //展示压缩进度 96 +
97 97
98 bool showCompress = false; 98 bool showCompress = false;
  99 + // String compressProcess = '压缩进度:';
99 100
100 @override 101 @override
101 void initState() { 102 void initState() {
@@ -1252,20 +1253,37 @@ class _ChefIntroducePageState extends State<ChefIntroducePage> { @@ -1252,20 +1253,37 @@ class _ChefIntroducePageState extends State<ChefIntroducePage> {
1252 children: <Widget>[ 1253 children: <Widget>[
1253 InkWell( 1254 InkWell(
1254 onTap: () { 1255 onTap: () {
1255 - Utils.getPickPermission(context, () { 1256 + if (Platform.isAndroid) {
  1257 + Utils.getPickPermission(context, () {
  1258 + if (fileType == FileType.image) {
  1259 + _getFromPictureOrCamera(index, ImageSource.camera);
  1260 + } else {
  1261 + _getVideoFromPictureOrCamera(ImageSource.camera);
  1262 + }
  1263 + if (Navigator.canPop(context)) {
  1264 + Navigator.pop(context);
  1265 + }
  1266 + }, Permission.storage);
  1267 + } else {
1256 if (fileType == FileType.image) { 1268 if (fileType == FileType.image) {
1257 - _getFromPictureOrCamera(index, ImageSource.camera); 1269 + Utils.getPickPermission(context, () {
  1270 + _getFromPictureOrCamera(index, ImageSource.camera);
  1271 +
  1272 + if (Navigator.canPop(context)) {
  1273 + Navigator.pop(context);
  1274 + }
  1275 + }, Permission.photos);
1258 } else { 1276 } else {
1259 - _getVideoFromPictureOrCamera(ImageSource.camera);  
1260 - }  
1261 - if (Navigator.canPop(context)) {  
1262 - Navigator.pop(context); 1277 + Utils.getPickPermission(context, () async {
  1278 + Utils.getPickPermission(context, () {
  1279 + _getVideoFromPictureOrCamera(ImageSource.camera);
  1280 + if (Navigator.canPop(context)) {
  1281 + Navigator.pop(context);
  1282 + }
  1283 + }, Permission.microphone);
  1284 + }, Permission.camera);
1263 } 1285 }
1264 - },  
1265 - Platform.isAndroid  
1266 - ? Permission.storage  
1267 - : Permission.photos);  
1268 - 1286 + }
1269 // Utils.getPickPermission(context, () { 1287 // Utils.getPickPermission(context, () {
1270 // if (fileType == FileType.image) { 1288 // if (fileType == FileType.image) {
1271 // _getImageFromPictureOrCamera(ImageSource.camera); 1289 // _getImageFromPictureOrCamera(ImageSource.camera);
@@ -1427,24 +1445,29 @@ class _ChefIntroducePageState extends State<ChefIntroducePage> { @@ -1427,24 +1445,29 @@ class _ChefIntroducePageState extends State<ChefIntroducePage> {
1427 //是否需要压缩 1445 //是否需要压缩
1428 bool need = await VideoUtils.shouldCompress(pickedFile.path); 1446 bool need = await VideoUtils.shouldCompress(pickedFile.path);
1429 if (need) { 1447 if (need) {
  1448 + Subscription _subscription; //展示压缩进度
1430 showCompress = true; 1449 showCompress = true;
1431 setState(() {}); 1450 setState(() {});
1432 //需要压缩 1451 //需要压缩
1433 // 订阅压缩进度 1452 // 订阅压缩进度
1434 _subscription = VideoCompress.compressProgress$.subscribe((progress) { 1453 _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 // 回调进度给外部 1454 // 回调进度给外部
1443 - // if (onProgress != null) {  
1444 - // onProgress!(progress);  
1445 - // }  
1446 - }); 1455 + debugPrint('progress: $progress');
  1456 + // compressProcess = '压缩进度: ${progress.toStringAsFixed(1)}%';
  1457 + setState(() {});
  1458 + }, onDone: () {}, onError: (error) {}, cancelOnError: true);
1447 file = await VideoUtils.compress(pickedFile.path); //压缩后的文件 1459 file = await VideoUtils.compress(pickedFile.path); //压缩后的文件
  1460 + if (file != null) {
  1461 + //压缩完成
  1462 + showCompress = false;
  1463 + _subscription.unsubscribe(); // 取消订阅
  1464 + setState(() {});
  1465 + } else {
  1466 + data.removeLast();
  1467 + _subscription.unsubscribe(); // 取消订阅
  1468 + setState(() {});
  1469 + throw Exception('Failed to compress video');
  1470 + }
1448 } 1471 }
1449 //开始上传任务 1472 //开始上传任务
1450 UploadImageUtil().startUploadOnlyAddition( 1473 UploadImageUtil().startUploadOnlyAddition(
@@ -1718,7 +1741,7 @@ class _ChefIntroducePageState extends State<ChefIntroducePage> { @@ -1718,7 +1741,7 @@ class _ChefIntroducePageState extends State<ChefIntroducePage> {
1718 ), 1741 ),
1719 VEmptyView(24), 1742 VEmptyView(24),
1720 Text( 1743 Text(
1721 - '注:\n1. 为了保证客户访问速度,只能有1个视频,时常不超过2分钟\n2. 上下拖动可以调整展示顺序', 1744 + '注:\n1. 为了保证客户访问速度,只能有1个视频,时常不超过30秒\n2. 上下拖动可以调整展示顺序',
1722 style: TextStyle( 1745 style: TextStyle(
1723 height: 1.5, 1746 height: 1.5,
1724 color: MyColours.color_999999, 1747 color: MyColours.color_999999,
@@ -93,7 +93,7 @@ class _DishShowPageState extends State<DishShowPage> { @@ -93,7 +93,7 @@ class _DishShowPageState extends State<DishShowPage> {
93 FocusNode titleCNode = FocusNode(); 93 FocusNode titleCNode = FocusNode();
94 final picker = ImagePicker(); 94 final picker = ImagePicker();
95 95
96 - Subscription _subscription; //展示压缩进度 96 + // String compressProcess = '压缩进度:';
97 97
98 bool showCompress = false; 98 bool showCompress = false;
99 99
@@ -1257,19 +1257,37 @@ class _DishShowPageState extends State<DishShowPage> { @@ -1257,19 +1257,37 @@ class _DishShowPageState extends State<DishShowPage> {
1257 children: <Widget>[ 1257 children: <Widget>[
1258 InkWell( 1258 InkWell(
1259 onTap: () { 1259 onTap: () {
1260 - Utils.getPickPermission(context, () { 1260 + if (Platform.isAndroid) {
  1261 + Utils.getPickPermission(context, () {
  1262 + if (fileType == FileType.image) {
  1263 + _getFromPictureOrCamera(index, ImageSource.camera);
  1264 + } else {
  1265 + _getVideoFromPictureOrCamera(ImageSource.camera);
  1266 + }
  1267 + if (Navigator.canPop(context)) {
  1268 + Navigator.pop(context);
  1269 + }
  1270 + }, Permission.storage);
  1271 + } else {
1261 if (fileType == FileType.image) { 1272 if (fileType == FileType.image) {
1262 - _getFromPictureOrCamera(index, ImageSource.camera); 1273 + Utils.getPickPermission(context, () {
  1274 + _getFromPictureOrCamera(index, ImageSource.camera);
  1275 +
  1276 + if (Navigator.canPop(context)) {
  1277 + Navigator.pop(context);
  1278 + }
  1279 + }, Permission.photos);
1263 } else { 1280 } else {
1264 - _getVideoFromPictureOrCamera(ImageSource.camera);  
1265 - }  
1266 - if (Navigator.canPop(context)) {  
1267 - Navigator.pop(context); 1281 + Utils.getPickPermission(context, () async {
  1282 + Utils.getPickPermission(context, () {
  1283 + _getVideoFromPictureOrCamera(ImageSource.camera);
  1284 + if (Navigator.canPop(context)) {
  1285 + Navigator.pop(context);
  1286 + }
  1287 + }, Permission.microphone);
  1288 + }, Permission.camera);
1268 } 1289 }
1269 - },  
1270 - Platform.isAndroid  
1271 - ? Permission.storage  
1272 - : Permission.photos); 1290 + }
1273 1291
1274 // Utils.getPickPermission(context, () { 1292 // Utils.getPickPermission(context, () {
1275 // if (fileType == FileType.image) { 1293 // if (fileType == FileType.image) {
@@ -1431,25 +1449,30 @@ class _DishShowPageState extends State<DishShowPage> { @@ -1431,25 +1449,30 @@ class _DishShowPageState extends State<DishShowPage> {
1431 File file = File(pickedFile.path); 1449 File file = File(pickedFile.path);
1432 //是否需要压缩 1450 //是否需要压缩
1433 bool need = await VideoUtils.shouldCompress(pickedFile.path); 1451 bool need = await VideoUtils.shouldCompress(pickedFile.path);
1434 - if (need) { 1452 + if (need) {
  1453 + Subscription _subscription; //展示压缩进度
1435 showCompress = true; 1454 showCompress = true;
1436 setState(() {}); 1455 setState(() {});
1437 //需要压缩 1456 //需要压缩
1438 // 订阅压缩进度 1457 // 订阅压缩进度
1439 _subscription = VideoCompress.compressProgress$.subscribe((progress) { 1458 _subscription = VideoCompress.compressProgress$.subscribe((progress) {
1440 - debugPrint('progress: $progress');  
1441 - if (progress.toInt() == 100) {  
1442 - //压缩完成  
1443 - showCompress = false;  
1444 - _subscription.unsubscribe(); // 取消订阅  
1445 - setState(() {});  
1446 - }  
1447 // 回调进度给外部 1459 // 回调进度给外部
1448 - // if (onProgress != null) {  
1449 - // onProgress!(progress);  
1450 - // }  
1451 - }); 1460 + debugPrint('progress: $progress');
  1461 + // compressProcess = '压缩进度: ${progress.toStringAsFixed(1)}%';
  1462 + setState(() {});
  1463 + }, onDone: () {}, onError: (error) {}, cancelOnError: true);
1452 file = await VideoUtils.compress(pickedFile.path); //压缩后的文件 1464 file = await VideoUtils.compress(pickedFile.path); //压缩后的文件
  1465 + if (file != null) {
  1466 + //压缩完成
  1467 + showCompress = false;
  1468 + _subscription.unsubscribe(); // 取消订阅
  1469 + setState(() {});
  1470 + } else {
  1471 + data.removeLast();
  1472 + _subscription.unsubscribe(); // 取消订阅
  1473 + setState(() {});
  1474 + throw Exception('Failed to compress video');
  1475 + }
1453 } 1476 }
1454 //开始上传任务 1477 //开始上传任务
1455 UploadImageUtil().startUploadOnlyAddition( 1478 UploadImageUtil().startUploadOnlyAddition(
@@ -1722,7 +1745,7 @@ class _DishShowPageState extends State<DishShowPage> { @@ -1722,7 +1745,7 @@ class _DishShowPageState extends State<DishShowPage> {
1722 ), 1745 ),
1723 VEmptyView(24), 1746 VEmptyView(24),
1724 Text( 1747 Text(
1725 - '注:\n1. 为了保证客户访问速度,只能有1个视频,时常不超过2分钟\n2. 上下拖动可以调整展示顺序', 1748 + '注:\n1. 为了保证客户访问速度,只能有1个视频,时常不超过30秒\n2. 上下拖动可以调整展示顺序',
1726 style: TextStyle( 1749 style: TextStyle(
1727 height: 1.5, 1750 height: 1.5,
1728 color: MyColours.color_999999, 1751 color: MyColours.color_999999,
@@ -92,7 +92,7 @@ class _ParkInfoPageState extends State<ParkInfoPage> { @@ -92,7 +92,7 @@ class _ParkInfoPageState extends State<ParkInfoPage> {
92 FocusNode titleCNode = FocusNode(); 92 FocusNode titleCNode = FocusNode();
93 final picker = ImagePicker(); 93 final picker = ImagePicker();
94 94
95 - Subscription _subscription; //展示压缩进度 95 + // String compressProcess = '压缩进度:';
96 96
97 bool showCompress = false; 97 bool showCompress = false;
98 98
@@ -164,10 +164,11 @@ class _ParkInfoPageState extends State<ParkInfoPage> { @@ -164,10 +164,11 @@ class _ParkInfoPageState extends State<ParkInfoPage> {
164 ? true 164 ? true
165 : false; 165 : false;
166 166
167 - if (marketingCenterProvider.markDataModel.reserve.parkInfo != null &&marketingCenterProvider.markDataModel.reserve.parkInfo  
168 - .trim()  
169 - .length >  
170 - 0) { 167 + if (marketingCenterProvider.markDataModel.reserve.parkInfo != null &&
  168 + marketingCenterProvider.markDataModel.reserve.parkInfo
  169 + .trim()
  170 + .length >
  171 + 0) {
171 //文字 172 //文字
172 173
173 AdditionModel additionModel = AdditionModel(); 174 AdditionModel additionModel = AdditionModel();
@@ -1211,19 +1212,37 @@ class _ParkInfoPageState extends State<ParkInfoPage> { @@ -1211,19 +1212,37 @@ class _ParkInfoPageState extends State<ParkInfoPage> {
1211 children: <Widget>[ 1212 children: <Widget>[
1212 InkWell( 1213 InkWell(
1213 onTap: () { 1214 onTap: () {
1214 - Utils.getPickPermission(context, () { 1215 + if (Platform.isAndroid) {
  1216 + Utils.getPickPermission(context, () {
  1217 + if (fileType == FileType.image) {
  1218 + _getFromPictureOrCamera(index, ImageSource.camera);
  1219 + } else {
  1220 + _getVideoFromPictureOrCamera(ImageSource.camera);
  1221 + }
  1222 + if (Navigator.canPop(context)) {
  1223 + Navigator.pop(context);
  1224 + }
  1225 + }, Permission.storage);
  1226 + } else {
1215 if (fileType == FileType.image) { 1227 if (fileType == FileType.image) {
1216 - _getFromPictureOrCamera(index, ImageSource.camera); 1228 + Utils.getPickPermission(context, () {
  1229 + _getFromPictureOrCamera(index, ImageSource.camera);
  1230 +
  1231 + if (Navigator.canPop(context)) {
  1232 + Navigator.pop(context);
  1233 + }
  1234 + }, Permission.photos);
1217 } else { 1235 } else {
1218 - _getVideoFromPictureOrCamera(ImageSource.camera);  
1219 - }  
1220 - if (Navigator.canPop(context)) {  
1221 - Navigator.pop(context); 1236 + Utils.getPickPermission(context, () async {
  1237 + Utils.getPickPermission(context, () {
  1238 + _getVideoFromPictureOrCamera(ImageSource.camera);
  1239 + if (Navigator.canPop(context)) {
  1240 + Navigator.pop(context);
  1241 + }
  1242 + }, Permission.microphone);
  1243 + }, Permission.camera);
1222 } 1244 }
1223 - },  
1224 - Platform.isAndroid  
1225 - ? Permission.storage  
1226 - : Permission.photos); 1245 + }
1227 1246
1228 // Utils.getPickPermission(context, () { 1247 // Utils.getPickPermission(context, () {
1229 // if (fileType == FileType.image) { 1248 // if (fileType == FileType.image) {
@@ -1386,24 +1405,29 @@ class _ParkInfoPageState extends State<ParkInfoPage> { @@ -1386,24 +1405,29 @@ class _ParkInfoPageState extends State<ParkInfoPage> {
1386 //是否需要压缩 1405 //是否需要压缩
1387 bool need = await VideoUtils.shouldCompress(pickedFile.path); 1406 bool need = await VideoUtils.shouldCompress(pickedFile.path);
1388 if (need) { 1407 if (need) {
  1408 + Subscription _subscription; //展示压缩进度
1389 showCompress = true; 1409 showCompress = true;
1390 setState(() {}); 1410 setState(() {});
1391 //需要压缩 1411 //需要压缩
1392 // 订阅压缩进度 1412 // 订阅压缩进度
1393 _subscription = VideoCompress.compressProgress$.subscribe((progress) { 1413 _subscription = VideoCompress.compressProgress$.subscribe((progress) {
1394 - debugPrint('progress: $progress');  
1395 - if (progress.toInt() == 100) {  
1396 - //压缩完成  
1397 - showCompress = false;  
1398 - _subscription.unsubscribe(); // 取消订阅  
1399 - setState(() {});  
1400 - }  
1401 // 回调进度给外部 1414 // 回调进度给外部
1402 - // if (onProgress != null) {  
1403 - // onProgress!(progress);  
1404 - // }  
1405 - }); 1415 + debugPrint('progress: $progress');
  1416 + // compressProcess = '压缩进度: ${progress.toStringAsFixed(1)}%';
  1417 + setState(() {});
  1418 + }, onDone: () {}, onError: (error) {}, cancelOnError: true);
1406 file = await VideoUtils.compress(pickedFile.path); //压缩后的文件 1419 file = await VideoUtils.compress(pickedFile.path); //压缩后的文件
  1420 + if (file != null) {
  1421 + //压缩完成
  1422 + showCompress = false;
  1423 + _subscription.unsubscribe(); // 取消订阅
  1424 + setState(() {});
  1425 + } else {
  1426 + data.removeLast();
  1427 + _subscription.unsubscribe(); // 取消订阅
  1428 + setState(() {});
  1429 + throw Exception('Failed to compress video');
  1430 + }
1407 } 1431 }
1408 //开始上传任务 1432 //开始上传任务
1409 UploadImageUtil().startUploadOnlyAddition( 1433 UploadImageUtil().startUploadOnlyAddition(
@@ -1677,7 +1701,7 @@ class _ParkInfoPageState extends State<ParkInfoPage> { @@ -1677,7 +1701,7 @@ class _ParkInfoPageState extends State<ParkInfoPage> {
1677 ), 1701 ),
1678 VEmptyView(24), 1702 VEmptyView(24),
1679 Text( 1703 Text(
1680 - '注:\n1. 为了保证客户访问速度,只能有1个视频,时常不超过2分钟\n2. 上下拖动可以调整展示顺序', 1704 + '注:\n1. 为了保证客户访问速度,只能有1个视频,时常不超过30秒\n2. 上下拖动可以调整展示顺序',
1681 style: TextStyle( 1705 style: TextStyle(
1682 height: 1.5, 1706 height: 1.5,
1683 color: MyColours.color_999999, 1707 color: MyColours.color_999999,
@@ -93,9 +93,8 @@ class _StoreIntroducePageState extends State<StoreIntroducePage> { @@ -93,9 +93,8 @@ class _StoreIntroducePageState extends State<StoreIntroducePage> {
93 FocusNode titleCNode = FocusNode(); 93 FocusNode titleCNode = FocusNode();
94 final picker = ImagePicker(); 94 final picker = ImagePicker();
95 95
96 - Subscription _subscription; //展示压缩进度  
97 -  
98 bool showCompress = false; 96 bool showCompress = false;
  97 + // String compressProcess = '压缩进度:';
99 98
100 @override 99 @override
101 void initState() { 100 void initState() {
@@ -118,7 +117,7 @@ class _StoreIntroducePageState extends State<StoreIntroducePage> { @@ -118,7 +117,7 @@ class _StoreIntroducePageState extends State<StoreIntroducePage> {
118 // _uploadImageProvider.storeImage2 = UploadImgModel(); 117 // _uploadImageProvider.storeImage2 = UploadImgModel();
119 // _uploadImageProvider.storeImage3 = UploadImgModel(); 118 // _uploadImageProvider.storeImage3 = UploadImgModel();
120 // _uploadImageProvider.storeImage4 = UploadImgModel(); 119 // _uploadImageProvider.storeImage4 = UploadImgModel();
121 - 120 + // _subscription?.unsubscribe(); // 取消订阅
122 super.dispose(); 121 super.dispose();
123 } 122 }
124 123
@@ -1252,19 +1251,37 @@ class _StoreIntroducePageState extends State<StoreIntroducePage> { @@ -1252,19 +1251,37 @@ class _StoreIntroducePageState extends State<StoreIntroducePage> {
1252 children: <Widget>[ 1251 children: <Widget>[
1253 InkWell( 1252 InkWell(
1254 onTap: () { 1253 onTap: () {
1255 - Utils.getPickPermission(context, () { 1254 + if (Platform.isAndroid) {
  1255 + Utils.getPickPermission(context, () {
  1256 + if (fileType == FileType.image) {
  1257 + _getFromPictureOrCamera(index, ImageSource.camera);
  1258 + } else {
  1259 + _getVideoFromPictureOrCamera(ImageSource.camera);
  1260 + }
  1261 + if (Navigator.canPop(context)) {
  1262 + Navigator.pop(context);
  1263 + }
  1264 + }, Permission.storage);
  1265 + } else {
1256 if (fileType == FileType.image) { 1266 if (fileType == FileType.image) {
1257 - _getFromPictureOrCamera(index, ImageSource.camera); 1267 + Utils.getPickPermission(context, () {
  1268 + _getFromPictureOrCamera(index, ImageSource.camera);
  1269 +
  1270 + if (Navigator.canPop(context)) {
  1271 + Navigator.pop(context);
  1272 + }
  1273 + }, Permission.photos);
1258 } else { 1274 } else {
1259 - _getVideoFromPictureOrCamera(ImageSource.camera);  
1260 - }  
1261 - if (Navigator.canPop(context)) {  
1262 - Navigator.pop(context); 1275 + Utils.getPickPermission(context, () async {
  1276 + Utils.getPickPermission(context, () {
  1277 + _getVideoFromPictureOrCamera(ImageSource.camera);
  1278 + if (Navigator.canPop(context)) {
  1279 + Navigator.pop(context);
  1280 + }
  1281 + }, Permission.microphone);
  1282 + }, Permission.camera);
1263 } 1283 }
1264 - },  
1265 - Platform.isAndroid  
1266 - ? Permission.storage  
1267 - : Permission.photos); 1284 + }
1268 1285
1269 // Utils.getPickPermission(context, () { 1286 // Utils.getPickPermission(context, () {
1270 // if (fileType == FileType.image) { 1287 // if (fileType == FileType.image) {
@@ -1393,7 +1410,7 @@ class _StoreIntroducePageState extends State<StoreIntroducePage> { @@ -1393,7 +1410,7 @@ class _StoreIntroducePageState extends State<StoreIntroducePage> {
1393 String duration = '00:00'; 1410 String duration = '00:00';
1394 if (info != null) { 1411 if (info != null) {
1395 //限制视频时长 1412 //限制视频时长
1396 - if (info.duration > 120000 || info.duration < 0) { 1413 + if (info.duration >= 120000 || info.duration < 0) {
1397 Utils.showToast('请选择2分钟以内的视频'); 1414 Utils.showToast('请选择2分钟以内的视频');
1398 return; 1415 return;
1399 } 1416 }
@@ -1427,24 +1444,29 @@ class _StoreIntroducePageState extends State<StoreIntroducePage> { @@ -1427,24 +1444,29 @@ class _StoreIntroducePageState extends State<StoreIntroducePage> {
1427 //是否需要压缩 1444 //是否需要压缩
1428 bool need = await VideoUtils.shouldCompress(pickedFile.path); 1445 bool need = await VideoUtils.shouldCompress(pickedFile.path);
1429 if (need) { 1446 if (need) {
  1447 + Subscription _subscription; //展示压缩进度
1430 showCompress = true; 1448 showCompress = true;
1431 setState(() {}); 1449 setState(() {});
1432 //需要压缩 1450 //需要压缩
1433 // 订阅压缩进度 1451 // 订阅压缩进度
1434 _subscription = VideoCompress.compressProgress$.subscribe((progress) { 1452 _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 // 回调进度给外部 1453 // 回调进度给外部
1443 - // if (onProgress != null) {  
1444 - // onProgress!(progress);  
1445 - // }  
1446 - }); 1454 + debugPrint('progress: $progress');
  1455 + // compressProcess = '压缩进度: ${progress.toStringAsFixed(1)}%';
  1456 + setState(() {});
  1457 + }, onDone: () {}, onError: (error) {}, cancelOnError: true);
1447 file = await VideoUtils.compress(pickedFile.path); //压缩后的文件 1458 file = await VideoUtils.compress(pickedFile.path); //压缩后的文件
  1459 + if (file != null) {
  1460 + //压缩完成
  1461 + showCompress = false;
  1462 + _subscription.unsubscribe(); // 取消订阅
  1463 + setState(() {});
  1464 + } else {
  1465 + data.removeLast();
  1466 + _subscription.unsubscribe(); // 取消订阅
  1467 + setState(() {});
  1468 + throw Exception('Failed to compress video');
  1469 + }
1448 } 1470 }
1449 //开始上传任务 1471 //开始上传任务
1450 UploadImageUtil().startUploadOnlyAddition( 1472 UploadImageUtil().startUploadOnlyAddition(
@@ -103,7 +103,10 @@ class _ImgPickerWidgetState extends DisposableState<ImgPickerWidget> { @@ -103,7 +103,10 @@ class _ImgPickerWidgetState extends DisposableState<ImgPickerWidget> {
103 //从相册选取照片后进行裁剪压缩 103 //从相册选取照片后进行裁剪压缩
104 File yourFile = File(pickedFile.path); 104 File yourFile = File(pickedFile.path);
105 Uint8List afterImg = await yourFile.readAsBytes(); 105 Uint8List afterImg = await yourFile.readAsBytes();
106 - Uint8List newImg = await Utils.testFromFileComporessList(context, afterImg); 106 +
  107 + Uint8List newImg = await Utils.testFromFileComporessList(context, afterImg,
  108 + needResize:
  109 + widget.uploadType == UploadType.CouponDishType ? true : false);
107 String path = await Utils.saveImage(newImg); 110 String path = await Utils.saveImage(newImg);
108 if (path == null) { 111 if (path == null) {
109 // File compressedFile = await FlutterNativeImage.compressImage( 112 // File compressedFile = await FlutterNativeImage.compressImage(
@@ -246,8 +249,10 @@ class _ImgPickerWidgetState extends DisposableState<ImgPickerWidget> { @@ -246,8 +249,10 @@ class _ImgPickerWidgetState extends DisposableState<ImgPickerWidget> {
246 //从相册选取照片后进行裁剪压缩 249 //从相册选取照片后进行裁剪压缩
247 File yourFile = file; 250 File yourFile = file;
248 Uint8List afterImg = await yourFile.readAsBytes(); 251 Uint8List afterImg = await yourFile.readAsBytes();
249 - Uint8List newImg =  
250 - await Utils.testFromFileComporessList(context, afterImg); 252 + Uint8List newImg = await Utils.testFromFileComporessList(
  253 + context, afterImg,
  254 + needResize:
  255 + widget.uploadType == UploadType.CouponDishType ? true : false);
251 String path = await Utils.saveImage(newImg); 256 String path = await Utils.saveImage(newImg);
252 // File compressedFile; 257 // File compressedFile;
253 if (path == null) { 258 if (path == null) {
@@ -1190,6 +1190,8 @@ class Utils { @@ -1190,6 +1190,8 @@ class Utils {
1190 title = '相机'; 1190 title = '相机';
1191 } else if (permissionGroup == Permission.location) { 1191 } else if (permissionGroup == Permission.location) {
1192 title = '位置'; 1192 title = '位置';
  1193 + } else if (permissionGroup == Permission.microphone) {
  1194 + title = '麦克风';
1193 } 1195 }
1194 PermissionStatus status = await permissionStatus(permissionGroup); 1196 PermissionStatus status = await permissionStatus(permissionGroup);
1195 if (status == PermissionStatus.permanentlyDenied) { 1197 if (status == PermissionStatus.permanentlyDenied) {
@@ -2523,7 +2525,8 @@ class Utils { @@ -2523,7 +2525,8 @@ class Utils {
2523 } 2525 }
2524 String _title = 2526 String _title =
2525 "您预订的${Provider.of<UserModel>(context, listen: false).user.sellername},已经安排,点击查看详情"; 2527 "您预订的${Provider.of<UserModel>(context, listen: false).user.sellername},已经安排,点击查看详情";
2526 - 2528 + // String _title =
  2529 + // "${Provider.of<UserModel>(context, listen: false).user.sellername}-全体员工恭候您的光临!预订详情,请点击查看";
2527 // if (Provider.of<UserModel>(context, listen: false).user.sellerid == '677') { 2530 // if (Provider.of<UserModel>(context, listen: false).user.sellerid == '677') {
2528 // //京厨九跳转新的邀请函地址 2531 // //京厨九跳转新的邀请函地址
2529 // _path = 2532 // _path =