|
@@ -597,9 +597,19 @@ class _StoreBaseInfoPageState extends State<StoreBaseInfoPage> { |
|
@@ -597,9 +597,19 @@ class _StoreBaseInfoPageState extends State<StoreBaseInfoPage> { |
|
597
|
Future _getFromPictureOrCamera(
|
597
|
Future _getFromPictureOrCamera(
|
|
598
|
String title, UploadImgModel imgModel, imageSource) async {
|
598
|
String title, UploadImgModel imgModel, imageSource) async {
|
|
599
|
final pickedFile = await picker.getImage(source: imageSource);
|
599
|
final pickedFile = await picker.getImage(source: imageSource);
|
|
|
|
600
|
+
|
|
|
|
601
|
+ //从相册选取照片后进行裁剪压缩
|
|
|
|
602
|
+ File yourFile = File(pickedFile.path);
|
|
|
|
603
|
+ Uint8List afterImg = await yourFile.readAsBytes();
|
|
|
|
604
|
+ Uint8List newImg = await Utils.testFromFileComporessList(context, afterImg);
|
|
|
|
605
|
+ String path = await Utils.saveImage(newImg);
|
|
|
|
606
|
+ if (path == null) {
|
|
|
|
607
|
+ path = pickedFile.path;
|
|
|
|
608
|
+ }
|
|
|
|
609
|
+ //更新本地存储,上传中展示
|
|
600
|
setState(() {
|
610
|
setState(() {
|
|
601
|
if (pickedFile != null) {
|
611
|
if (pickedFile != null) {
|
|
602
|
- imgModel.file = File(pickedFile.path);
|
612
|
+ imgModel.file = File(path);
|
|
603
|
imgModel.process = 0.01;
|
613
|
imgModel.process = 0.01;
|
|
604
|
} else {
|
614
|
} else {
|
|
605
|
print('No image selected.');
|
615
|
print('No image selected.');
|
|
@@ -607,119 +617,119 @@ class _StoreBaseInfoPageState extends State<StoreBaseInfoPage> { |
|
@@ -607,119 +617,119 @@ class _StoreBaseInfoPageState extends State<StoreBaseInfoPage> { |
|
607
|
});
|
617
|
});
|
|
608
|
if (pickedFile != null) {
|
618
|
if (pickedFile != null) {
|
|
609
|
_uploadImageProvider.mentou.qiniuUrl = null;
|
619
|
_uploadImageProvider.mentou.qiniuUrl = null;
|
|
610
|
- _uploadImageProvider.mentou.file = File(pickedFile.path);
|
|
|
|
611
|
- _uploadImageProvider.mentou.path = pickedFile.path;
|
|
|
|
612
|
- UploadImageUtil().startUploadOnly(
|
|
|
|
613
|
- context, File(pickedFile.path), 2, true, _uploadImageProvider);
|
620
|
+ _uploadImageProvider.mentou.file = File(path);
|
|
|
|
621
|
+ _uploadImageProvider.mentou.path = path;
|
|
|
|
622
|
+ UploadImageUtil()
|
|
|
|
623
|
+ .startUploadOnly(context, File(path), 2, true, _uploadImageProvider);
|
|
614
|
}
|
624
|
}
|
|
615
|
}
|
625
|
}
|
|
616
|
|
626
|
|
|
617
|
- ///图片 头像和二维码
|
|
|
|
618
|
- Widget _imageWidget(
|
|
|
|
619
|
- String title, UploadImgModel model, double imgSize, double radius) {
|
|
|
|
620
|
- return InkWell(
|
|
|
|
621
|
- onTap: () {
|
|
|
|
622
|
- Utils.getPickPermission(context, () {
|
|
|
|
623
|
- _getFromPictureOrCamera(title, model, ImageSource.gallery);
|
|
|
|
624
|
- }, Platform.isAndroid ? Permission.storage : Permission.photos);
|
|
|
|
625
|
- },
|
|
|
|
626
|
- child: Container(
|
|
|
|
627
|
- margin: EdgeInsets.only(
|
|
|
|
628
|
- top: ScreenUtil().setWidth(40),
|
|
|
|
629
|
- left: ScreenUtil().setWidth(40),
|
|
|
|
630
|
- right: ScreenUtil().setWidth(40)),
|
|
|
|
631
|
- height: ScreenUtil().setWidth(imgSize * 2),
|
|
|
|
632
|
- child: Row(
|
|
|
|
633
|
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
634
|
- children: [
|
|
|
|
635
|
- Text(
|
|
|
|
636
|
- title,
|
|
|
|
637
|
- textAlign: TextAlign.left,
|
|
|
|
638
|
- style: TextStyle(
|
|
|
|
639
|
- color: MyColours.color_333333,
|
|
|
|
640
|
- fontWeight: FontWeight.bold,
|
|
|
|
641
|
- fontSize: ScreenUtil().setSp(34)),
|
|
|
|
642
|
- ),
|
|
|
|
643
|
- Spacer(),
|
|
|
|
644
|
- Stack(
|
|
|
|
645
|
- children: [
|
|
|
|
646
|
- InkWell(
|
|
|
|
647
|
- onTap: () {
|
|
|
|
648
|
- double process;
|
|
|
|
649
|
- String qiniuUrl;
|
|
|
|
650
|
- List<String> tempList = [];
|
|
|
|
651
|
-
|
|
|
|
652
|
- process = _uploadImageProvider.mentou.process;
|
|
|
|
653
|
- qiniuUrl = _uploadImageProvider.mentou.qiniuUrl;
|
|
|
|
654
|
-
|
|
|
|
655
|
- if (qiniuUrl != null && qiniuUrl != '') {
|
|
|
|
656
|
- tempList.add(qiniuUrl);
|
|
|
|
657
|
-
|
|
|
|
658
|
- ///没有上传完成的不可以点击
|
|
|
|
659
|
- _showPhotoView(context, 0, tempList);
|
|
|
|
660
|
- } else {
|
|
|
|
661
|
- Utils.getPickPermission(context, () {
|
|
|
|
662
|
- _getFromPictureOrCamera(
|
|
|
|
663
|
- title, model, ImageSource.gallery);
|
|
|
|
664
|
- },
|
|
|
|
665
|
- Platform.isAndroid
|
|
|
|
666
|
- ? Permission.storage
|
|
|
|
667
|
- : Permission.photos);
|
|
|
|
668
|
- }
|
|
|
|
669
|
- },
|
|
|
|
670
|
- child: ClipRRect(
|
|
|
|
671
|
- borderRadius:
|
|
|
|
672
|
- BorderRadius.circular(ScreenUtil().setWidth(radius)),
|
|
|
|
673
|
- child: model.file == null
|
|
|
|
674
|
- ? model.qiniuUrl != null && model.qiniuUrl != ''
|
|
|
|
675
|
- ? Image.network(
|
|
|
|
676
|
- model.qiniuUrl,
|
|
|
|
677
|
- fit: BoxFit.cover,
|
|
|
|
678
|
- width: ScreenUtil().setWidth(imgSize * 2),
|
|
|
|
679
|
- height: ScreenUtil().setWidth(imgSize * 2),
|
|
|
|
680
|
- )
|
|
|
|
681
|
- : Image.asset(
|
|
|
|
682
|
- Utils.getImgPath('no_image'),
|
|
|
|
683
|
- fit: BoxFit.cover,
|
|
|
|
684
|
- width: ScreenUtil().setWidth(imgSize * 2),
|
|
|
|
685
|
- height: ScreenUtil().setWidth(imgSize * 2),
|
|
|
|
686
|
- )
|
|
|
|
687
|
- : Image.file(
|
|
|
|
688
|
- model.file,
|
|
|
|
689
|
- fit: BoxFit.cover,
|
|
|
|
690
|
- width: ScreenUtil().setWidth(imgSize * 2),
|
|
|
|
691
|
- height: ScreenUtil().setWidth(imgSize * 2),
|
|
|
|
692
|
- ),
|
|
|
|
693
|
- ),
|
|
|
|
694
|
- ),
|
|
|
|
695
|
- (model.file != null) &&
|
|
|
|
696
|
- model.process != 1 &&
|
|
|
|
697
|
- model.process != 0.01
|
|
|
|
698
|
- ? Container(
|
|
|
|
699
|
- width: ScreenUtil().setWidth(imgSize * 2),
|
|
|
|
700
|
- height: ScreenUtil().setWidth(imgSize * 2),
|
|
|
|
701
|
- decoration: BoxDecoration(
|
|
|
|
702
|
- borderRadius: BorderRadius.circular(radius),
|
|
|
|
703
|
- color: Color.fromRGBO(0, 0, 0, 0.6)),
|
|
|
|
704
|
- child: Center(
|
|
|
|
705
|
- child: Text('上传中',
|
|
|
|
706
|
- style:
|
|
|
|
707
|
- TextStyle(color: MyColours.color_999999)),
|
|
|
|
708
|
- ),
|
|
|
|
709
|
- )
|
|
|
|
710
|
- : Container(),
|
|
|
|
711
|
- ],
|
|
|
|
712
|
- ),
|
|
|
|
713
|
- HEmptyView(30),
|
|
|
|
714
|
- Image.asset(
|
|
|
|
715
|
- "assets/arr_right_gray.png",
|
|
|
|
716
|
- width: ScreenUtil().setWidth(14),
|
|
|
|
717
|
- height: ScreenUtil().setWidth(22),
|
|
|
|
718
|
- )
|
|
|
|
719
|
- ],
|
|
|
|
720
|
- ),
|
|
|
|
721
|
- ));
|
|
|
|
722
|
- }
|
627
|
+ // ///图片 头像和二维码
|
|
|
|
628
|
+ // Widget _imageWidget(
|
|
|
|
629
|
+ // String title, UploadImgModel model, double imgSize, double radius) {
|
|
|
|
630
|
+ // return InkWell(
|
|
|
|
631
|
+ // onTap: () {
|
|
|
|
632
|
+ // Utils.getPickPermission(context, () {
|
|
|
|
633
|
+ // _getFromPictureOrCamera(title, model, ImageSource.gallery);
|
|
|
|
634
|
+ // }, Platform.isAndroid ? Permission.storage : Permission.photos);
|
|
|
|
635
|
+ // },
|
|
|
|
636
|
+ // child: Container(
|
|
|
|
637
|
+ // margin: EdgeInsets.only(
|
|
|
|
638
|
+ // top: ScreenUtil().setWidth(40),
|
|
|
|
639
|
+ // left: ScreenUtil().setWidth(40),
|
|
|
|
640
|
+ // right: ScreenUtil().setWidth(40)),
|
|
|
|
641
|
+ // height: ScreenUtil().setWidth(imgSize * 2),
|
|
|
|
642
|
+ // child: Row(
|
|
|
|
643
|
+ // mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
644
|
+ // children: [
|
|
|
|
645
|
+ // Text(
|
|
|
|
646
|
+ // title,
|
|
|
|
647
|
+ // textAlign: TextAlign.left,
|
|
|
|
648
|
+ // style: TextStyle(
|
|
|
|
649
|
+ // color: MyColours.color_333333,
|
|
|
|
650
|
+ // fontWeight: FontWeight.bold,
|
|
|
|
651
|
+ // fontSize: ScreenUtil().setSp(34)),
|
|
|
|
652
|
+ // ),
|
|
|
|
653
|
+ // Spacer(),
|
|
|
|
654
|
+ // Stack(
|
|
|
|
655
|
+ // children: [
|
|
|
|
656
|
+ // InkWell(
|
|
|
|
657
|
+ // onTap: () {
|
|
|
|
658
|
+ // double process;
|
|
|
|
659
|
+ // String qiniuUrl;
|
|
|
|
660
|
+ // List<String> tempList = [];
|
|
|
|
661
|
+
|
|
|
|
662
|
+ // process = _uploadImageProvider.mentou.process;
|
|
|
|
663
|
+ // qiniuUrl = _uploadImageProvider.mentou.qiniuUrl;
|
|
|
|
664
|
+
|
|
|
|
665
|
+ // if (qiniuUrl != null && qiniuUrl != '') {
|
|
|
|
666
|
+ // tempList.add(qiniuUrl);
|
|
|
|
667
|
+
|
|
|
|
668
|
+ // ///没有上传完成的不可以点击
|
|
|
|
669
|
+ // _showPhotoView(context, 0, tempList);
|
|
|
|
670
|
+ // } else {
|
|
|
|
671
|
+ // Utils.getPickPermission(context, () {
|
|
|
|
672
|
+ // _getFromPictureOrCamera(
|
|
|
|
673
|
+ // title, model, ImageSource.gallery);
|
|
|
|
674
|
+ // },
|
|
|
|
675
|
+ // Platform.isAndroid
|
|
|
|
676
|
+ // ? Permission.storage
|
|
|
|
677
|
+ // : Permission.photos);
|
|
|
|
678
|
+ // }
|
|
|
|
679
|
+ // },
|
|
|
|
680
|
+ // child: ClipRRect(
|
|
|
|
681
|
+ // borderRadius:
|
|
|
|
682
|
+ // BorderRadius.circular(ScreenUtil().setWidth(radius)),
|
|
|
|
683
|
+ // child: model.file == null
|
|
|
|
684
|
+ // ? model.qiniuUrl != null && model.qiniuUrl != ''
|
|
|
|
685
|
+ // ? Image.network(
|
|
|
|
686
|
+ // model.qiniuUrl,
|
|
|
|
687
|
+ // fit: BoxFit.cover,
|
|
|
|
688
|
+ // width: ScreenUtil().setWidth(imgSize * 2),
|
|
|
|
689
|
+ // height: ScreenUtil().setWidth(imgSize * 2),
|
|
|
|
690
|
+ // )
|
|
|
|
691
|
+ // : Image.asset(
|
|
|
|
692
|
+ // Utils.getImgPath('no_image'),
|
|
|
|
693
|
+ // fit: BoxFit.cover,
|
|
|
|
694
|
+ // width: ScreenUtil().setWidth(imgSize * 2),
|
|
|
|
695
|
+ // height: ScreenUtil().setWidth(imgSize * 2),
|
|
|
|
696
|
+ // )
|
|
|
|
697
|
+ // : Image.file(
|
|
|
|
698
|
+ // model.file,
|
|
|
|
699
|
+ // fit: BoxFit.cover,
|
|
|
|
700
|
+ // width: ScreenUtil().setWidth(imgSize * 2),
|
|
|
|
701
|
+ // height: ScreenUtil().setWidth(imgSize * 2),
|
|
|
|
702
|
+ // ),
|
|
|
|
703
|
+ // ),
|
|
|
|
704
|
+ // ),
|
|
|
|
705
|
+ // (model.file != null) &&
|
|
|
|
706
|
+ // model.process != 1 &&
|
|
|
|
707
|
+ // model.process != 0.01
|
|
|
|
708
|
+ // ? Container(
|
|
|
|
709
|
+ // width: ScreenUtil().setWidth(imgSize * 2),
|
|
|
|
710
|
+ // height: ScreenUtil().setWidth(imgSize * 2),
|
|
|
|
711
|
+ // decoration: BoxDecoration(
|
|
|
|
712
|
+ // borderRadius: BorderRadius.circular(radius),
|
|
|
|
713
|
+ // color: Color.fromRGBO(0, 0, 0, 0.6)),
|
|
|
|
714
|
+ // child: Center(
|
|
|
|
715
|
+ // child: Text('上传中',
|
|
|
|
716
|
+ // style:
|
|
|
|
717
|
+ // TextStyle(color: MyColours.color_999999)),
|
|
|
|
718
|
+ // ),
|
|
|
|
719
|
+ // )
|
|
|
|
720
|
+ // : Container(),
|
|
|
|
721
|
+ // ],
|
|
|
|
722
|
+ // ),
|
|
|
|
723
|
+ // HEmptyView(30),
|
|
|
|
724
|
+ // Image.asset(
|
|
|
|
725
|
+ // "assets/arr_right_gray.png",
|
|
|
|
726
|
+ // width: ScreenUtil().setWidth(14),
|
|
|
|
727
|
+ // height: ScreenUtil().setWidth(22),
|
|
|
|
728
|
+ // )
|
|
|
|
729
|
+ // ],
|
|
|
|
730
|
+ // ),
|
|
|
|
731
|
+ // ));
|
|
|
|
732
|
+ // }
|
|
723
|
|
733
|
|
|
724
|
///地图地址选择
|
734
|
///地图地址选择
|
|
725
|
Widget _select(String title, String hintText) {
|
735
|
Widget _select(String title, String hintText) {
|