|
...
|
...
|
@@ -597,9 +597,19 @@ class _StoreBaseInfoPageState extends State<StoreBaseInfoPage> { |
|
|
|
Future _getFromPictureOrCamera(
|
|
|
|
String title, UploadImgModel imgModel, imageSource) async {
|
|
|
|
final pickedFile = await picker.getImage(source: imageSource);
|
|
|
|
|
|
|
|
//从相册选取照片后进行裁剪压缩
|
|
|
|
File yourFile = File(pickedFile.path);
|
|
|
|
Uint8List afterImg = await yourFile.readAsBytes();
|
|
|
|
Uint8List newImg = await Utils.testFromFileComporessList(context, afterImg);
|
|
|
|
String path = await Utils.saveImage(newImg);
|
|
|
|
if (path == null) {
|
|
|
|
path = pickedFile.path;
|
|
|
|
}
|
|
|
|
//更新本地存储,上传中展示
|
|
|
|
setState(() {
|
|
|
|
if (pickedFile != null) {
|
|
|
|
imgModel.file = File(pickedFile.path);
|
|
|
|
imgModel.file = File(path);
|
|
|
|
imgModel.process = 0.01;
|
|
|
|
} else {
|
|
|
|
print('No image selected.');
|
|
...
|
...
|
@@ -607,119 +617,119 @@ class _StoreBaseInfoPageState extends State<StoreBaseInfoPage> { |
|
|
|
});
|
|
|
|
if (pickedFile != null) {
|
|
|
|
_uploadImageProvider.mentou.qiniuUrl = null;
|
|
|
|
_uploadImageProvider.mentou.file = File(pickedFile.path);
|
|
|
|
_uploadImageProvider.mentou.path = pickedFile.path;
|
|
|
|
UploadImageUtil().startUploadOnly(
|
|
|
|
context, File(pickedFile.path), 2, true, _uploadImageProvider);
|
|
|
|
_uploadImageProvider.mentou.file = File(path);
|
|
|
|
_uploadImageProvider.mentou.path = path;
|
|
|
|
UploadImageUtil()
|
|
|
|
.startUploadOnly(context, File(path), 2, true, _uploadImageProvider);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
///图片 头像和二维码
|
|
|
|
Widget _imageWidget(
|
|
|
|
String title, UploadImgModel model, double imgSize, double radius) {
|
|
|
|
return InkWell(
|
|
|
|
onTap: () {
|
|
|
|
Utils.getPickPermission(context, () {
|
|
|
|
_getFromPictureOrCamera(title, model, ImageSource.gallery);
|
|
|
|
}, Platform.isAndroid ? Permission.storage : Permission.photos);
|
|
|
|
},
|
|
|
|
child: Container(
|
|
|
|
margin: EdgeInsets.only(
|
|
|
|
top: ScreenUtil().setWidth(40),
|
|
|
|
left: ScreenUtil().setWidth(40),
|
|
|
|
right: ScreenUtil().setWidth(40)),
|
|
|
|
height: ScreenUtil().setWidth(imgSize * 2),
|
|
|
|
child: Row(
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
children: [
|
|
|
|
Text(
|
|
|
|
title,
|
|
|
|
textAlign: TextAlign.left,
|
|
|
|
style: TextStyle(
|
|
|
|
color: MyColours.color_333333,
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
fontSize: ScreenUtil().setSp(34)),
|
|
|
|
),
|
|
|
|
Spacer(),
|
|
|
|
Stack(
|
|
|
|
children: [
|
|
|
|
InkWell(
|
|
|
|
onTap: () {
|
|
|
|
double process;
|
|
|
|
String qiniuUrl;
|
|
|
|
List<String> tempList = [];
|
|
|
|
|
|
|
|
process = _uploadImageProvider.mentou.process;
|
|
|
|
qiniuUrl = _uploadImageProvider.mentou.qiniuUrl;
|
|
|
|
|
|
|
|
if (qiniuUrl != null && qiniuUrl != '') {
|
|
|
|
tempList.add(qiniuUrl);
|
|
|
|
|
|
|
|
///没有上传完成的不可以点击
|
|
|
|
_showPhotoView(context, 0, tempList);
|
|
|
|
} else {
|
|
|
|
Utils.getPickPermission(context, () {
|
|
|
|
_getFromPictureOrCamera(
|
|
|
|
title, model, ImageSource.gallery);
|
|
|
|
},
|
|
|
|
Platform.isAndroid
|
|
|
|
? Permission.storage
|
|
|
|
: Permission.photos);
|
|
|
|
}
|
|
|
|
},
|
|
|
|
child: ClipRRect(
|
|
|
|
borderRadius:
|
|
|
|
BorderRadius.circular(ScreenUtil().setWidth(radius)),
|
|
|
|
child: model.file == null
|
|
|
|
? model.qiniuUrl != null && model.qiniuUrl != ''
|
|
|
|
? Image.network(
|
|
|
|
model.qiniuUrl,
|
|
|
|
fit: BoxFit.cover,
|
|
|
|
width: ScreenUtil().setWidth(imgSize * 2),
|
|
|
|
height: ScreenUtil().setWidth(imgSize * 2),
|
|
|
|
)
|
|
|
|
: Image.asset(
|
|
|
|
Utils.getImgPath('no_image'),
|
|
|
|
fit: BoxFit.cover,
|
|
|
|
width: ScreenUtil().setWidth(imgSize * 2),
|
|
|
|
height: ScreenUtil().setWidth(imgSize * 2),
|
|
|
|
)
|
|
|
|
: Image.file(
|
|
|
|
model.file,
|
|
|
|
fit: BoxFit.cover,
|
|
|
|
width: ScreenUtil().setWidth(imgSize * 2),
|
|
|
|
height: ScreenUtil().setWidth(imgSize * 2),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
(model.file != null) &&
|
|
|
|
model.process != 1 &&
|
|
|
|
model.process != 0.01
|
|
|
|
? Container(
|
|
|
|
width: ScreenUtil().setWidth(imgSize * 2),
|
|
|
|
height: ScreenUtil().setWidth(imgSize * 2),
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
borderRadius: BorderRadius.circular(radius),
|
|
|
|
color: Color.fromRGBO(0, 0, 0, 0.6)),
|
|
|
|
child: Center(
|
|
|
|
child: Text('上传中',
|
|
|
|
style:
|
|
|
|
TextStyle(color: MyColours.color_999999)),
|
|
|
|
),
|
|
|
|
)
|
|
|
|
: Container(),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
HEmptyView(30),
|
|
|
|
Image.asset(
|
|
|
|
"assets/arr_right_gray.png",
|
|
|
|
width: ScreenUtil().setWidth(14),
|
|
|
|
height: ScreenUtil().setWidth(22),
|
|
|
|
)
|
|
|
|
],
|
|
|
|
),
|
|
|
|
));
|
|
|
|
}
|
|
|
|
// ///图片 头像和二维码
|
|
|
|
// Widget _imageWidget(
|
|
|
|
// String title, UploadImgModel model, double imgSize, double radius) {
|
|
|
|
// return InkWell(
|
|
|
|
// onTap: () {
|
|
|
|
// Utils.getPickPermission(context, () {
|
|
|
|
// _getFromPictureOrCamera(title, model, ImageSource.gallery);
|
|
|
|
// }, Platform.isAndroid ? Permission.storage : Permission.photos);
|
|
|
|
// },
|
|
|
|
// child: Container(
|
|
|
|
// margin: EdgeInsets.only(
|
|
|
|
// top: ScreenUtil().setWidth(40),
|
|
|
|
// left: ScreenUtil().setWidth(40),
|
|
|
|
// right: ScreenUtil().setWidth(40)),
|
|
|
|
// height: ScreenUtil().setWidth(imgSize * 2),
|
|
|
|
// child: Row(
|
|
|
|
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
// children: [
|
|
|
|
// Text(
|
|
|
|
// title,
|
|
|
|
// textAlign: TextAlign.left,
|
|
|
|
// style: TextStyle(
|
|
|
|
// color: MyColours.color_333333,
|
|
|
|
// fontWeight: FontWeight.bold,
|
|
|
|
// fontSize: ScreenUtil().setSp(34)),
|
|
|
|
// ),
|
|
|
|
// Spacer(),
|
|
|
|
// Stack(
|
|
|
|
// children: [
|
|
|
|
// InkWell(
|
|
|
|
// onTap: () {
|
|
|
|
// double process;
|
|
|
|
// String qiniuUrl;
|
|
|
|
// List<String> tempList = [];
|
|
|
|
|
|
|
|
// process = _uploadImageProvider.mentou.process;
|
|
|
|
// qiniuUrl = _uploadImageProvider.mentou.qiniuUrl;
|
|
|
|
|
|
|
|
// if (qiniuUrl != null && qiniuUrl != '') {
|
|
|
|
// tempList.add(qiniuUrl);
|
|
|
|
|
|
|
|
// ///没有上传完成的不可以点击
|
|
|
|
// _showPhotoView(context, 0, tempList);
|
|
|
|
// } else {
|
|
|
|
// Utils.getPickPermission(context, () {
|
|
|
|
// _getFromPictureOrCamera(
|
|
|
|
// title, model, ImageSource.gallery);
|
|
|
|
// },
|
|
|
|
// Platform.isAndroid
|
|
|
|
// ? Permission.storage
|
|
|
|
// : Permission.photos);
|
|
|
|
// }
|
|
|
|
// },
|
|
|
|
// child: ClipRRect(
|
|
|
|
// borderRadius:
|
|
|
|
// BorderRadius.circular(ScreenUtil().setWidth(radius)),
|
|
|
|
// child: model.file == null
|
|
|
|
// ? model.qiniuUrl != null && model.qiniuUrl != ''
|
|
|
|
// ? Image.network(
|
|
|
|
// model.qiniuUrl,
|
|
|
|
// fit: BoxFit.cover,
|
|
|
|
// width: ScreenUtil().setWidth(imgSize * 2),
|
|
|
|
// height: ScreenUtil().setWidth(imgSize * 2),
|
|
|
|
// )
|
|
|
|
// : Image.asset(
|
|
|
|
// Utils.getImgPath('no_image'),
|
|
|
|
// fit: BoxFit.cover,
|
|
|
|
// width: ScreenUtil().setWidth(imgSize * 2),
|
|
|
|
// height: ScreenUtil().setWidth(imgSize * 2),
|
|
|
|
// )
|
|
|
|
// : Image.file(
|
|
|
|
// model.file,
|
|
|
|
// fit: BoxFit.cover,
|
|
|
|
// width: ScreenUtil().setWidth(imgSize * 2),
|
|
|
|
// height: ScreenUtil().setWidth(imgSize * 2),
|
|
|
|
// ),
|
|
|
|
// ),
|
|
|
|
// ),
|
|
|
|
// (model.file != null) &&
|
|
|
|
// model.process != 1 &&
|
|
|
|
// model.process != 0.01
|
|
|
|
// ? Container(
|
|
|
|
// width: ScreenUtil().setWidth(imgSize * 2),
|
|
|
|
// height: ScreenUtil().setWidth(imgSize * 2),
|
|
|
|
// decoration: BoxDecoration(
|
|
|
|
// borderRadius: BorderRadius.circular(radius),
|
|
|
|
// color: Color.fromRGBO(0, 0, 0, 0.6)),
|
|
|
|
// child: Center(
|
|
|
|
// child: Text('上传中',
|
|
|
|
// style:
|
|
|
|
// TextStyle(color: MyColours.color_999999)),
|
|
|
|
// ),
|
|
|
|
// )
|
|
|
|
// : Container(),
|
|
|
|
// ],
|
|
|
|
// ),
|
|
|
|
// HEmptyView(30),
|
|
|
|
// Image.asset(
|
|
|
|
// "assets/arr_right_gray.png",
|
|
|
|
// width: ScreenUtil().setWidth(14),
|
|
|
|
// height: ScreenUtil().setWidth(22),
|
|
|
|
// )
|
|
|
|
// ],
|
|
|
|
// ),
|
|
|
|
// ));
|
|
|
|
// }
|
|
|
|
|
|
|
|
///地图地址选择
|
|
|
|
Widget _select(String title, String hintText) {
|
...
|
...
|
|