Commit 54fb1310ecbc144c388770d76bcceccb82b8f95d

Authored by wdn127929
1 parent d0f73e32

一次传完

... ... @@ -15,6 +15,7 @@
<uses-permission android:name="android.permission.READ_CONTACTS" />
<uses-permission android:name="android.permission.WRITE_CONTACTS" />
<uses-permission android:name="android.permission.READ_CONTACTS"/>
<uses-permission android:name="android.permission.CAMERA"/>
<uses-permission android:name="com.huawei.android.launcher.permission.CHANGE_BADGE"/>
<application
android:name="io.flutter.app.FlutterApplication"
... ...

2.17 KB | W: | H:

1.45 KB | W: | H:

  • 2-up
  • Swipe
  • Onion skin
... ... @@ -35,7 +35,7 @@ typedef void DeleteCallback(int index);
class ImgPickerWidget extends StatefulWidget {
final ScrollController scrollController;
final Color borderColor;
final ValueChanged onChange;
final VoidCallback callback;
final int maxImageNumber;
final UploadImageProvider model;
final UploadType uploadType;
... ... @@ -44,7 +44,7 @@ class ImgPickerWidget extends StatefulWidget {
{Key key,
this.scrollController,
this.borderColor = Colors.blue,
this.onChange,
this.callback,
this.maxImageNumber = 5,
this.model,
this.uploadType,
... ... @@ -97,6 +97,10 @@ class _ImgPickerWidgetState extends DisposableState<ImgPickerWidget> {
widget.model.imageList.add(imgModel);
} else if (widget.uploadType == UploadType.StoreFrontUploadType) {
widget.model.imageListFront.add(imgModel);
} else if (widget.uploadType == UploadType.EnvironmentUploadType) {
widget.model.imageListDenvironment.add(imgModel);
} else if (widget.uploadType == UploadType.TableManagerType) {
widget.model.tableImageList.add(imgModel);
}
} else {
print('No image selected.');
... ... @@ -104,13 +108,19 @@ class _ImgPickerWidgetState extends DisposableState<ImgPickerWidget> {
});
if (pickedFile != null) {
List<UploadImgModel> temp = [];
if (widget.uploadType == UploadType.ConsumptionUploadType) {
temp = widget.model.imageList;
} else if (widget.uploadType == UploadType.StoreFrontUploadType) {
temp = widget.model.imageListFront;
} else if (widget.uploadType == UploadType.EnvironmentUploadType) {
temp = widget.model.imageListDenvironment;
} else if (widget.uploadType == UploadType.TableManagerType) {
temp = widget.model.tableImageList;
}
UploadImageUtil().startUpload(context, File(pickedFile.path),
temp.length - 1, true, widget.model, widget.uploadType);
temp.length - 1, true, widget.model, widget.uploadType,
callback: widget.callback, countAll: 1);
}
}
... ... @@ -183,7 +193,8 @@ class _ImgPickerWidgetState extends DisposableState<ImgPickerWidget> {
temp.add(imgModel);
});
UploadImageUtil().startUpload(context, File(file.absolute.path),
temp.length - 1, false, widget.model, widget.uploadType);
temp.length - 1, false, widget.model, widget.uploadType,
countAll: imgList.length, callback: widget.callback);
// startUpload(File(file.absolute.path),
// _uploadImageProvider.imageList.length - 1, false);
}
... ...
... ... @@ -226,42 +226,69 @@ class _TablePhotoManagerPageState extends State<TablePhotoManagerPage> {
.photoID,
index);
},
callback: () {
for (UploadImgModel item
in _uploadImageProvider
.tableImageList) {
if (item.process < 1) {
Utils.showToast('正在上传图片,请稍等');
return;
}
}
//接口,和桌子绑定
List imageQiniuUrlList = [];
for (int i = 0;
i <
_uploadImageProvider
.tableImageList.length;
i++) {
if (!_uploadImageProvider
.tableImageList[i].isUpload) {
imageQiniuUrlList.add({
"url": _uploadImageProvider
.tableImageList[i].qiniuUrl
});
}
}
_setTablePhoto(
context, imageQiniuUrlList);
},
);
}),
]))),
RoundButton(
text: '确定上传',
gradientStart: MyColours.color_199095,
gradientEnd: MyColours.color_199095,
// borderColor: MyColours.color_999999,
radius: ScreenUtil().setWidth(10),
fontSize: 34,
height: ScreenUtil().setWidth(80),
isBold: false,
onPressed: () {
for (UploadImgModel item
in _uploadImageProvider.tableImageList) {
if (item.process < 1) {
Utils.showToast('正在上传图片,请稍等');
return;
}
}
//接口,和桌子绑定
List imageQiniuUrlList = [];
for (int i = 0;
i < _uploadImageProvider.tableImageList.length;
i++) {
if (!_uploadImageProvider
.tableImageList[i].isUpload) {
imageQiniuUrlList.add({
"url": _uploadImageProvider
.tableImageList[i].qiniuUrl
});
}
}
_setTablePhoto(context, imageQiniuUrlList);
},
)
// RoundButton(
// text: '确定上传',
// gradientStart: MyColours.color_199095,
// gradientEnd: MyColours.color_199095,
// // borderColor: MyColours.color_999999,
// radius: ScreenUtil().setWidth(10),
// fontSize: 34,
// height: ScreenUtil().setWidth(80),
// isBold: false,
// onPressed: () {
// for (UploadImgModel item
// in _uploadImageProvider.tableImageList) {
// if (item.process < 1) {
// Utils.showToast('正在上传图片,请稍等');
// return;
// }
// }
// //接口,和桌子绑定
// List imageQiniuUrlList = [];
// for (int i = 0;
// i < _uploadImageProvider.tableImageList.length;
// i++) {
// if (!_uploadImageProvider
// .tableImageList[i].isUpload) {
// imageQiniuUrlList.add({
// "url": _uploadImageProvider
// .tableImageList[i].qiniuUrl
// });
// }
// }
// _setTablePhoto(context, imageQiniuUrlList);
// },
// )
])))));
}
}
... ...
... ... @@ -22,6 +22,7 @@ class UploadImageProvider extends ChangeNotifier {
List<UploadImgModel> imageListDenvironment = []; //环境信息列表
List<UploadImgModel> imageListFront = []; //门头信息列表
List<UploadImgModel> tableImageList = []; //桌子管理图片信息列表
int countUpload = 0;
UploadImageProvider() {
touxiang.process = 0.01;
erweima.process = 0.01;
... ...
... ... @@ -41,7 +41,9 @@ class UploadImageUtil {
int index,
bool needInit,
UploadImageProvider uploadImageProvider,
UploadType uploadType) async {
UploadType uploadType,
{int countAll,
VoidCallback callback}) async {
final PutController putController = PutController();
print(index);
... ... @@ -113,6 +115,12 @@ class UploadImageUtil {
uploadImageProvider.tableImageList[index].process = 1;
uploadImageProvider.tableImageList[index].qiniuUrl = imgUrl;
uploadImageProvider.tableImageList[index].isUpload = false;
uploadImageProvider.countUpload++;
if (uploadImageProvider.countUpload == countAll) {
//所有图片上传完成,可以绑定桌位
uploadImageProvider.countUpload = 0;
callback();
}
}
// 取消当前任务
... ...
... ... @@ -217,7 +217,7 @@ class TableItemState extends State<TableItem> {
? Container()
: Container(
width: ScreenUtil().setWidth(160),
height: ScreenUtil().setHeight(36),
height: ScreenUtil().setHeight(34),
alignment: Alignment.center,
decoration: BoxDecoration(
color: signStr == '已停用'
... ... @@ -255,12 +255,12 @@ class TableItemState extends State<TableItem> {
: Container()),
Positioned(
left: ScreenUtil().setWidth(8),
bottom: ScreenUtil().setWidth(16),
bottom: ScreenUtil().setWidth(10),
child: table.isPhoto == 1
? Image.asset(
"assets/photo.png",
width: ScreenUtil().setWidth(40),
height: ScreenUtil().setWidth(40),
height: ScreenUtil().setWidth(50),
)
: Container())
],
... ...