mirror of
https://github.com/bggRGjQaUbCoE/PiliPlus.git
synced 2026-06-01 00:28:18 +08:00
@@ -377,7 +377,7 @@ class _GalleryViewerState extends State<GalleryViewer>
|
|||||||
}
|
}
|
||||||
if (frame == null) {
|
if (frame == null) {
|
||||||
if (widget.quality == _quality) {
|
if (widget.quality == _quality) {
|
||||||
return const SizedBox.expand();
|
return child;
|
||||||
} else {
|
} else {
|
||||||
return Image(
|
return Image(
|
||||||
image: CachedNetworkImageProvider(
|
image: CachedNetworkImageProvider(
|
||||||
|
|||||||
@@ -595,13 +595,14 @@ class _ImageState extends State<Image> with WidgetsBindingObserver {
|
|||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget result;
|
final Size childSize;
|
||||||
|
final bool isLongPic;
|
||||||
|
double? minScale, maxScale;
|
||||||
if (_imageInfo != null) {
|
if (_imageInfo != null) {
|
||||||
double? minScale, maxScale;
|
|
||||||
final imgWidth = _imageInfo!.image.width.toDouble();
|
final imgWidth = _imageInfo!.image.width.toDouble();
|
||||||
final imgHeight = _imageInfo!.image.height.toDouble();
|
final imgHeight = _imageInfo!.image.height.toDouble();
|
||||||
final imgRatio = imgHeight / imgWidth;
|
final imgRatio = imgHeight / imgWidth;
|
||||||
final isLongPic =
|
isLongPic =
|
||||||
imgRatio > StyleString.imgMaxRatio &&
|
imgRatio > StyleString.imgMaxRatio &&
|
||||||
imgHeight > widget.containerSize.height;
|
imgHeight > widget.containerSize.height;
|
||||||
if (isLongPic) {
|
if (isLongPic) {
|
||||||
@@ -609,25 +610,25 @@ class _ImageState extends State<Image> with WidgetsBindingObserver {
|
|||||||
minScale = compatWidth / widget.containerSize.height * imgRatio;
|
minScale = compatWidth / widget.containerSize.height * imgRatio;
|
||||||
maxScale = math.max(widget.maxScale, minScale * 3);
|
maxScale = math.max(widget.maxScale, minScale * 3);
|
||||||
}
|
}
|
||||||
result = Viewer(
|
childSize = Size(imgWidth, imgHeight);
|
||||||
minScale: minScale ?? widget.minScale,
|
|
||||||
maxScale: maxScale ?? widget.maxScale,
|
|
||||||
isLongPic: isLongPic,
|
|
||||||
containerSize: widget.containerSize,
|
|
||||||
childSize: Size(imgWidth, imgHeight),
|
|
||||||
onDragStart: widget.onDragStart,
|
|
||||||
onDragUpdate: widget.onDragUpdate,
|
|
||||||
onDragEnd: widget.onDragEnd,
|
|
||||||
tapGestureRecognizer: widget.tapGestureRecognizer,
|
|
||||||
horizontalDragGestureRecognizer: widget.horizontalDragGestureRecognizer,
|
|
||||||
onChangePage: widget.onChangePage,
|
|
||||||
child: RawImage(
|
|
||||||
image: _imageInfo!.image,
|
|
||||||
),
|
|
||||||
);
|
|
||||||
} else {
|
} else {
|
||||||
result = const SizedBox.expand();
|
childSize = .zero;
|
||||||
|
isLongPic = false;
|
||||||
}
|
}
|
||||||
|
Widget result = Viewer(
|
||||||
|
minScale: minScale ?? widget.minScale,
|
||||||
|
maxScale: maxScale ?? widget.maxScale,
|
||||||
|
isLongPic: isLongPic,
|
||||||
|
containerSize: widget.containerSize,
|
||||||
|
childSize: childSize,
|
||||||
|
onDragStart: widget.onDragStart,
|
||||||
|
onDragUpdate: widget.onDragUpdate,
|
||||||
|
onDragEnd: widget.onDragEnd,
|
||||||
|
tapGestureRecognizer: widget.tapGestureRecognizer,
|
||||||
|
horizontalDragGestureRecognizer: widget.horizontalDragGestureRecognizer,
|
||||||
|
onChangePage: widget.onChangePage,
|
||||||
|
child: RawImage(image: _imageInfo?.image),
|
||||||
|
);
|
||||||
|
|
||||||
if (!widget.excludeFromSemantics) {
|
if (!widget.excludeFromSemantics) {
|
||||||
result = Semantics(
|
result = Semantics(
|
||||||
|
|||||||
Reference in New Issue
Block a user