|
...
|
...
|
@@ -219,45 +219,84 @@ class _BookInfoPageState extends State<BookInfoPage> { |
|
|
|
Uint8List newImg = await Utils.testFromFileComporessList(
|
|
|
|
context, afterImg,
|
|
|
|
needResize: true);
|
|
|
|
path = await Utils.saveImage(newImg);
|
|
|
|
}
|
|
|
|
if (newImg != null) {
|
|
|
|
path = await Utils.saveImage(newImg);
|
|
|
|
if (path == null) {
|
|
|
|
File compressedFile = await FlutterNativeImage.compressImage(
|
|
|
|
pickedFile.path,
|
|
|
|
quality: 70,
|
|
|
|
percentage: 50);
|
|
|
|
path = compressedFile.path;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (path == null) {
|
|
|
|
File compressedFile = await FlutterNativeImage.compressImage(
|
|
|
|
pickedFile.path,
|
|
|
|
quality: 70,
|
|
|
|
percentage: 50);
|
|
|
|
path = compressedFile.path;
|
|
|
|
}
|
|
|
|
// File compressedFile = await FlutterNativeImage.compressImage(
|
|
|
|
// pickedFile.path,
|
|
|
|
// quality: 50,
|
|
|
|
// percentage: 50);
|
|
|
|
setState(() {
|
|
|
|
if (pickedFile != null) {
|
|
|
|
imgModel.file = File(pickedFile.path);
|
|
|
|
imgModel.process = 0.01;
|
|
|
|
} else {
|
|
|
|
print('No image selected.');
|
|
|
|
}
|
|
|
|
});
|
|
|
|
if (pickedFile != null) {
|
|
|
|
// if (title == '头像') {
|
|
|
|
// _uploadImageProvider.imgSizeTouxiang = 76;
|
|
|
|
// _uploadImageProvider.touxiang.qiniuUrl = null;
|
|
|
|
// } else {
|
|
|
|
// _uploadImageProvider.imgSizeErweima = 76;
|
|
|
|
// _uploadImageProvider.firstImage.qiniuUrl = null;
|
|
|
|
imgModel.qiniuUrl = null;
|
|
|
|
// }
|
|
|
|
bool need = await Utils.sizeNeed(File(pickedFile.path));
|
|
|
|
File file = File(pickedFile.path);
|
|
|
|
if (need) {
|
|
|
|
file = File(path);
|
|
|
|
}
|
|
|
|
UploadImageUtil()
|
|
|
|
.startUploadOnly(context, file, type, true, _uploadImageProvider);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
if (path == null) {
|
|
|
|
File compressedFile = await FlutterNativeImage.compressImage(
|
|
|
|
pickedFile.path,
|
|
|
|
quality: 70,
|
|
|
|
percentage: 50);
|
|
|
|
path = compressedFile.path;
|
|
|
|
}
|
|
|
|
|
|
|
|
// File compressedFile = await FlutterNativeImage.compressImage(
|
|
|
|
// pickedFile.path,
|
|
|
|
// quality: 50,
|
|
|
|
// percentage: 50);
|
|
|
|
setState(() {
|
|
|
|
// File compressedFile = await FlutterNativeImage.compressImage(
|
|
|
|
// pickedFile.path,
|
|
|
|
// quality: 50,
|
|
|
|
// percentage: 50);
|
|
|
|
setState(() {
|
|
|
|
if (pickedFile != null) {
|
|
|
|
imgModel.file = File(pickedFile.path);
|
|
|
|
imgModel.process = 0.01;
|
|
|
|
} else {
|
|
|
|
print('No image selected.');
|
|
|
|
}
|
|
|
|
});
|
|
|
|
if (pickedFile != null) {
|
|
|
|
imgModel.file = File(pickedFile.path);
|
|
|
|
imgModel.process = 0.01;
|
|
|
|
} else {
|
|
|
|
print('No image selected.');
|
|
|
|
}
|
|
|
|
});
|
|
|
|
if (pickedFile != null) {
|
|
|
|
// if (title == '头像') {
|
|
|
|
// _uploadImageProvider.imgSizeTouxiang = 76;
|
|
|
|
// _uploadImageProvider.touxiang.qiniuUrl = null;
|
|
|
|
// } else {
|
|
|
|
// _uploadImageProvider.imgSizeErweima = 76;
|
|
|
|
// _uploadImageProvider.firstImage.qiniuUrl = null;
|
|
|
|
imgModel.qiniuUrl = null;
|
|
|
|
// }
|
|
|
|
bool need = await Utils.sizeNeed(File(pickedFile.path));
|
|
|
|
File file = File(pickedFile.path);
|
|
|
|
if (need) {
|
|
|
|
file = File(path);
|
|
|
|
// if (title == '头像') {
|
|
|
|
// _uploadImageProvider.imgSizeTouxiang = 76;
|
|
|
|
// _uploadImageProvider.touxiang.qiniuUrl = null;
|
|
|
|
// } else {
|
|
|
|
// _uploadImageProvider.imgSizeErweima = 76;
|
|
|
|
// _uploadImageProvider.firstImage.qiniuUrl = null;
|
|
|
|
imgModel.qiniuUrl = null;
|
|
|
|
// }
|
|
|
|
bool need = await Utils.sizeNeed(File(pickedFile.path));
|
|
|
|
File file = File(pickedFile.path);
|
|
|
|
if (need) {
|
|
|
|
file = File(path);
|
|
|
|
}
|
|
|
|
UploadImageUtil()
|
|
|
|
.startUploadOnly(context, file, type, true, _uploadImageProvider);
|
|
|
|
}
|
|
|
|
UploadImageUtil()
|
|
|
|
.startUploadOnly(context, file, type, true, _uploadImageProvider);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
...
|
...
|
@@ -794,7 +833,7 @@ class _BookInfoPageState extends State<BookInfoPage> { |
|
|
|
if (qiniuUrl != null && qiniuUrl != '') {
|
|
|
|
// _uploadImageProvider.logo.process = 0;
|
|
|
|
// setState(() {
|
|
|
|
|
|
|
|
|
|
|
|
// });
|
|
|
|
// setState(() {});
|
|
|
|
// tempList.add(qiniuUrl);
|
...
|
...
|
|