chore: bump dart sdk to 3.8 (#20355)
* chore: bump dart sdk to 3.8 * chore: make build * make pigeon * chore: format files --------- Co-authored-by: shenlong-tanwen <139912620+shalong-tanwen@users.noreply.github.com>
This commit is contained in:
@@ -72,12 +72,7 @@ abstract class PhotoViewControllerBase<T extends PhotoViewControllerValue> {
|
||||
Offset? rotationFocusPoint;
|
||||
|
||||
/// Update multiple fields of the state with only one update streamed.
|
||||
void updateMultiple({
|
||||
Offset? position,
|
||||
double? scale,
|
||||
double? rotation,
|
||||
Offset? rotationFocusPoint,
|
||||
});
|
||||
void updateMultiple({Offset? position, double? scale, double? rotation, Offset? rotationFocusPoint});
|
||||
}
|
||||
|
||||
/// The state value stored and streamed by [PhotoViewController].
|
||||
@@ -122,19 +117,16 @@ class PhotoViewControllerValue {
|
||||
/// For details of fields and methods, check [PhotoViewControllerBase].
|
||||
///
|
||||
class PhotoViewController implements PhotoViewControllerBase<PhotoViewControllerValue> {
|
||||
PhotoViewController({
|
||||
Offset initialPosition = Offset.zero,
|
||||
double initialRotation = 0.0,
|
||||
double? initialScale,
|
||||
}) : _valueNotifier = IgnorableValueNotifier(
|
||||
PhotoViewControllerValue(
|
||||
position: initialPosition,
|
||||
rotation: initialRotation,
|
||||
scale: initialScale,
|
||||
rotationFocusPoint: null,
|
||||
),
|
||||
PhotoViewController({Offset initialPosition = Offset.zero, double initialRotation = 0.0, double? initialScale})
|
||||
: _valueNotifier = IgnorableValueNotifier(
|
||||
PhotoViewControllerValue(
|
||||
position: initialPosition,
|
||||
rotation: initialRotation,
|
||||
scale: initialScale,
|
||||
rotationFocusPoint: null,
|
||||
),
|
||||
super() {
|
||||
),
|
||||
super() {
|
||||
initial = value;
|
||||
prevValue = initial;
|
||||
|
||||
@@ -299,12 +291,7 @@ class PhotoViewController implements PhotoViewControllerBase<PhotoViewController
|
||||
Offset? get rotationFocusPoint => value.rotationFocusPoint;
|
||||
|
||||
@override
|
||||
void updateMultiple({
|
||||
Offset? position,
|
||||
double? scale,
|
||||
double? rotation,
|
||||
Offset? rotationFocusPoint,
|
||||
}) {
|
||||
void updateMultiple({Offset? position, double? scale, double? rotation, Offset? rotationFocusPoint}) {
|
||||
prevValue = value;
|
||||
value = PhotoViewControllerValue(
|
||||
position: position ?? value.position,
|
||||
|
||||
@@ -35,23 +35,15 @@ mixin PhotoViewControllerDelegate on State<PhotoViewCore> {
|
||||
controller.setScaleInvisibly(scale);
|
||||
return;
|
||||
}
|
||||
final double prevScale = controller.scale ??
|
||||
getScaleForScaleState(
|
||||
scaleStateController.prevScaleState,
|
||||
scaleBoundaries,
|
||||
);
|
||||
final double prevScale =
|
||||
controller.scale ?? getScaleForScaleState(scaleStateController.prevScaleState, scaleBoundaries);
|
||||
|
||||
final double nextScale = getScaleForScaleState(
|
||||
scaleStateController.scaleState,
|
||||
scaleBoundaries,
|
||||
);
|
||||
final double nextScale = getScaleForScaleState(scaleStateController.scaleState, scaleBoundaries);
|
||||
|
||||
_animateScale!(prevScale, nextScale);
|
||||
}
|
||||
|
||||
void addAnimateOnScaleStateUpdate(
|
||||
void Function(double prevScale, double nextScale) animateScale,
|
||||
) {
|
||||
void addAnimateOnScaleStateUpdate(void Function(double prevScale, double nextScale) animateScale) {
|
||||
_animateScale = animateScale;
|
||||
}
|
||||
|
||||
@@ -62,8 +54,9 @@ mixin PhotoViewControllerDelegate on State<PhotoViewCore> {
|
||||
if (controller.scale == controller.prevValue.scale) {
|
||||
return;
|
||||
}
|
||||
final PhotoViewScaleState newScaleState =
|
||||
(scale > scaleBoundaries.initialScale) ? PhotoViewScaleState.zoomedIn : PhotoViewScaleState.zoomedOut;
|
||||
final PhotoViewScaleState newScaleState = (scale > scaleBoundaries.initialScale)
|
||||
? PhotoViewScaleState.zoomedIn
|
||||
: PhotoViewScaleState.zoomedOut;
|
||||
|
||||
scaleStateController.setInvisibly(newScaleState);
|
||||
}
|
||||
@@ -76,10 +69,7 @@ mixin PhotoViewControllerDelegate on State<PhotoViewCore> {
|
||||
|
||||
final scaleExistsOnController = controller.scale != null;
|
||||
if (needsRecalc || !scaleExistsOnController) {
|
||||
final newScale = getScaleForScaleState(
|
||||
scaleStateController.scaleState,
|
||||
scaleBoundaries,
|
||||
);
|
||||
final newScale = getScaleForScaleState(scaleStateController.scaleState, scaleBoundaries);
|
||||
markNeedsScaleRecalc = false;
|
||||
scale = newScale;
|
||||
return newScale;
|
||||
@@ -89,12 +79,7 @@ mixin PhotoViewControllerDelegate on State<PhotoViewCore> {
|
||||
|
||||
set scale(double scale) => controller.setScaleInvisibly(scale);
|
||||
|
||||
void updateMultiple({
|
||||
Offset? position,
|
||||
double? scale,
|
||||
double? rotation,
|
||||
Offset? rotationFocusPoint,
|
||||
}) {
|
||||
void updateMultiple({Offset? position, double? scale, double? rotation, Offset? rotationFocusPoint}) {
|
||||
controller.updateMultiple(
|
||||
position: position,
|
||||
scale: scale,
|
||||
@@ -106,8 +91,9 @@ mixin PhotoViewControllerDelegate on State<PhotoViewCore> {
|
||||
PhotoViewScaleState getScaleStateFromNewScale(double newScale) {
|
||||
PhotoViewScaleState newScaleState = PhotoViewScaleState.initial;
|
||||
if (scale != scaleBoundaries.initialScale) {
|
||||
newScaleState =
|
||||
(newScale > scaleBoundaries.initialScale) ? PhotoViewScaleState.zoomedIn : PhotoViewScaleState.zoomedOut;
|
||||
newScaleState = (newScale > scaleBoundaries.initialScale)
|
||||
? PhotoViewScaleState.zoomedIn
|
||||
: PhotoViewScaleState.zoomedOut;
|
||||
}
|
||||
return newScaleState;
|
||||
}
|
||||
@@ -115,8 +101,9 @@ mixin PhotoViewControllerDelegate on State<PhotoViewCore> {
|
||||
void updateScaleStateFromNewScale(double newScale) {
|
||||
PhotoViewScaleState newScaleState = PhotoViewScaleState.initial;
|
||||
if (scale != scaleBoundaries.initialScale) {
|
||||
newScaleState =
|
||||
(newScale > scaleBoundaries.initialScale) ? PhotoViewScaleState.zoomedIn : PhotoViewScaleState.zoomedOut;
|
||||
newScaleState = (newScale > scaleBoundaries.initialScale)
|
||||
? PhotoViewScaleState.zoomedIn
|
||||
: PhotoViewScaleState.zoomedOut;
|
||||
}
|
||||
scaleStateController.setInvisibly(newScaleState);
|
||||
}
|
||||
@@ -127,10 +114,7 @@ mixin PhotoViewControllerDelegate on State<PhotoViewCore> {
|
||||
scaleStateController.scaleState = scaleStateCycle(scaleState);
|
||||
return;
|
||||
}
|
||||
final double originalScale = getScaleForScaleState(
|
||||
scaleState,
|
||||
scaleBoundaries,
|
||||
);
|
||||
final double originalScale = getScaleForScaleState(scaleState, scaleBoundaries);
|
||||
|
||||
double prevScale = originalScale;
|
||||
PhotoViewScaleState prevScaleState = scaleState;
|
||||
|
||||
@@ -19,8 +19,9 @@ typedef ScaleStateListener = void Function(double prevScale, double nextScale);
|
||||
/// The updates should be done via [scaleState] setter and the updated listened via [outputScaleStateStream]
|
||||
///
|
||||
class PhotoViewScaleStateController {
|
||||
late final IgnorableValueNotifier<PhotoViewScaleState> _scaleStateNotifier =
|
||||
IgnorableValueNotifier(PhotoViewScaleState.initial)..addListener(_scaleStateChangeListener);
|
||||
late final IgnorableValueNotifier<PhotoViewScaleState> _scaleStateNotifier = IgnorableValueNotifier(
|
||||
PhotoViewScaleState.initial,
|
||||
)..addListener(_scaleStateChangeListener);
|
||||
final StreamController<PhotoViewScaleState> _outputScaleStateCtrl = StreamController<PhotoViewScaleState>.broadcast()
|
||||
..sink.add(PhotoViewScaleState.initial);
|
||||
|
||||
|
||||
@@ -18,9 +18,7 @@ import 'package:immich_mobile/widgets/photo_view/src/core/photo_view_gesture_det
|
||||
import 'package:immich_mobile/widgets/photo_view/src/core/photo_view_hit_corners.dart';
|
||||
import 'package:immich_mobile/widgets/photo_view/src/utils/photo_view_utils.dart';
|
||||
|
||||
const _defaultDecoration = BoxDecoration(
|
||||
color: Color.fromRGBO(0, 0, 0, 1.0),
|
||||
);
|
||||
const _defaultDecoration = BoxDecoration(color: Color.fromRGBO(0, 0, 0, 1.0));
|
||||
|
||||
/// Internal widget in which controls all animations lifecycle, core responses
|
||||
/// to user gestures, updates to the controller state and mounts the entire PhotoView Layout
|
||||
@@ -77,9 +75,9 @@ class PhotoViewCore extends StatefulWidget {
|
||||
required this.disableGestures,
|
||||
required this.disableScaleGestures,
|
||||
required this.enablePanAlways,
|
||||
}) : semanticLabel = null,
|
||||
imageProvider = null,
|
||||
gaplessPlayback = false;
|
||||
}) : semanticLabel = null,
|
||||
imageProvider = null,
|
||||
gaplessPlayback = false;
|
||||
|
||||
final Decoration? backgroundDecoration;
|
||||
final ImageProvider? imageProvider;
|
||||
@@ -163,9 +161,9 @@ class PhotoViewCoreState extends State<PhotoViewCore>
|
||||
}
|
||||
|
||||
bool _shouldAllowPanRotate() => switch (scaleStateController.scaleState) {
|
||||
PhotoViewScaleState.zoomedIn => scaleStateController.hasZoomedOutManually,
|
||||
_ => true,
|
||||
};
|
||||
PhotoViewScaleState.zoomedIn => scaleStateController.hasZoomedOutManually,
|
||||
_ => true,
|
||||
};
|
||||
|
||||
void onScaleUpdate(ScaleUpdateDetails details) {
|
||||
final double newScale = _scaleBefore! * details.scale;
|
||||
@@ -206,10 +204,7 @@ class PhotoViewCoreState extends State<PhotoViewCore>
|
||||
if (s > maxScale) {
|
||||
final double scaleComebackRatio = maxScale / s;
|
||||
animateScale(s, maxScale);
|
||||
final Offset clampedPosition = clampPosition(
|
||||
position: p * scaleComebackRatio,
|
||||
scale: maxScale,
|
||||
);
|
||||
final Offset clampedPosition = clampPosition(position: p * scaleComebackRatio, scale: maxScale);
|
||||
animatePosition(p, clampedPosition);
|
||||
return;
|
||||
}
|
||||
@@ -218,13 +213,7 @@ class PhotoViewCoreState extends State<PhotoViewCore>
|
||||
if (s < minScale) {
|
||||
final double scaleComebackRatio = minScale / s;
|
||||
animateScale(s, minScale);
|
||||
animatePosition(
|
||||
p,
|
||||
clampPosition(
|
||||
position: p * scaleComebackRatio,
|
||||
scale: minScale,
|
||||
),
|
||||
);
|
||||
animatePosition(p, clampPosition(position: p * scaleComebackRatio, scale: minScale));
|
||||
return;
|
||||
}
|
||||
// get magnitude from gesture velocity
|
||||
@@ -233,10 +222,7 @@ class PhotoViewCoreState extends State<PhotoViewCore>
|
||||
// animate velocity only if there is no scale change and a significant magnitude
|
||||
if (_scaleBefore! / s == 1.0 && magnitude >= 400.0) {
|
||||
final Offset direction = details.velocity.pixelsPerSecond / magnitude;
|
||||
animatePosition(
|
||||
p,
|
||||
clampPosition(position: p + direction * 100.0),
|
||||
);
|
||||
animatePosition(p, clampPosition(position: p + direction * 100.0));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -248,10 +234,7 @@ class PhotoViewCoreState extends State<PhotoViewCore>
|
||||
if (!mounted) {
|
||||
return;
|
||||
}
|
||||
_scaleAnimation = Tween<double>(
|
||||
begin: from,
|
||||
end: to,
|
||||
).animate(_scaleAnimationController);
|
||||
_scaleAnimation = Tween<double>(begin: from, end: to).animate(_scaleAnimationController);
|
||||
_scaleAnimationController
|
||||
..value = 0.0
|
||||
..fling(velocity: 0.4);
|
||||
@@ -355,10 +338,7 @@ class PhotoViewCoreState extends State<PhotoViewCore>
|
||||
return StreamBuilder(
|
||||
stream: controller.outputStateStream,
|
||||
initialData: controller.prevValue,
|
||||
builder: (
|
||||
BuildContext context,
|
||||
AsyncSnapshot<PhotoViewControllerValue> snapshot,
|
||||
) {
|
||||
builder: (BuildContext context, AsyncSnapshot<PhotoViewControllerValue> snapshot) {
|
||||
if (snapshot.hasData) {
|
||||
final PhotoViewControllerValue value = snapshot.data!;
|
||||
final useImageScale = widget.filterQuality != FilterQuality.none;
|
||||
@@ -371,11 +351,7 @@ class PhotoViewCoreState extends State<PhotoViewCore>
|
||||
..rotateZ(value.rotation);
|
||||
|
||||
final Widget customChildLayout = CustomSingleChildLayout(
|
||||
delegate: _CenterWithOriginalSizeDelegate(
|
||||
scaleBoundaries.childSize,
|
||||
basePosition,
|
||||
useImageScale,
|
||||
),
|
||||
delegate: _CenterWithOriginalSizeDelegate(scaleBoundaries.childSize, basePosition, useImageScale),
|
||||
child: _buildHero(_buildChild()),
|
||||
);
|
||||
|
||||
@@ -383,11 +359,7 @@ class PhotoViewCoreState extends State<PhotoViewCore>
|
||||
constraints: widget.tightMode ? BoxConstraints.tight(scaleBoundaries.childSize * scale) : null,
|
||||
decoration: widget.backgroundDecoration ?? _defaultDecoration,
|
||||
child: Center(
|
||||
child: Transform(
|
||||
transform: matrix,
|
||||
alignment: basePosition,
|
||||
child: customChildLayout,
|
||||
),
|
||||
child: Transform(transform: matrix, alignment: basePosition, child: customChildLayout),
|
||||
),
|
||||
);
|
||||
|
||||
@@ -402,28 +374,20 @@ class PhotoViewCoreState extends State<PhotoViewCore>
|
||||
onScaleUpdate: widget.disableScaleGestures ? null : onScaleUpdate,
|
||||
onScaleEnd: widget.disableScaleGestures ? null : onScaleEnd,
|
||||
onDragStart: widget.onDragStart != null
|
||||
? (details) => widget.onDragStart!(
|
||||
context,
|
||||
details,
|
||||
widget.controller,
|
||||
widget.scaleStateController,
|
||||
)
|
||||
? (details) => widget.onDragStart!(context, details, widget.controller, widget.scaleStateController)
|
||||
: null,
|
||||
onDragEnd: widget.onDragEnd != null
|
||||
? (details) => widget.onDragEnd!(context, details, widget.controller.value)
|
||||
: null,
|
||||
onDragUpdate: widget.onDragUpdate != null
|
||||
? (details) => widget.onDragUpdate!(
|
||||
context,
|
||||
details,
|
||||
widget.controller.value,
|
||||
)
|
||||
? (details) => widget.onDragUpdate!(context, details, widget.controller.value)
|
||||
: null,
|
||||
hitDetector: this,
|
||||
onTapUp: widget.onTapUp != null ? (details) => widget.onTapUp!(context, details, value) : null,
|
||||
onTapDown: widget.onTapDown != null ? (details) => widget.onTapDown!(context, details, value) : null,
|
||||
onLongPressStart:
|
||||
widget.onLongPressStart != null ? (details) => widget.onLongPressStart!(context, details, value) : null,
|
||||
onLongPressStart: widget.onLongPressStart != null
|
||||
? (details) => widget.onLongPressStart!(context, details, value)
|
||||
: null,
|
||||
child: child,
|
||||
);
|
||||
} else {
|
||||
@@ -462,11 +426,7 @@ class PhotoViewCoreState extends State<PhotoViewCore>
|
||||
}
|
||||
|
||||
class _CenterWithOriginalSizeDelegate extends SingleChildLayoutDelegate {
|
||||
const _CenterWithOriginalSizeDelegate(
|
||||
this.subjectSize,
|
||||
this.basePosition,
|
||||
this.useImageScale,
|
||||
);
|
||||
const _CenterWithOriginalSizeDelegate(this.subjectSize, this.basePosition, this.useImageScale);
|
||||
|
||||
final Size subjectSize;
|
||||
final Alignment basePosition;
|
||||
|
||||
@@ -103,15 +103,13 @@ class PhotoViewGestureDetector extends StatelessWidget {
|
||||
);
|
||||
|
||||
gestures[LongPressGestureRecognizer] = GestureRecognizerFactoryWithHandlers<LongPressGestureRecognizer>(
|
||||
() => LongPressGestureRecognizer(debugOwner: this), (LongPressGestureRecognizer instance) {
|
||||
instance.onLongPressStart = onLongPressStart;
|
||||
});
|
||||
|
||||
return RawGestureDetector(
|
||||
behavior: behavior,
|
||||
gestures: gestures,
|
||||
child: child,
|
||||
() => LongPressGestureRecognizer(debugOwner: this),
|
||||
(LongPressGestureRecognizer instance) {
|
||||
instance.onLongPressStart = onLongPressStart;
|
||||
},
|
||||
);
|
||||
|
||||
return RawGestureDetector(behavior: behavior, gestures: gestures, child: child);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -241,16 +239,11 @@ class PhotoViewGestureRecognizer extends ScaleGestureRecognizer {
|
||||
/// );
|
||||
/// ```
|
||||
class PhotoViewGestureDetectorScope extends InheritedWidget {
|
||||
const PhotoViewGestureDetectorScope({
|
||||
super.key,
|
||||
this.axis,
|
||||
this.touchSlopFactor = .2,
|
||||
required super.child,
|
||||
});
|
||||
const PhotoViewGestureDetectorScope({super.key, this.axis, this.touchSlopFactor = .2, required super.child});
|
||||
|
||||
static PhotoViewGestureDetectorScope? of(BuildContext context) {
|
||||
final PhotoViewGestureDetectorScope? scope =
|
||||
context.dependOnInheritedWidgetOfExactType<PhotoViewGestureDetectorScope>();
|
||||
final PhotoViewGestureDetectorScope? scope = context
|
||||
.dependOnInheritedWidgetOfExactType<PhotoViewGestureDetectorScope>();
|
||||
return scope;
|
||||
}
|
||||
|
||||
@@ -273,10 +266,7 @@ class PhotoViewGestureDetectorScope extends InheritedWidget {
|
||||
// we cannot change that, but we can prevent the scrollable from panning until this threshold is reached
|
||||
// and let other recognizers accept the gesture instead
|
||||
class PhotoViewPageViewScrollPhysics extends ScrollPhysics {
|
||||
const PhotoViewPageViewScrollPhysics({
|
||||
this.touchSlopFactor = 0.1,
|
||||
super.parent,
|
||||
});
|
||||
const PhotoViewPageViewScrollPhysics({this.touchSlopFactor = 0.1, super.parent});
|
||||
|
||||
// in [0, 1]
|
||||
// 0: most reactive but will not let PhotoView recognizers accept gestures
|
||||
@@ -285,10 +275,7 @@ class PhotoViewPageViewScrollPhysics extends ScrollPhysics {
|
||||
|
||||
@override
|
||||
PhotoViewPageViewScrollPhysics applyTo(ScrollPhysics? ancestor) {
|
||||
return PhotoViewPageViewScrollPhysics(
|
||||
touchSlopFactor: touchSlopFactor,
|
||||
parent: buildParent(ancestor),
|
||||
);
|
||||
return PhotoViewPageViewScrollPhysics(touchSlopFactor: touchSlopFactor, parent: buildParent(ancestor));
|
||||
}
|
||||
|
||||
@override
|
||||
|
||||
@@ -25,10 +25,7 @@ mixin HitCornersDetector on PhotoViewControllerDelegate {
|
||||
return HitCorners(y <= cornersY.min, y >= cornersY.max);
|
||||
}
|
||||
|
||||
bool _shouldMoveAxis(
|
||||
HitCorners hitCorners,
|
||||
double mainAxisMove,
|
||||
) {
|
||||
bool _shouldMoveAxis(HitCorners hitCorners, double mainAxisMove) {
|
||||
if (mainAxisMove == 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -9,13 +9,7 @@ class PhotoViewDefaultError extends StatelessWidget {
|
||||
Widget build(BuildContext context) {
|
||||
return DecoratedBox(
|
||||
decoration: decoration,
|
||||
child: Center(
|
||||
child: Icon(
|
||||
Icons.broken_image,
|
||||
color: Colors.grey[400],
|
||||
size: 40.0,
|
||||
),
|
||||
),
|
||||
child: Center(child: Icon(Icons.broken_image, color: Colors.grey[400], size: 40.0)),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -32,11 +26,7 @@ class PhotoViewDefaultLoading extends StatelessWidget {
|
||||
final value = loadedBytes != null && expectedBytes != null ? loadedBytes / expectedBytes : null;
|
||||
|
||||
return Center(
|
||||
child: SizedBox(
|
||||
width: 20.0,
|
||||
height: 20.0,
|
||||
child: CircularProgressIndicator(value: value),
|
||||
),
|
||||
child: SizedBox(width: 20.0, height: 20.0, child: CircularProgressIndicator(value: value)),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -109,9 +109,7 @@ class _ImageWrapperState extends State<ImageWrapper> {
|
||||
|
||||
// retrieve image from the provider
|
||||
void _resolveImage() {
|
||||
final ImageStream newStream = widget.imageProvider.resolve(
|
||||
const ImageConfiguration(),
|
||||
);
|
||||
final ImageStream newStream = widget.imageProvider.resolve(const ImageConfiguration());
|
||||
_updateSourceStream(newStream);
|
||||
}
|
||||
|
||||
@@ -125,10 +123,7 @@ class _ImageWrapperState extends State<ImageWrapper> {
|
||||
|
||||
void handleImageFrame(ImageInfo info, bool synchronousCall) {
|
||||
setupCB() {
|
||||
_imageSize = Size(
|
||||
info.image.width.toDouble(),
|
||||
info.image.height.toDouble(),
|
||||
);
|
||||
_imageSize = Size(info.image.width.toDouble(), info.image.height.toDouble());
|
||||
_loading = false;
|
||||
_imageInfo = _imageInfo;
|
||||
|
||||
@@ -154,11 +149,7 @@ class _ImageWrapperState extends State<ImageWrapper> {
|
||||
}());
|
||||
}
|
||||
|
||||
_imageStreamListener = ImageStreamListener(
|
||||
handleImageFrame,
|
||||
onChunk: handleImageChunk,
|
||||
onError: handleError,
|
||||
);
|
||||
_imageStreamListener = ImageStreamListener(handleImageFrame, onChunk: handleImageChunk, onError: handleError);
|
||||
|
||||
return _imageStreamListener!;
|
||||
}
|
||||
@@ -227,20 +218,14 @@ class _ImageWrapperState extends State<ImageWrapper> {
|
||||
return widget.loadingBuilder!(context, _loadingProgress, widget.index);
|
||||
}
|
||||
|
||||
return PhotoViewDefaultLoading(
|
||||
event: _loadingProgress,
|
||||
);
|
||||
return PhotoViewDefaultLoading(event: _loadingProgress);
|
||||
}
|
||||
|
||||
Widget _buildError(
|
||||
BuildContext context,
|
||||
) {
|
||||
Widget _buildError(BuildContext context) {
|
||||
if (widget.errorBuilder != null) {
|
||||
return widget.errorBuilder!(context, _lastException!, _lastStack);
|
||||
}
|
||||
return PhotoViewDefaultError(
|
||||
decoration: widget.backgroundDecoration,
|
||||
);
|
||||
return PhotoViewDefaultError(decoration: widget.backgroundDecoration);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -58,11 +58,7 @@ class IgnorableChangeNotifier extends ChangeNotifier {
|
||||
}
|
||||
} catch (exception, stack) {
|
||||
FlutterError.reportError(
|
||||
FlutterErrorDetails(
|
||||
exception: exception,
|
||||
stack: stack,
|
||||
library: 'Photoview library',
|
||||
),
|
||||
FlutterErrorDetails(exception: exception, stack: stack, library: 'Photoview library'),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,22 +5,15 @@ import "package:immich_mobile/widgets/photo_view/src/photo_view_computed_scale.d
|
||||
import 'package:immich_mobile/widgets/photo_view/src/photo_view_scale_state.dart';
|
||||
|
||||
/// Given a [PhotoViewScaleState], returns a scale value considering [scaleBoundaries].
|
||||
double getScaleForScaleState(
|
||||
PhotoViewScaleState scaleState,
|
||||
ScaleBoundaries scaleBoundaries,
|
||||
) {
|
||||
double getScaleForScaleState(PhotoViewScaleState scaleState, ScaleBoundaries scaleBoundaries) {
|
||||
return switch (scaleState) {
|
||||
PhotoViewScaleState.initial ||
|
||||
PhotoViewScaleState.zoomedIn ||
|
||||
PhotoViewScaleState.zoomedOut =>
|
||||
_clampSize(scaleBoundaries.initialScale, scaleBoundaries),
|
||||
PhotoViewScaleState.zoomedOut => _clampSize(scaleBoundaries.initialScale, scaleBoundaries),
|
||||
PhotoViewScaleState.covering => _clampSize(
|
||||
_scaleForCovering(
|
||||
scaleBoundaries.outerSize,
|
||||
scaleBoundaries.childSize,
|
||||
),
|
||||
scaleBoundaries,
|
||||
),
|
||||
_scaleForCovering(scaleBoundaries.outerSize, scaleBoundaries.childSize),
|
||||
scaleBoundaries,
|
||||
),
|
||||
PhotoViewScaleState.originalSize => _clampSize(1.0, scaleBoundaries),
|
||||
};
|
||||
}
|
||||
@@ -28,13 +21,7 @@ double getScaleForScaleState(
|
||||
/// Internal class to wraps custom scale boundaries (min, max and initial)
|
||||
/// Also, stores values regarding the two sizes: the container and the child.
|
||||
class ScaleBoundaries {
|
||||
const ScaleBoundaries(
|
||||
this._minScale,
|
||||
this._maxScale,
|
||||
this._initialScale,
|
||||
this.outerSize,
|
||||
this.childSize,
|
||||
);
|
||||
const ScaleBoundaries(this._minScale, this._maxScale, this._initialScale, this.outerSize, this.childSize);
|
||||
|
||||
final dynamic _minScale;
|
||||
final dynamic _maxScale;
|
||||
|
||||
Reference in New Issue
Block a user