Skip to content

Commit

Permalink
feat: limit zooming out
Browse files Browse the repository at this point in the history
  • Loading branch information
matthiasn committed Jun 4, 2024
1 parent f106e6e commit 94029b8
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 13 deletions.
18 changes: 6 additions & 12 deletions lib/widgets/journal/entry_image_widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,7 @@ class EntryImageWidget extends ConsumerWidget {
Widget build(BuildContext context, WidgetRef ref) {
final provider = entryControllerProvider(id: journalImage.meta.id);
final notifier = ref.read(provider.notifier);

final file = File(getFullImagePath(journalImage));

final focusNode = notifier.focusNode;

return GestureDetector(
Expand All @@ -30,7 +28,7 @@ class EntryImageWidget extends ConsumerWidget {
MaterialPageRoute<HeroPhotoViewRouteWrapper>(
builder: (_) => HeroPhotoViewRouteWrapper(
focusNode: focusNode,
imageProvider: FileImage(file),
file: file,
),
),
);
Expand All @@ -45,7 +43,6 @@ class EntryImageWidget extends ConsumerWidget {
),
child: Image.file(
file,
width: MediaQuery.of(context).size.width,
fit: BoxFit.contain,
),
),
Expand All @@ -59,21 +56,19 @@ class EntryImageWidget extends ConsumerWidget {
class HeroPhotoViewRouteWrapper extends StatelessWidget {
const HeroPhotoViewRouteWrapper({
required this.focusNode,
required this.imageProvider,
required this.file,
super.key,
this.backgroundDecoration,
this.minScale,
this.maxScale,
});

final ImageProvider imageProvider;
final File file;
final BoxDecoration? backgroundDecoration;
final FocusNode focusNode;
final dynamic minScale;
final dynamic maxScale;

@override
Widget build(BuildContext context) {
final imageProvider = FileImage(file);

return Scaffold(
body: Stack(
children: [
Expand All @@ -84,9 +79,8 @@ class HeroPhotoViewRouteWrapper extends StatelessWidget {
child: PhotoView(
imageProvider: imageProvider,
backgroundDecoration: backgroundDecoration,
minScale: minScale,
maxScale: maxScale,
heroAttributes: const PhotoViewHeroAttributes(tag: 'entry_img'),
minScale: PhotoViewComputedScale.contained,
),
),
Positioned(
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: lotti
description: Achieve your goals and keep your data private with Lotti.
publish_to: 'none'
version: 0.9.474+2549
version: 0.9.475+2550

msix_config:
display_name: LottiApp
Expand Down

0 comments on commit 94029b8

Please sign in to comment.