mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-06 09:13:48 +08:00
fix: image view
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
@@ -16,6 +16,9 @@ class ImageModel {
|
|||||||
dynamic width;
|
dynamic width;
|
||||||
dynamic height;
|
dynamic height;
|
||||||
String url;
|
String url;
|
||||||
|
|
||||||
|
dynamic get safeWidth => width ?? 1;
|
||||||
|
dynamic get safeHeight => height ?? 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget image(
|
Widget image(
|
||||||
@@ -25,8 +28,8 @@ Widget image(
|
|||||||
double imageWidth = (maxWidth - 2 * 5) / 3;
|
double imageWidth = (maxWidth - 2 * 5) / 3;
|
||||||
double imageHeight = imageWidth;
|
double imageHeight = imageWidth;
|
||||||
if (picArr.length == 1) {
|
if (picArr.length == 1) {
|
||||||
dynamic width = picArr[0].width;
|
dynamic width = picArr[0].safeWidth;
|
||||||
dynamic height = picArr[0].height;
|
dynamic height = picArr[0].safeHeight;
|
||||||
double ratioWH = width / height;
|
double ratioWH = width / height;
|
||||||
double ratioHW = height / width;
|
double ratioHW = height / width;
|
||||||
double maxRatio = 22 / 9;
|
double maxRatio = 22 / 9;
|
||||||
@@ -69,10 +72,11 @@ Widget image(
|
|||||||
src: picArr[index].url,
|
src: picArr[index].url,
|
||||||
width: imageWidth,
|
width: imageWidth,
|
||||||
height: imageHeight,
|
height: imageHeight,
|
||||||
origAspectRatio: picArr[index].width / picArr[index].height,
|
origAspectRatio:
|
||||||
|
picArr[index].safeWidth / picArr[index].safeHeight,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
if (picArr[index].height / picArr[index].width > 22 / 9)
|
if (picArr[index].safeHeight / picArr[index].safeWidth > 22 / 9)
|
||||||
const PBadge(
|
const PBadge(
|
||||||
text: '长图',
|
text: '长图',
|
||||||
right: 8,
|
right: 8,
|
||||||
|
|||||||
Reference in New Issue
Block a user