fix(mobile): allow gestures in asset viewer before image is loaded (#21354)

* allow gestures while loading

* disable zoom
This commit is contained in:
Mert 2025-08-27 22:52:51 -04:00 committed by GitHub
parent 1298a74230
commit 227789225a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -172,12 +172,36 @@ class _ImageWrapperState extends State<ImageWrapper> {
@override
Widget build(BuildContext context) {
if (_loading) {
return _buildLoading(context);
}
if (_lastException != null) {
return _buildError(context);
if (_loading || _lastException != null) {
return CustomChildWrapper(
childSize: null,
backgroundDecoration: widget.backgroundDecoration,
heroAttributes: widget.heroAttributes,
scaleStateChangedCallback: widget.scaleStateChangedCallback,
enableRotation: widget.enableRotation,
controller: widget.controller,
scaleStateController: widget.scaleStateController,
maxScale: widget.maxScale,
minScale: widget.minScale,
initialScale: widget.initialScale,
basePosition: widget.basePosition,
scaleStateCycle: widget.scaleStateCycle,
onTapUp: widget.onTapUp,
onTapDown: widget.onTapDown,
onDragStart: widget.onDragStart,
onDragEnd: widget.onDragEnd,
onDragUpdate: widget.onDragUpdate,
onScaleEnd: widget.onScaleEnd,
onLongPressStart: widget.onLongPressStart,
outerSize: widget.outerSize,
gestureDetectorBehavior: widget.gestureDetectorBehavior,
tightMode: widget.tightMode,
filterQuality: widget.filterQuality,
disableGestures: widget.disableGestures,
disableScaleGestures: true,
enablePanAlways: widget.enablePanAlways,
child: _loading ? _buildLoading(context) : _buildError(context),
);
}
final scaleBoundaries = ScaleBoundaries(