From 8fad35ed336e5878f80613515b50143e8cefbc16 Mon Sep 17 00:00:00 2001 From: Hank Grabowski Date: Sun, 29 Jan 2023 18:09:58 -0500 Subject: [PATCH] Add back/forward arrows --- ios/Podfile.lock | 13 +- ios/Runner.xcodeproj/project.pbxproj | 4 +- lib/screens/image_viewer_screen.dart | 80 ++- macos/Podfile | 2 +- macos/Podfile.lock | 17 +- macos/Runner.xcodeproj/project.pbxproj | 11 +- .../xcshareddata/xcschemes/Runner.xcscheme | 2 +- pubspec.lock | 557 +++++++++++------- 8 files changed, 443 insertions(+), 243 deletions(-) diff --git a/ios/Podfile.lock b/ios/Podfile.lock index f7df94d..4f3fa86 100644 --- a/ios/Podfile.lock +++ b/ios/Podfile.lock @@ -47,8 +47,9 @@ PODS: - objectbox_flutter_libs (0.0.1): - Flutter - ObjectBox (= 1.8.1-rc) - - path_provider_ios (0.0.1): + - path_provider_foundation (0.0.1): - Flutter + - FlutterMacOS - SDWebImage (5.13.2): - SDWebImage/Core (= 5.13.2) - SDWebImage/Core (5.13.2) @@ -71,7 +72,7 @@ DEPENDENCIES: - flutter_secure_storage (from `.symlinks/plugins/flutter_secure_storage/ios`) - image_picker_ios (from `.symlinks/plugins/image_picker_ios/ios`) - objectbox_flutter_libs (from `.symlinks/plugins/objectbox_flutter_libs/ios`) - - path_provider_ios (from `.symlinks/plugins/path_provider_ios/ios`) + - path_provider_foundation (from `.symlinks/plugins/path_provider_foundation/ios`) - shared_preferences_foundation (from `.symlinks/plugins/shared_preferences_foundation/ios`) - sqflite (from `.symlinks/plugins/sqflite/ios`) - url_launcher_ios (from `.symlinks/plugins/url_launcher_ios/ios`) @@ -99,8 +100,8 @@ EXTERNAL SOURCES: :path: ".symlinks/plugins/image_picker_ios/ios" objectbox_flutter_libs: :path: ".symlinks/plugins/objectbox_flutter_libs/ios" - path_provider_ios: - :path: ".symlinks/plugins/path_provider_ios/ios" + path_provider_foundation: + :path: ".symlinks/plugins/path_provider_foundation/ios" shared_preferences_foundation: :path: ".symlinks/plugins/shared_preferences_foundation/ios" sqflite: @@ -121,12 +122,12 @@ SPEC CHECKSUMS: image_picker_ios: b786a5dcf033a8336a657191401bfdf12017dabb ObjectBox: 7615cc462f2976cb45127d301a17cb473edf3f9e objectbox_flutter_libs: 55835e03ff76bf9d5ce0a41a2ef3902d2e8c1f20 - path_provider_ios: 14f3d2fd28c4fdb42f44e0f751d12861c43cee02 + path_provider_foundation: 37748e03f12783f9de2cb2c4eadfaa25fe6d4852 SDWebImage: 72f86271a6f3139cc7e4a89220946489d4b9a866 shared_preferences_foundation: 297b3ebca31b34ec92be11acd7fb0ba932c822ca sqflite: 6d358c025f5b867b29ed92fc697fd34924e11904 SwiftyGif: 6c3eafd0ce693cad58bb63d2b2fb9bacb8552780 - url_launcher_ios: 839c58cdb4279282219f5e248c3321761ff3c4de + url_launcher_ios: ae1517e5e344f5544fb090b079e11f399dfbe4d2 video_player_avfoundation: e489aac24ef5cf7af82702979ed16f2a5ef84cff PODFILE CHECKSUM: ef19549a9bc3046e7bb7d2fab4d021637c0c58a3 diff --git a/ios/Runner.xcodeproj/project.pbxproj b/ios/Runner.xcodeproj/project.pbxproj index bbce423..5c601c4 100644 --- a/ios/Runner.xcodeproj/project.pbxproj +++ b/ios/Runner.xcodeproj/project.pbxproj @@ -3,7 +3,7 @@ archiveVersion = 1; classes = { }; - objectVersion = 51; + objectVersion = 54; objects = { /* Begin PBXBuildFile section */ @@ -199,6 +199,7 @@ /* Begin PBXShellScriptBuildPhase section */ 3B06AD1E1E4923F5004D2608 /* Thin Binary */ = { isa = PBXShellScriptBuildPhase; + alwaysOutOfDate = 1; buildActionMask = 2147483647; files = ( ); @@ -235,6 +236,7 @@ }; 9740EEB61CF901F6004384FC /* Run Script */ = { isa = PBXShellScriptBuildPhase; + alwaysOutOfDate = 1; buildActionMask = 2147483647; files = ( ); diff --git a/lib/screens/image_viewer_screen.dart b/lib/screens/image_viewer_screen.dart index a217e33..2cfd277 100644 --- a/lib/screens/image_viewer_screen.dart +++ b/lib/screens/image_viewer_screen.dart @@ -73,6 +73,7 @@ class _ImageViewerScreenState extends State { Widget build(BuildContext context) { print('Index: $index'); final attachment = widget.attachments[index]; + final height = MediaQuery.of(context).size.height; return Scaffold( appBar: AppBar( actions: [ @@ -82,23 +83,54 @@ class _ImageViewerScreenState extends State { ], ), body: SafeArea( - child: Listener( - onPointerMove: (details) { - final velocity = details.delta.dx ?? 0.0; - print('Velocity: $velocity'); - if (velocity > 0 && index > 0) { - setState(() { - index--; - }); - } + child: Stack( + children: [ + GestureDetector( + onHorizontalDragEnd: (details) { + final velocity = details.primaryVelocity ?? 0.0; + print('Velocity: $velocity'); + if (velocity > 0 && index > 0) { + setState(() { + index--; + }); + } - if (velocity < 0 && index < widget.attachments.length - 1) { - setState(() { - index++; - }); - } - }, - child: buildCoreViewer(attachment)), + if (velocity < 0 && index < widget.attachments.length - 1) { + setState(() { + index++; + }); + } + }, + child: buildCoreViewer(attachment), + ), + if (index > 0) + Positioned( + top: height / 2, + left: 0.0, + child: buildButton( + Icon(Icons.keyboard_arrow_left), + onPressed: () { + setState(() { + index--; + }); + }, + ), + ), + if (index < widget.attachments.length - 1) + Positioned( + top: height / 2, + right: 0.0, + child: buildButton( + Icon(Icons.keyboard_arrow_right), + onPressed: () { + setState(() { + index++; + }); + }, + ), + ), + ], + ), ), ); } @@ -130,4 +162,20 @@ class _ImageViewerScreenState extends State { ], ); } + + Widget buildButton(Icon icon, {required Function() onPressed}) { + return Center( + child: Ink( + decoration: ShapeDecoration( + color: Theme.of(context).focusColor, + shape: CircleBorder(), + ), + child: IconButton( + icon: icon, + color: Colors.white, + onPressed: onPressed, + ), + ), + ); + } } diff --git a/macos/Podfile b/macos/Podfile index fe73390..049abe2 100644 --- a/macos/Podfile +++ b/macos/Podfile @@ -1,4 +1,4 @@ -platform :osx, '10.13' +platform :osx, '10.14' # CocoaPods analytics sends network stats synchronously affecting flutter build latency. ENV['COCOAPODS_DISABLE_STATS'] = 'true' diff --git a/macos/Podfile.lock b/macos/Podfile.lock index fb1b443..1ffa59b 100644 --- a/macos/Podfile.lock +++ b/macos/Podfile.lock @@ -11,7 +11,8 @@ PODS: - objectbox_flutter_libs (0.0.1): - FlutterMacOS - ObjectBox (= 1.8.1-rc) - - path_provider_macos (0.0.1): + - path_provider_foundation (0.0.1): + - Flutter - FlutterMacOS - shared_preferences_foundation (0.0.1): - Flutter @@ -27,7 +28,7 @@ DEPENDENCIES: - flutter_secure_storage_macos (from `Flutter/ephemeral/.symlinks/plugins/flutter_secure_storage_macos/macos`) - FlutterMacOS (from `Flutter/ephemeral`) - objectbox_flutter_libs (from `Flutter/ephemeral/.symlinks/plugins/objectbox_flutter_libs/macos`) - - path_provider_macos (from `Flutter/ephemeral/.symlinks/plugins/path_provider_macos/macos`) + - path_provider_foundation (from `Flutter/ephemeral/.symlinks/plugins/path_provider_foundation/macos`) - shared_preferences_foundation (from `Flutter/ephemeral/.symlinks/plugins/shared_preferences_foundation/macos`) - sqflite (from `Flutter/ephemeral/.symlinks/plugins/sqflite/macos`) - url_launcher_macos (from `Flutter/ephemeral/.symlinks/plugins/url_launcher_macos/macos`) @@ -46,8 +47,8 @@ EXTERNAL SOURCES: :path: Flutter/ephemeral objectbox_flutter_libs: :path: Flutter/ephemeral/.symlinks/plugins/objectbox_flutter_libs/macos - path_provider_macos: - :path: Flutter/ephemeral/.symlinks/plugins/path_provider_macos/macos + path_provider_foundation: + :path: Flutter/ephemeral/.symlinks/plugins/path_provider_foundation/macos shared_preferences_foundation: :path: Flutter/ephemeral/.symlinks/plugins/shared_preferences_foundation/macos sqflite: @@ -58,15 +59,15 @@ EXTERNAL SOURCES: SPEC CHECKSUMS: desktop_window: fb7c4f12c1129f947ac482296b6f14059d57a3c3 flutter_secure_storage_macos: 75c8cadfdba05ca007c0fa4ea0c16e5cf85e521b - FlutterMacOS: ae6af50a8ea7d6103d888583d46bd8328a7e9811 + FlutterMacOS: 8f6f14fa908a6fb3fba0cd85dbd81ec4b251fb24 FMDB: 2ce00b547f966261cd18927a3ddb07cb6f3db82a ObjectBox: 7615cc462f2976cb45127d301a17cb473edf3f9e objectbox_flutter_libs: 6c6e858d1df4a7cd5cb664c2108e6fa0b412be38 - path_provider_macos: 05fb0ef0cedf3e5bd179b9e41a638682b37133ea + path_provider_foundation: 37748e03f12783f9de2cb2c4eadfaa25fe6d4852 shared_preferences_foundation: 297b3ebca31b34ec92be11acd7fb0ba932c822ca sqflite: a5789cceda41d54d23f31d6de539d65bb14100ea - url_launcher_macos: 597e05b8e514239626bcf4a850fcf9ef5c856ec3 + url_launcher_macos: c04e4fa86382d4f94f6b38f14625708be3ae52e2 -PODFILE CHECKSUM: a884f6dd3f7494f3892ee6c81feea3a3abbf9153 +PODFILE CHECKSUM: 353c8bcc5d5b0994e508d035b5431cfe18c1dea7 COCOAPODS: 1.11.3 diff --git a/macos/Runner.xcodeproj/project.pbxproj b/macos/Runner.xcodeproj/project.pbxproj index bb7dafa..5bcf042 100644 --- a/macos/Runner.xcodeproj/project.pbxproj +++ b/macos/Runner.xcodeproj/project.pbxproj @@ -3,7 +3,7 @@ archiveVersion = 1; classes = { }; - objectVersion = 51; + objectVersion = 54; objects = { /* Begin PBXAggregateTarget section */ @@ -204,7 +204,7 @@ isa = PBXProject; attributes = { LastSwiftUpdateCheck = 0920; - LastUpgradeCheck = 1420; + LastUpgradeCheck = 1300; ORGANIZATIONNAME = ""; TargetAttributes = { 33CC10EC2044A3C60003C045 = { @@ -257,6 +257,7 @@ /* Begin PBXShellScriptBuildPhase section */ 3399D490228B24CF009A79C7 /* ShellScript */ = { isa = PBXShellScriptBuildPhase; + alwaysOutOfDate = 1; buildActionMask = 2147483647; files = ( ); @@ -406,7 +407,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - MACOSX_DEPLOYMENT_TARGET = 10.13; + MACOSX_DEPLOYMENT_TARGET = 10.14; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = macosx; SWIFT_COMPILATION_MODE = wholemodule; @@ -496,7 +497,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - MACOSX_DEPLOYMENT_TARGET = 10.13; + MACOSX_DEPLOYMENT_TARGET = 10.14; MTL_ENABLE_DEBUG_INFO = YES; ONLY_ACTIVE_ARCH = YES; SDKROOT = macosx; @@ -544,7 +545,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - MACOSX_DEPLOYMENT_TARGET = 10.13; + MACOSX_DEPLOYMENT_TARGET = 10.14; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = macosx; SWIFT_COMPILATION_MODE = wholemodule; diff --git a/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme b/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme index d2b6904..33da272 100644 --- a/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme +++ b/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme @@ -1,6 +1,6 @@ =2.18.2 <3.0.0" + dart: ">=2.18.2 <4.0.0" flutter: ">=3.3.0"