mirror of
https://github.com/KevinMidboe/immich.git
synced 2025-10-29 17:40:28 +00:00
Enable swiping between assets (#381)
Enable swiping between assets (#381) Co-authored-by: Alex <alex.tran1502@gmail.com> Co-authored-by: Malte Kiefer <59220985+MalteKiefer@users.noreply.github.com> Co-authored-by: Matthias Rupp <matthias.rupp@posteo.de>
This commit is contained in:
committed by
GitHub
parent
e8d1f89a47
commit
8c184dc4d4
@@ -15,7 +15,6 @@ class _RemotePhotoViewState extends State<RemotePhotoView> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
bool allowMoving = _status == _RemoteImageStatus.full;
|
||||
|
||||
return PhotoView(
|
||||
imageProvider: _imageProvider,
|
||||
minScale: PhotoViewComputedScale.contained,
|
||||
@@ -32,8 +31,9 @@ class _RemotePhotoViewState extends State<RemotePhotoView> {
|
||||
PhotoViewControllerValue controllerValue,
|
||||
) {
|
||||
// Disable swipe events when zoomed in
|
||||
if (_zoomedIn) return;
|
||||
|
||||
if (_zoomedIn) {
|
||||
return;
|
||||
}
|
||||
if (controllerValue.position.dy > swipeThreshold) {
|
||||
widget.onSwipeDown();
|
||||
} else if (controllerValue.position.dy < -swipeThreshold) {
|
||||
@@ -42,7 +42,14 @@ class _RemotePhotoViewState extends State<RemotePhotoView> {
|
||||
}
|
||||
|
||||
void _scaleStateChanged(PhotoViewScaleState state) {
|
||||
_zoomedIn = state == PhotoViewScaleState.zoomedIn;
|
||||
// _onScaleListener;
|
||||
_zoomedIn = state != PhotoViewScaleState.initial;
|
||||
if (_zoomedIn) {
|
||||
widget.isZoomedListener.value = true;
|
||||
} else {
|
||||
widget.isZoomedListener.value = false;
|
||||
}
|
||||
widget.isZoomedFunction();
|
||||
}
|
||||
|
||||
CachedNetworkImageProvider _authorizedImageProvider(String url) {
|
||||
@@ -107,6 +114,8 @@ class RemotePhotoView extends StatefulWidget {
|
||||
required this.thumbnailUrl,
|
||||
required this.imageUrl,
|
||||
required this.authToken,
|
||||
required this.isZoomedFunction,
|
||||
required this.isZoomedListener,
|
||||
required this.onSwipeDown,
|
||||
required this.onSwipeUp,
|
||||
}) : super(key: key);
|
||||
@@ -117,6 +126,9 @@ class RemotePhotoView extends StatefulWidget {
|
||||
|
||||
final void Function() onSwipeDown;
|
||||
final void Function() onSwipeUp;
|
||||
final void Function() isZoomedFunction;
|
||||
|
||||
final ValueNotifier<bool> isZoomedListener;
|
||||
|
||||
@override
|
||||
State<StatefulWidget> createState() {
|
||||
|
||||
Reference in New Issue
Block a user