Compare commits
8 Commits
main_2.0
...
89dbb79256
| Author | SHA1 | Date | |
|---|---|---|---|
| 89dbb79256 | |||
| 79eb8a891b | |||
| 0c7fbe5897 | |||
| de127eeef5 | |||
| 01178bc033 | |||
| 724e31ad7d | |||
| e6ea8182e4 | |||
| c585d5ce0d |
@@ -103,6 +103,12 @@ class HttpUtils {
|
|||||||
// value: response.headers["authorization"]![0]);
|
// value: response.headers["authorization"]![0]);
|
||||||
// }
|
// }
|
||||||
if (isShowLoading) EasyLoading.dismiss();
|
if (isShowLoading) EasyLoading.dismiss();
|
||||||
|
|
||||||
|
///转化结果
|
||||||
|
Map<String, dynamic> map = response.data;
|
||||||
|
if (map.keys.contains('code') && map['code'] == 401) {
|
||||||
|
response.data = {'resultCode': 'FAIL', 'resultMsg': '请重新登录'};
|
||||||
|
}
|
||||||
netResult = NetResult(
|
netResult = NetResult(
|
||||||
headers: response.headers,
|
headers: response.headers,
|
||||||
result: response.data,
|
result: response.data,
|
||||||
@@ -189,6 +195,7 @@ class HttpUtils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (resultCode.toUpperCase() == "UNLOGIN") {
|
if (resultCode.toUpperCase() == "UNLOGIN") {
|
||||||
|
ToastUtils.showToast(msg: map['resultMsg']);
|
||||||
unLoginAction?.call();
|
unLoginAction?.call();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -133,10 +133,13 @@ class _UploadImagesState extends State<UploadImages> {
|
|||||||
}) {
|
}) {
|
||||||
return GestureDetector(
|
return GestureDetector(
|
||||||
onTap: () => widget.oneTap?.call(index),
|
onTap: () => widget.oneTap?.call(index),
|
||||||
|
child: ClipRRect(
|
||||||
|
borderRadius: BorderRadiusGeometry.circular(20.r),
|
||||||
child: CustomerImagesNetworking(
|
child: CustomerImagesNetworking(
|
||||||
imageUrl: imageUrl,
|
imageUrl: imageUrl,
|
||||||
fit: widget.fit ?? BoxFit.cover,
|
fit: widget.fit ?? BoxFit.cover,
|
||||||
),
|
),
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+12
-13
@@ -96,22 +96,21 @@ class CustomerImagesNetworking extends StatelessWidget {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
String? sizeParams = '';
|
String sizeParams = '';
|
||||||
int tempHeight = 300;
|
|
||||||
int tempWidth = 300;
|
|
||||||
if (height != null) {
|
|
||||||
sizeParams = '?x-oss-process=image/resize,h_$tempHeight,w_$tempHeight';
|
|
||||||
}
|
|
||||||
if (width != null) {
|
|
||||||
tempWidth = width!.toInt() <= 300 ? 300 : width!.toInt();
|
|
||||||
sizeParams = '?x-oss-process=image/resize,h_$tempWidth,w_$tempWidth';
|
|
||||||
}
|
|
||||||
if (height != null && width != null) {
|
if (height != null && width != null) {
|
||||||
tempHeight = height!.toInt() <= 300 ? 300 : height!.toInt();
|
final h = height!.toInt() <= 1080 ? 1080 : height!.toInt();
|
||||||
sizeParams = '?x-oss-process=image/resize,h_$tempHeight,w_$tempWidth';
|
final w = width!.toInt() <= 1080 ? 1080 : width!.toInt();
|
||||||
|
sizeParams = 'x-oss-process=image/resize,h_$h,w_$w';
|
||||||
|
} else if (width != null) {
|
||||||
|
final w = width!.toInt() <= 1080 ? 1080 : width!.toInt();
|
||||||
|
sizeParams = 'x-oss-process=image/resize,h_$w,w_$w';
|
||||||
|
} else if (height != null) {
|
||||||
|
final h = height!.toInt() <= 1080 ? 1080 : height!.toInt();
|
||||||
|
sizeParams = 'x-oss-process=image/resize,h_$h,w_$h';
|
||||||
}
|
}
|
||||||
|
final separator = imageUrl.contains('?') ? '&' : '?';
|
||||||
return CachedNetworkImage(
|
return CachedNetworkImage(
|
||||||
imageUrl: imageUrl + sizeParams,
|
imageUrl: imageUrl.isEmpty ? imageUrl : '$imageUrl$separator$sizeParams',
|
||||||
width: width,
|
width: width,
|
||||||
height: height,
|
height: height,
|
||||||
fit: fit,
|
fit: fit,
|
||||||
|
|||||||
Reference in New Issue
Block a user