|
...
|
...
|
@@ -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);
|
|
|
|
}
|
...
|
...
|
|