Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

Updated: Vertical drag gets disabled, based on a particular zooming value which is calculated by a percentage

Muhammed Ayimenfb599a85b8c8
diff --git a/android/app/src/main/res/home_widget.xml b/android/app/src/main/res/home_widget.xml
new file mode 100644
index 0000000000..12365eaa67
--- /dev/null
+++ b/android/app/src/main/res/home_widget.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<appwidget-provider xmlns:android="http://schemas.android.com/apk/res/android"
+ android:minWidth="40dp"
+ android:minHeight="40dp"
+ android:updatePeriodMillis="86400000"
+ android:initialLayout="@layout/home_screen_widget"
+ android:resizeMode="horizontal|vertical"
+ android:widgetCategory="home_screen">
+</appwidget-provider>
\ No newline at end of file
diff --git a/lib/ui/viewer/file/zoomable_image.dart b/lib/ui/viewer/file/zoomable_image.dart
index 69f3fc132e..aad2bec505 100644
--- a/lib/ui/viewer/file/zoomable_image.dart
+++ b/lib/ui/viewer/file/zoomable_image.dart
@@ -55,6 +55,8 @@ class _ZoomableImageState extends State<ZoomableImage>
bool _loadingFinalImage = false;
bool _loadedFinalImage = false;
PhotoViewController _photoViewController = PhotoViewController();
+ double? initialScale;
+ double percentage = 42.5 / 100;
@override
void initState() {
@@ -102,13 +104,17 @@ class _ZoomableImageState extends State<ZoomableImage>
}
verticalDragCallback(d) => {
- if (d.delta.dy > dragSensitivity)
+ if (_photoViewController.scale! <=
+ (initialScale! + (initialScale! * (percentage))))
{
- {Navigator.of(context).pop()},
- }
- else if (d.delta.dy < (dragSensitivity * -1))
- {
- showDetailsSheet(context, widget.photo),
+ if (d.delta.dy > dragSensitivity)
+ {
+ {Navigator.of(context).pop()},
+ }
+ else if (d.delta.dy < (dragSensitivity * -1))
+ {
+ showDetailsSheet(context, widget.photo),
+ },
},
};
return GestureDetector(
@@ -275,6 +281,9 @@ class _ZoomableImageState extends State<ZoomableImage>
initialPosition: newPosition,
initialScale: scale,
);
+ setState(() {
+ initialScale = scale;
+ });
}
final bool canUpdateMetadata = _photo.canEditMetaInfo;
// forcefully get finalImageInfo is dimensions are not available in metadata