deps(mobile): flutter 3.16 (#6677)
* dep(mobile): update flutter and deps * chore: dart analyzer * chore: update flutter workflow version * chore: dart format * fix: gallery_viewer PopScope --------- Co-authored-by: shenlong-tanwen <139912620+shalong-tanwen@users.noreply.github.com>
This commit is contained in:
@@ -233,7 +233,7 @@ class PhotoView extends StatefulWidget {
|
||||
///
|
||||
/// Internally, the image is rendered within an [Image] widget.
|
||||
const PhotoView({
|
||||
Key? key,
|
||||
super.key,
|
||||
required this.imageProvider,
|
||||
required this.index,
|
||||
this.loadingBuilder,
|
||||
@@ -264,8 +264,7 @@ class PhotoView extends StatefulWidget {
|
||||
this.errorBuilder,
|
||||
this.enablePanAlways,
|
||||
}) : child = null,
|
||||
childSize = null,
|
||||
super(key: key);
|
||||
childSize = null;
|
||||
|
||||
/// Creates a widget that displays a zoomable child.
|
||||
///
|
||||
@@ -274,7 +273,7 @@ class PhotoView extends StatefulWidget {
|
||||
/// Instead of a [imageProvider], this constructor will receive a [child] and a [childSize].
|
||||
///
|
||||
const PhotoView.customChild({
|
||||
Key? key,
|
||||
super.key,
|
||||
required this.child,
|
||||
this.childSize,
|
||||
this.backgroundDecoration,
|
||||
@@ -305,8 +304,7 @@ class PhotoView extends StatefulWidget {
|
||||
imageProvider = null,
|
||||
gaplessPlayback = false,
|
||||
loadingBuilder = null,
|
||||
index = 0,
|
||||
super(key: key);
|
||||
index = 0;
|
||||
|
||||
/// Given a [imageProvider] it resolves into an zoomable image widget using. It
|
||||
/// is required
|
||||
|
||||
@@ -107,7 +107,7 @@ typedef PhotoViewGalleryBuilder = PhotoViewGalleryPageOptions Function(
|
||||
class PhotoViewGallery extends StatefulWidget {
|
||||
/// Construct a gallery with static items through a list of [PhotoViewGalleryPageOptions].
|
||||
const PhotoViewGallery({
|
||||
Key? key,
|
||||
super.key,
|
||||
required this.pageOptions,
|
||||
this.loadingBuilder,
|
||||
this.backgroundDecoration,
|
||||
@@ -123,14 +123,13 @@ class PhotoViewGallery extends StatefulWidget {
|
||||
this.customSize,
|
||||
this.allowImplicitScrolling = false,
|
||||
}) : itemCount = null,
|
||||
builder = null,
|
||||
super(key: key);
|
||||
builder = null;
|
||||
|
||||
/// Construct a gallery with dynamic items.
|
||||
///
|
||||
/// The builder must return a [PhotoViewGalleryPageOptions].
|
||||
const PhotoViewGallery.builder({
|
||||
Key? key,
|
||||
super.key,
|
||||
required this.itemCount,
|
||||
required this.builder,
|
||||
this.loadingBuilder,
|
||||
@@ -148,8 +147,7 @@ class PhotoViewGallery extends StatefulWidget {
|
||||
this.allowImplicitScrolling = false,
|
||||
}) : pageOptions = null,
|
||||
assert(itemCount != null),
|
||||
assert(builder != null),
|
||||
super(key: key);
|
||||
assert(builder != null);
|
||||
|
||||
/// A list of options to describe the items in the gallery
|
||||
final List<PhotoViewGalleryPageOptions>? pageOptions;
|
||||
|
||||
@@ -25,7 +25,7 @@ const _defaultDecoration = BoxDecoration(
|
||||
/// to user gestures, updates to the controller state and mounts the entire PhotoView Layout
|
||||
class PhotoViewCore extends StatefulWidget {
|
||||
const PhotoViewCore({
|
||||
Key? key,
|
||||
super.key,
|
||||
required this.imageProvider,
|
||||
required this.backgroundDecoration,
|
||||
required this.gaplessPlayback,
|
||||
@@ -47,11 +47,10 @@ class PhotoViewCore extends StatefulWidget {
|
||||
required this.filterQuality,
|
||||
required this.disableGestures,
|
||||
required this.enablePanAlways,
|
||||
}) : customChild = null,
|
||||
super(key: key);
|
||||
}) : customChild = null;
|
||||
|
||||
const PhotoViewCore.customChild({
|
||||
Key? key,
|
||||
super.key,
|
||||
required this.customChild,
|
||||
required this.backgroundDecoration,
|
||||
this.heroAttributes,
|
||||
@@ -73,8 +72,7 @@ class PhotoViewCore extends StatefulWidget {
|
||||
required this.disableGestures,
|
||||
required this.enablePanAlways,
|
||||
}) : imageProvider = null,
|
||||
gaplessPlayback = false,
|
||||
super(key: key);
|
||||
gaplessPlayback = false;
|
||||
|
||||
final Decoration? backgroundDecoration;
|
||||
final ImageProvider? imageProvider;
|
||||
@@ -359,15 +357,15 @@ class PhotoViewCoreState extends State<PhotoViewCore>
|
||||
onScaleStart: onScaleStart,
|
||||
onScaleUpdate: onScaleUpdate,
|
||||
onScaleEnd: onScaleEnd,
|
||||
onDragStart: widget.onDragStart != null
|
||||
? (details) => widget.onDragStart!(context, details, value)
|
||||
: null,
|
||||
onDragEnd: widget.onDragEnd != null
|
||||
? (details) => widget.onDragEnd!(context, details, value)
|
||||
: null,
|
||||
onDragStart: widget.onDragStart != null
|
||||
? (details) => widget.onDragStart!(context, details, value)
|
||||
: null,
|
||||
onDragEnd: widget.onDragEnd != null
|
||||
? (details) => widget.onDragEnd!(context, details, value)
|
||||
: null,
|
||||
onDragUpdate: widget.onDragUpdate != null
|
||||
? (details) => widget.onDragUpdate!(context, details, value)
|
||||
: null,
|
||||
? (details) => widget.onDragUpdate!(context, details, value)
|
||||
: null,
|
||||
hitDetector: this,
|
||||
onTapUp: widget.onTapUp != null
|
||||
? (details) => widget.onTapUp!(context, details, value)
|
||||
|
||||
@@ -7,7 +7,7 @@ import 'photo_view_hit_corners.dart';
|
||||
/// for the gist
|
||||
class PhotoViewGestureDetector extends StatelessWidget {
|
||||
const PhotoViewGestureDetector({
|
||||
Key? key,
|
||||
super.key,
|
||||
this.hitDetector,
|
||||
this.onScaleStart,
|
||||
this.onScaleUpdate,
|
||||
@@ -20,7 +20,7 @@ class PhotoViewGestureDetector extends StatelessWidget {
|
||||
this.onTapUp,
|
||||
this.onTapDown,
|
||||
this.behavior,
|
||||
}) : super(key: key);
|
||||
});
|
||||
|
||||
final GestureDoubleTapCallback? onDoubleTap;
|
||||
final HitCornersDetector? hitDetector;
|
||||
@@ -63,14 +63,14 @@ class PhotoViewGestureDetector extends StatelessWidget {
|
||||
}
|
||||
|
||||
if (onDragStart != null || onDragEnd != null || onDragUpdate != null) {
|
||||
gestures[VerticalDragGestureRecognizer] =
|
||||
gestures[VerticalDragGestureRecognizer] =
|
||||
GestureRecognizerFactoryWithHandlers<VerticalDragGestureRecognizer>(
|
||||
() => VerticalDragGestureRecognizer(debugOwner: this),
|
||||
(VerticalDragGestureRecognizer instance) {
|
||||
instance
|
||||
..onStart = onDragStart
|
||||
..onUpdate = onDragUpdate
|
||||
..onEnd = onDragEnd;
|
||||
..onStart = onDragStart
|
||||
..onUpdate = onDragUpdate
|
||||
..onEnd = onDragEnd;
|
||||
},
|
||||
);
|
||||
}
|
||||
@@ -86,11 +86,11 @@ class PhotoViewGestureDetector extends StatelessWidget {
|
||||
gestures[PhotoViewGestureRecognizer] =
|
||||
GestureRecognizerFactoryWithHandlers<PhotoViewGestureRecognizer>(
|
||||
() => PhotoViewGestureRecognizer(
|
||||
hitDetector: hitDetector,
|
||||
debugOwner: this,
|
||||
validateAxis: axis,
|
||||
touchSlopFactor: touchSlopFactor,
|
||||
),
|
||||
hitDetector: hitDetector,
|
||||
debugOwner: this,
|
||||
validateAxis: axis,
|
||||
touchSlopFactor: touchSlopFactor,
|
||||
),
|
||||
(PhotoViewGestureRecognizer instance) {
|
||||
instance
|
||||
..onStart = onScaleStart
|
||||
@@ -110,11 +110,11 @@ class PhotoViewGestureDetector extends StatelessWidget {
|
||||
class PhotoViewGestureRecognizer extends ScaleGestureRecognizer {
|
||||
PhotoViewGestureRecognizer({
|
||||
this.hitDetector,
|
||||
Object? debugOwner,
|
||||
super.debugOwner,
|
||||
this.validateAxis,
|
||||
this.touchSlopFactor = 1,
|
||||
PointerDeviceKind? kind,
|
||||
}) : super(debugOwner: debugOwner, supportedDevices: null);
|
||||
}) : super(supportedDevices: null);
|
||||
final HitCornersDetector? hitDetector;
|
||||
final Axis? validateAxis;
|
||||
final double touchSlopFactor;
|
||||
@@ -236,11 +236,11 @@ class PhotoViewGestureRecognizer extends ScaleGestureRecognizer {
|
||||
/// ```
|
||||
class PhotoViewGestureDetectorScope extends InheritedWidget {
|
||||
const PhotoViewGestureDetectorScope({
|
||||
super.key,
|
||||
super.key,
|
||||
this.axis,
|
||||
this.touchSlopFactor = .2,
|
||||
required Widget child,
|
||||
}) : super(child: child);
|
||||
required super.child,
|
||||
});
|
||||
|
||||
static PhotoViewGestureDetectorScope? of(BuildContext context) {
|
||||
final PhotoViewGestureDetectorScope? scope = context
|
||||
@@ -254,11 +254,12 @@ class PhotoViewGestureDetectorScope extends InheritedWidget {
|
||||
// 0: most reactive but will not let tap recognizers accept gestures
|
||||
// <1: less reactive but gives the most leeway to other recognizers
|
||||
// 1: will not be able to compete with a `HorizontalDragGestureRecognizer` up the widget tree
|
||||
final double touchSlopFactor;
|
||||
final double touchSlopFactor;
|
||||
|
||||
@override
|
||||
bool updateShouldNotify(PhotoViewGestureDetectorScope oldWidget) {
|
||||
return axis != oldWidget.axis && touchSlopFactor != oldWidget.touchSlopFactor;
|
||||
return axis != oldWidget.axis &&
|
||||
touchSlopFactor != oldWidget.touchSlopFactor;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -269,16 +270,14 @@ class PhotoViewGestureDetectorScope extends InheritedWidget {
|
||||
class PhotoViewPageViewScrollPhysics extends ScrollPhysics {
|
||||
const PhotoViewPageViewScrollPhysics({
|
||||
this.touchSlopFactor = 0.1,
|
||||
ScrollPhysics? parent,
|
||||
}) : super(parent: parent);
|
||||
|
||||
super.parent,
|
||||
});
|
||||
|
||||
// in [0, 1]
|
||||
// 0: most reactive but will not let PhotoView recognizers accept gestures
|
||||
// 1: less reactive but gives the most leeway to PhotoView recognizers
|
||||
final double touchSlopFactor;
|
||||
|
||||
|
||||
@override
|
||||
PhotoViewPageViewScrollPhysics applyTo(ScrollPhysics? ancestor) {
|
||||
return PhotoViewPageViewScrollPhysics(
|
||||
@@ -287,7 +286,6 @@ class PhotoViewPageViewScrollPhysics extends ScrollPhysics {
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@override
|
||||
double get dragStartDistanceMotionThreshold => kTouchSlop * touchSlopFactor;
|
||||
}
|
||||
|
||||
@@ -26,7 +26,11 @@ mixin HitCornersDetector on PhotoViewControllerDelegate {
|
||||
return HitCorners(y <= cornersY.min, y >= cornersY.max);
|
||||
}
|
||||
|
||||
bool _shouldMoveAxis(HitCorners hitCorners, double mainAxisMove, double crossAxisMove) {
|
||||
bool _shouldMoveAxis(
|
||||
HitCorners hitCorners,
|
||||
double mainAxisMove,
|
||||
double crossAxisMove,
|
||||
) {
|
||||
if (mainAxisMove == 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class PhotoViewDefaultError extends StatelessWidget {
|
||||
const PhotoViewDefaultError({Key? key, required this.decoration})
|
||||
: super(key: key);
|
||||
const PhotoViewDefaultError({super.key, required this.decoration});
|
||||
|
||||
final BoxDecoration decoration;
|
||||
|
||||
@@ -22,7 +21,7 @@ class PhotoViewDefaultError extends StatelessWidget {
|
||||
}
|
||||
|
||||
class PhotoViewDefaultLoading extends StatelessWidget {
|
||||
const PhotoViewDefaultLoading({Key? key, this.event}) : super(key: key);
|
||||
const PhotoViewDefaultLoading({super.key, this.event});
|
||||
|
||||
final ImageChunkEvent? event;
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ import 'utils/photo_view_utils.dart';
|
||||
|
||||
class ImageWrapper extends StatefulWidget {
|
||||
const ImageWrapper({
|
||||
Key? key,
|
||||
super.key,
|
||||
required this.imageProvider,
|
||||
required this.loadingBuilder,
|
||||
required this.backgroundDecoration,
|
||||
@@ -36,7 +36,7 @@ class ImageWrapper extends StatefulWidget {
|
||||
required this.errorBuilder,
|
||||
required this.enablePanAlways,
|
||||
required this.index,
|
||||
}) : super(key: key);
|
||||
});
|
||||
|
||||
final ImageProvider imageProvider;
|
||||
final LoadingBuilder? loadingBuilder;
|
||||
@@ -237,7 +237,7 @@ class _ImageWrapperState extends State<ImageWrapper> {
|
||||
|
||||
class CustomChildWrapper extends StatelessWidget {
|
||||
const CustomChildWrapper({
|
||||
Key? key,
|
||||
super.key,
|
||||
this.child,
|
||||
required this.childSize,
|
||||
required this.backgroundDecoration,
|
||||
@@ -263,7 +263,7 @@ class CustomChildWrapper extends StatelessWidget {
|
||||
required this.filterQuality,
|
||||
required this.disableGestures,
|
||||
required this.enablePanAlways,
|
||||
}) : super(key: key);
|
||||
});
|
||||
|
||||
final Widget? child;
|
||||
final Size? childSize;
|
||||
|
||||
@@ -17,7 +17,7 @@ double getScaleForScaleState(
|
||||
case PhotoViewScaleState.covering:
|
||||
return _clampSize(
|
||||
_scaleForCovering(
|
||||
scaleBoundaries.outerSize,
|
||||
scaleBoundaries.outerSize,
|
||||
scaleBoundaries.childSize,
|
||||
),
|
||||
scaleBoundaries,
|
||||
|
||||
Reference in New Issue
Block a user