From e82cc825569623dad933136826717a37b7b1c25e Mon Sep 17 00:00:00 2001 From: Hillel Coren Date: Thu, 6 Jul 2023 11:30:21 +0300 Subject: [PATCH] Add pinch to zoom --- lib/ui/app/document_grid.dart | 25 ++++++++++++------------- pubspec.foss.yaml | 1 + pubspec.lock | 8 ++++++++ pubspec.yaml | 1 + 4 files changed, 22 insertions(+), 13 deletions(-) diff --git a/lib/ui/app/document_grid.dart b/lib/ui/app/document_grid.dart index 1eed5d911..c15e7e222 100644 --- a/lib/ui/app/document_grid.dart +++ b/lib/ui/app/document_grid.dart @@ -23,8 +23,8 @@ import 'package:invoiceninja_flutter/utils/completers.dart'; import 'package:material_design_icons_flutter/material_design_icons_flutter.dart'; import 'package:path_provider/path_provider.dart'; import 'package:permission_handler/permission_handler.dart'; +import 'package:pinch_zoom/pinch_zoom.dart'; import 'package:share_plus/share_plus.dart'; -import 'package:url_launcher/url_launcher.dart'; // Project imports: import 'package:invoiceninja_flutter/data/models/models.dart'; @@ -312,18 +312,17 @@ class DocumentTile extends StatelessWidget { context: navigatorKey.currentContext, builder: (context) { return AlertDialog( - actions: [ - TextButton( - onPressed: () => - Navigator.of(context).pop(), - child: Text(localization.close - .toUpperCase())), - ], - content: Image.memory( - response.bodyBytes, - fit: BoxFit.cover, - ), - ); + actions: [ + TextButton( + onPressed: () => + Navigator.of(context).pop(), + child: Text(localization.close + .toUpperCase())), + ], + content: PinchZoom( + child: Image.memory( + response.bodyBytes), + )); }); } else if (value == localization.download) { final http.Response response = await WebClient() diff --git a/pubspec.foss.yaml b/pubspec.foss.yaml index c12345184..146643f3e 100644 --- a/pubspec.foss.yaml +++ b/pubspec.foss.yaml @@ -80,6 +80,7 @@ dependencies: flutter_staggered_grid_view: ^0.6.2 desktop_drop: ^0.4.1 widget_kit_plugin: ^0.1.1 + pinch_zoom: ^1.0.0 # quick_actions: ^0.2.1 # idb_shim: ^1.11.1+1 diff --git a/pubspec.lock b/pubspec.lock index 1a56b8ff2..1843bf6b2 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -1072,6 +1072,14 @@ packages: url: "https://github.com/bluefireteam/photo_view" source: git version: "0.14.0" + pinch_zoom: + dependency: "direct main" + description: + name: pinch_zoom + sha256: ad12872281742726afaf03438d99a4572c584a612630768953beb6dfd6f9389a + url: "https://pub.dev" + source: hosted + version: "1.0.0" pinput: dependency: "direct main" description: diff --git a/pubspec.yaml b/pubspec.yaml index 09e01da1b..696898c20 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -86,6 +86,7 @@ dependencies: flutter_staggered_grid_view: ^0.6.2 desktop_drop: ^0.4.1 widget_kit_plugin: ^0.1.1 + pinch_zoom: ^1.0.0 # quick_actions: ^0.2.1 # idb_shim: ^1.11.1+1