diff --git a/example/ios/Flutter/AppFrameworkInfo.plist b/example/ios/Flutter/AppFrameworkInfo.plist index 8d4492f..7c56964 100644 --- a/example/ios/Flutter/AppFrameworkInfo.plist +++ b/example/ios/Flutter/AppFrameworkInfo.plist @@ -21,6 +21,6 @@ CFBundleVersion 1.0 MinimumOSVersion - 9.0 + 12.0 diff --git a/example/ios/Flutter/Debug.xcconfig b/example/ios/Flutter/Debug.xcconfig index 592ceee..ec97fc6 100644 --- a/example/ios/Flutter/Debug.xcconfig +++ b/example/ios/Flutter/Debug.xcconfig @@ -1 +1,2 @@ +#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig" #include "Generated.xcconfig" diff --git a/example/ios/Flutter/Release.xcconfig b/example/ios/Flutter/Release.xcconfig index 592ceee..c4855bf 100644 --- a/example/ios/Flutter/Release.xcconfig +++ b/example/ios/Flutter/Release.xcconfig @@ -1 +1,2 @@ +#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig" #include "Generated.xcconfig" diff --git a/example/ios/Podfile b/example/ios/Podfile new file mode 100644 index 0000000..66edf4f --- /dev/null +++ b/example/ios/Podfile @@ -0,0 +1,44 @@ +# Uncomment this line to define a global platform for your project +# platform :ios, '12.0' + +# CocoaPods analytics sends network stats synchronously affecting flutter build latency. +ENV['COCOAPODS_DISABLE_STATS'] = 'true' + +project 'Runner', { + 'Debug' => :debug, + 'Profile' => :release, + 'Release' => :release, +} + +def flutter_root + generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__) + unless File.exist?(generated_xcode_build_settings_path) + raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first" + end + + File.foreach(generated_xcode_build_settings_path) do |line| + matches = line.match(/FLUTTER_ROOT\=(.*)/) + return matches[1].strip if matches + end + raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get" +end + +require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root) + +flutter_ios_podfile_setup + +target 'Runner' do + use_frameworks! + use_modular_headers! + + flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__)) + #target 'RunnerTests' do + # inherit! :search_paths + #end +end + +post_install do |installer| + installer.pods_project.targets.each do |target| + flutter_additional_ios_build_settings(target) + end +end diff --git a/example/ios/Podfile.lock b/example/ios/Podfile.lock new file mode 100644 index 0000000..7ad571c --- /dev/null +++ b/example/ios/Podfile.lock @@ -0,0 +1,75 @@ +PODS: + - DKImagePickerController/Core (4.3.9): + - DKImagePickerController/ImageDataManager + - DKImagePickerController/Resource + - DKImagePickerController/ImageDataManager (4.3.9) + - DKImagePickerController/PhotoGallery (4.3.9): + - DKImagePickerController/Core + - DKPhotoGallery + - DKImagePickerController/Resource (4.3.9) + - DKPhotoGallery (0.0.19): + - DKPhotoGallery/Core (= 0.0.19) + - DKPhotoGallery/Model (= 0.0.19) + - DKPhotoGallery/Preview (= 0.0.19) + - DKPhotoGallery/Resource (= 0.0.19) + - SDWebImage + - SwiftyGif + - DKPhotoGallery/Core (0.0.19): + - DKPhotoGallery/Model + - DKPhotoGallery/Preview + - SDWebImage + - SwiftyGif + - DKPhotoGallery/Model (0.0.19): + - SDWebImage + - SwiftyGif + - DKPhotoGallery/Preview (0.0.19): + - DKPhotoGallery/Model + - DKPhotoGallery/Resource + - SDWebImage + - SwiftyGif + - DKPhotoGallery/Resource (0.0.19): + - SDWebImage + - SwiftyGif + - file_picker (0.0.1): + - DKImagePickerController/PhotoGallery + - Flutter + - Flutter (1.0.0) + - image_picker_ios (0.0.1): + - Flutter + - SDWebImage (5.19.6): + - SDWebImage/Core (= 5.19.6) + - SDWebImage/Core (5.19.6) + - SwiftyGif (5.4.5) + +DEPENDENCIES: + - file_picker (from `.symlinks/plugins/file_picker/ios`) + - Flutter (from `Flutter`) + - image_picker_ios (from `.symlinks/plugins/image_picker_ios/ios`) + +SPEC REPOS: + trunk: + - DKImagePickerController + - DKPhotoGallery + - SDWebImage + - SwiftyGif + +EXTERNAL SOURCES: + file_picker: + :path: ".symlinks/plugins/file_picker/ios" + Flutter: + :path: Flutter + image_picker_ios: + :path: ".symlinks/plugins/image_picker_ios/ios" + +SPEC CHECKSUMS: + DKImagePickerController: 946cec48c7873164274ecc4624d19e3da4c1ef3c + DKPhotoGallery: b3834fecb755ee09a593d7c9e389d8b5d6deed60 + file_picker: 15fd9539e4eb735dc54bae8c0534a7a9511a03de + Flutter: e0871f40cf51350855a761d2e70bf5af5b9b5de7 + image_picker_ios: c560581cceedb403a6ff17f2f816d7fea1421fc1 + SDWebImage: a79252b60f4678812d94316c91da69ec83089c9f + SwiftyGif: 706c60cf65fa2bc5ee0313beece843c8eb8194d4 + +PODFILE CHECKSUM: 60d9d7ad3a326c175d3a1d4032b5028bf5e01126 + +COCOAPODS: 1.15.2 diff --git a/example/ios/Runner.xcodeproj/project.pbxproj b/example/ios/Runner.xcodeproj/project.pbxproj index 6edd238..30b355a 100644 --- a/example/ios/Runner.xcodeproj/project.pbxproj +++ b/example/ios/Runner.xcodeproj/project.pbxproj @@ -3,7 +3,7 @@ archiveVersion = 1; classes = { }; - objectVersion = 50; + objectVersion = 54; objects = { /* Begin PBXBuildFile section */ @@ -13,6 +13,7 @@ 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; }; 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; }; 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; }; + FA00B71474D01B780AA85AF6 /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A284EB28CF63D840A32F2A02 /* Pods_Runner.framework */; }; /* End PBXBuildFile section */ /* Begin PBXCopyFilesBuildPhase section */ @@ -35,6 +36,8 @@ 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = ""; }; 74858FAE1ED2DC5600515810 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = ""; }; + 7CC067D8FAC7AD1547592EDA /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = ""; }; + 93EE1C18BB5EB875EA2099E8 /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = ""; }; 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = ""; }; 9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = ""; }; 97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; }; @@ -42,6 +45,8 @@ 97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + A284EB28CF63D840A32F2A02 /* Pods_Runner.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + FA530230B03E7C1B6C263C17 /* Pods-Runner.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -49,12 +54,32 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + FA00B71474D01B780AA85AF6 /* Pods_Runner.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ + 318351A3AFC476FB9D64953E /* Pods */ = { + isa = PBXGroup; + children = ( + 93EE1C18BB5EB875EA2099E8 /* Pods-Runner.debug.xcconfig */, + 7CC067D8FAC7AD1547592EDA /* Pods-Runner.release.xcconfig */, + FA530230B03E7C1B6C263C17 /* Pods-Runner.profile.xcconfig */, + ); + name = Pods; + path = Pods; + sourceTree = ""; + }; + 5A45F169FBA556F2AD862D48 /* Frameworks */ = { + isa = PBXGroup; + children = ( + A284EB28CF63D840A32F2A02 /* Pods_Runner.framework */, + ); + name = Frameworks; + sourceTree = ""; + }; 9740EEB11CF90186004384FC /* Flutter */ = { isa = PBXGroup; children = ( @@ -72,6 +97,8 @@ 9740EEB11CF90186004384FC /* Flutter */, 97C146F01CF9000F007C117D /* Runner */, 97C146EF1CF9000F007C117D /* Products */, + 318351A3AFC476FB9D64953E /* Pods */, + 5A45F169FBA556F2AD862D48 /* Frameworks */, ); sourceTree = ""; }; @@ -105,12 +132,14 @@ isa = PBXNativeTarget; buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */; buildPhases = ( + C259B1BDF72DFE5960D257D4 /* [CP] Check Pods Manifest.lock */, 9740EEB61CF901F6004384FC /* Run Script */, 97C146EA1CF9000F007C117D /* Sources */, 97C146EB1CF9000F007C117D /* Frameworks */, 97C146EC1CF9000F007C117D /* Resources */, 9705A1C41CF9048500538489 /* Embed Frameworks */, 3B06AD1E1E4923F5004D2608 /* Thin Binary */, + 73D1C8639BAB24F9E0B9B22C /* [CP] Embed Pods Frameworks */, ); buildRules = ( ); @@ -127,7 +156,7 @@ 97C146E61CF9000F007C117D /* Project object */ = { isa = PBXProject; attributes = { - LastUpgradeCheck = 1300; + LastUpgradeCheck = 1510; ORGANIZATIONNAME = ""; TargetAttributes = { 97C146ED1CF9000F007C117D = { @@ -171,10 +200,12 @@ /* Begin PBXShellScriptBuildPhase section */ 3B06AD1E1E4923F5004D2608 /* Thin Binary */ = { isa = PBXShellScriptBuildPhase; + alwaysOutOfDate = 1; buildActionMask = 2147483647; files = ( ); inputPaths = ( + "${TARGET_BUILD_DIR}/${INFOPLIST_PATH}", ); name = "Thin Binary"; outputPaths = ( @@ -183,8 +214,26 @@ shellPath = /bin/sh; shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" embed_and_thin"; }; + 73D1C8639BAB24F9E0B9B22C /* [CP] Embed Pods Frameworks */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-input-files.xcfilelist", + ); + name = "[CP] Embed Pods Frameworks"; + outputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-output-files.xcfilelist", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n"; + showEnvVarsInLog = 0; + }; 9740EEB61CF901F6004384FC /* Run Script */ = { isa = PBXShellScriptBuildPhase; + alwaysOutOfDate = 1; buildActionMask = 2147483647; files = ( ); @@ -197,6 +246,28 @@ shellPath = /bin/sh; shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build"; }; + C259B1BDF72DFE5960D257D4 /* [CP] Check Pods Manifest.lock */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + ); + inputPaths = ( + "${PODS_PODFILE_DIR_PATH}/Podfile.lock", + "${PODS_ROOT}/Manifest.lock", + ); + name = "[CP] Check Pods Manifest.lock"; + outputFileListPaths = ( + ); + outputPaths = ( + "$(DERIVED_FILE_DIR)/Pods-Runner-checkManifestLockResult.txt", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; + showEnvVarsInLog = 0; + }; /* End PBXShellScriptBuildPhase section */ /* Begin PBXSourcesBuildPhase section */ @@ -272,7 +343,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 9.0; + IPHONEOS_DEPLOYMENT_TARGET = 12.0; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = iphoneos; SUPPORTED_PLATFORMS = iphoneos; @@ -349,7 +420,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 9.0; + IPHONEOS_DEPLOYMENT_TARGET = 12.0; MTL_ENABLE_DEBUG_INFO = YES; ONLY_ACTIVE_ARCH = YES; SDKROOT = iphoneos; @@ -398,7 +469,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 9.0; + IPHONEOS_DEPLOYMENT_TARGET = 12.0; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = iphoneos; SUPPORTED_PLATFORMS = iphoneos; diff --git a/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme b/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme index c87d15a..5e31d3d 100644 --- a/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme +++ b/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme @@ -1,6 +1,6 @@ + + diff --git a/example/ios/Runner/AppDelegate.swift b/example/ios/Runner/AppDelegate.swift index 70693e4..b636303 100644 --- a/example/ios/Runner/AppDelegate.swift +++ b/example/ios/Runner/AppDelegate.swift @@ -1,7 +1,7 @@ import UIKit import Flutter -@UIApplicationMain +@main @objc class AppDelegate: FlutterAppDelegate { override func application( _ application: UIApplication, diff --git a/example/ios/Runner/Info.plist b/example/ios/Runner/Info.plist index 907f329..7f55346 100644 --- a/example/ios/Runner/Info.plist +++ b/example/ios/Runner/Info.plist @@ -45,5 +45,7 @@ CADisableMinimumFrameDurationOnPhone + UIApplicationSupportsIndirectInputEvents + diff --git a/example/lib/custom/default_custom_example.dart b/example/lib/custom/default_custom_example.dart index 5a19508..2b6665b 100644 --- a/example/lib/custom/default_custom_example.dart +++ b/example/lib/custom/default_custom_example.dart @@ -5,7 +5,7 @@ import 'package:multi_image_picker_view/multi_image_picker_view.dart'; import '../picker.dart'; class DefaultCustomExample extends StatefulWidget { - const DefaultCustomExample({Key? key}) : super(key: key); + const DefaultCustomExample({super.key}); @override State createState() => _DefaultCustomExampleState(); diff --git a/example/lib/custom/files_custom_example.dart b/example/lib/custom/files_custom_example.dart index 9af24f4..9e21414 100644 --- a/example/lib/custom/files_custom_example.dart +++ b/example/lib/custom/files_custom_example.dart @@ -4,7 +4,7 @@ import 'package:flutter/material.dart'; import 'package:multi_image_picker_view/multi_image_picker_view.dart'; class FilesCustomExample extends StatefulWidget { - const FilesCustomExample({Key? key}) : super(key: key); + const FilesCustomExample({super.key}); @override State createState() => _FilesCustomExampleState(); diff --git a/example/lib/custom/full_custom_example.dart b/example/lib/custom/full_custom_example.dart index cbccbc8..0584cf9 100644 --- a/example/lib/custom/full_custom_example.dart +++ b/example/lib/custom/full_custom_example.dart @@ -5,7 +5,7 @@ import 'package:multi_image_picker_view/multi_image_picker_view.dart'; import '../picker.dart'; class FullCustomExample extends StatefulWidget { - const FullCustomExample({Key? key}) : super(key: key); + const FullCustomExample({super.key}); @override State createState() => _FullCustomExampleState(); diff --git a/example/lib/custom/initial_images_custom_example.dart b/example/lib/custom/initial_images_custom_example.dart index a8f9fdb..f6220a6 100644 --- a/example/lib/custom/initial_images_custom_example.dart +++ b/example/lib/custom/initial_images_custom_example.dart @@ -5,7 +5,7 @@ import 'package:multi_image_picker_view/multi_image_picker_view.dart'; import '../picker.dart'; class InitialImagesCustomExample extends StatefulWidget { - const InitialImagesCustomExample({Key? key}) : super(key: key); + const InitialImagesCustomExample({super.key}); @override State createState() => diff --git a/example/lib/custom/selectable_custom_example.dart b/example/lib/custom/selectable_custom_example.dart index 9aed743..4950dc5 100644 --- a/example/lib/custom/selectable_custom_example.dart +++ b/example/lib/custom/selectable_custom_example.dart @@ -5,7 +5,7 @@ import 'package:multi_image_picker_view/multi_image_picker_view.dart'; import '../picker.dart'; class SelectableCustomExample extends StatefulWidget { - const SelectableCustomExample({Key? key}) : super(key: key); + const SelectableCustomExample({super.key}); @override State createState() => diff --git a/example/lib/custom_examples.dart b/example/lib/custom_examples.dart index 539f1f1..de5faf4 100644 --- a/example/lib/custom_examples.dart +++ b/example/lib/custom_examples.dart @@ -44,7 +44,7 @@ enum CustomExamples { } class CustomExamplesWidget extends StatelessWidget { - const CustomExamplesWidget({Key? key}) : super(key: key); + const CustomExamplesWidget({super.key}); @override Widget build(BuildContext context) { diff --git a/example/lib/main.dart b/example/lib/main.dart index 98b75f7..cb41b0b 100644 --- a/example/lib/main.dart +++ b/example/lib/main.dart @@ -18,16 +18,16 @@ void main() { ), elevatedButtonTheme: ElevatedButtonThemeData( style: ButtonStyle( - elevation: MaterialStateProperty.all(0), + elevation: WidgetStateProperty.all(0), backgroundColor: - MaterialStateProperty.all(Colors.purple.shade50)), + WidgetStateProperty.all(Colors.purple.shade50)), )), home: const DemoPage(), )); } class DemoPage extends StatefulWidget { - const DemoPage({Key? key}) : super(key: key); + const DemoPage({super.key}); @override State createState() => _DemoPageState(); diff --git a/example/pubspec.yaml b/example/pubspec.yaml index 863c4a6..b57927f 100644 --- a/example/pubspec.yaml +++ b/example/pubspec.yaml @@ -3,7 +3,7 @@ description: A new Flutter project. publish_to: 'none' environment: - sdk: ">=2.17.1 <4.0.0" + sdk: '>=3.4.0 <4.0.0' dependencies: flutter: @@ -12,10 +12,10 @@ dependencies: multi_image_picker_view: path: ../ - file_picker: ^6.1.1 - image_picker: ^1.0.4 + file_picker: ^8.1.2 + image_picker: ^1.1.2 - cupertino_icons: ^1.0.2 + cupertino_icons: ^1.0.8 dev_dependencies: flutter_test: diff --git a/lib/src/image_file_view/io_preview.dart b/lib/src/image_file_view/io_preview.dart index a6cc1ec..a308102 100644 --- a/lib/src/image_file_view/io_preview.dart +++ b/lib/src/image_file_view/io_preview.dart @@ -25,7 +25,7 @@ class ImageFileView extends StatelessWidget { return Container( clipBehavior: Clip.antiAlias, decoration: BoxDecoration( - color: backgroundColor ?? Theme.of(context).colorScheme.background, + color: backgroundColor ?? Theme.of(context).colorScheme.surface, borderRadius: borderRadius ?? BorderRadius.zero, ), child: Uri.tryParse(imageFile.path!)?.scheme.startsWith('http') == true diff --git a/lib/src/image_file_view/web_preview.dart b/lib/src/image_file_view/web_preview.dart index 9f54a93..853f3dd 100644 --- a/lib/src/image_file_view/web_preview.dart +++ b/lib/src/image_file_view/web_preview.dart @@ -23,7 +23,7 @@ class ImageFileView extends StatelessWidget { return Container( clipBehavior: Clip.antiAlias, decoration: BoxDecoration( - color: backgroundColor ?? Theme.of(context).colorScheme.background, + color: backgroundColor ?? Theme.of(context).colorScheme.surface, borderRadius: borderRadius ?? BorderRadius.zero, ), child: imageFile.path == null diff --git a/lib/src/multi_image_picker_controller.dart b/lib/src/multi_image_picker_controller.dart index e6f7040..e967b9e 100644 --- a/lib/src/multi_image_picker_controller.dart +++ b/lib/src/multi_image_picker_controller.dart @@ -55,6 +55,12 @@ class MultiImagePickerController with ChangeNotifier { notifyListeners(); } + void updateImages(List images) { + _images.clear(); + _images.addAll(images); + notifyListeners(); + } + /// Manually remove image from list. void removeImage(ImageFile imageFile) { _images.remove(imageFile); diff --git a/lib/src/multi_image_picker_controller_wrapper.dart b/lib/src/multi_image_picker_controller_wrapper.dart index bdb93c8..de61aeb 100644 --- a/lib/src/multi_image_picker_controller_wrapper.dart +++ b/lib/src/multi_image_picker_controller_wrapper.dart @@ -6,8 +6,8 @@ class MultiImagePickerControllerWrapper extends InheritedWidget { super.key, required this.controller, required this.padding, - required Widget child, - }) : super(child: child); + required super.child, + }); final MultiImagePickerController controller; final EdgeInsetsGeometry? padding; diff --git a/lib/src/multi_image_picker_view.dart b/lib/src/multi_image_picker_view.dart index 1e060d4..3627b69 100644 --- a/lib/src/multi_image_picker_view.dart +++ b/lib/src/multi_image_picker_view.dart @@ -1,5 +1,4 @@ import 'package:flutter/material.dart'; -import 'package:flutter_reorderable_grid_view/entities/order_update_entity.dart'; import 'package:flutter_reorderable_grid_view/widgets/reorderable_builder.dart'; import 'package:multi_image_picker_view/src/widgets/default_add_more_widget.dart'; import 'package:multi_image_picker_view/src/widgets/default_initial_widget.dart'; @@ -52,6 +51,9 @@ class _MultiImagePickerViewState extends State { late final ScrollController _scrollController; final _gridViewKey = GlobalKey(); + final lockedIndices = [0, 4]; + final nonDraggableIndices = [0, 2, 3]; + @override void initState() { super.initState(); @@ -111,12 +113,10 @@ class _MultiImagePickerViewState extends State { ), ], ), - onReorder: (List orderUpdateEntities) { - for (final orderUpdateEntity in orderUpdateEntities) { - widget.controller.reOrderImage( - orderUpdateEntity.oldIndex, orderUpdateEntity.newIndex); - } - }, + onReorder: (reOrderCallback) { + final newList = reOrderCallback(widget.controller.images.toList()); + widget.controller.updateImages(newList as List); + }, longPressDelay: Duration(milliseconds: widget.longPressDelayMilliseconds), builder: (children) { diff --git a/lib/src/widgets/default_draggable_item_widget.dart b/lib/src/widgets/default_draggable_item_widget.dart index 5fd12f3..99f262e 100644 --- a/lib/src/widgets/default_draggable_item_widget.dart +++ b/lib/src/widgets/default_draggable_item_widget.dart @@ -58,7 +58,7 @@ class DefaultDraggableItemWidget extends StatelessWidget { BoxDecoration( color: Theme.of(context) .colorScheme - .background + .surface .withOpacity(0.5), shape: BoxShape.circle, ), diff --git a/lib/src/widgets/default_initial_widget.dart b/lib/src/widgets/default_initial_widget.dart index 04589b4..8778390 100644 --- a/lib/src/widgets/default_initial_widget.dart +++ b/lib/src/widgets/default_initial_widget.dart @@ -27,8 +27,8 @@ class DefaultInitialWidget extends StatelessWidget { child: Material( color: Colors.transparent, child: InkWell( - overlayColor: MaterialStateProperty.resolveWith((states) { - if (states.contains(MaterialState.pressed)) { + overlayColor: WidgetStateProperty.resolveWith((states) { + if (states.contains(WidgetState.pressed)) { return Theme.of(context).colorScheme.primary.withOpacity(0.15); } return Theme.of(context).colorScheme.primary.withOpacity(0.07); diff --git a/lib/src/widgets/draggable_item_ink_well.dart b/lib/src/widgets/draggable_item_ink_well.dart index 8a98639..6840657 100644 --- a/lib/src/widgets/draggable_item_ink_well.dart +++ b/lib/src/widgets/draggable_item_ink_well.dart @@ -8,7 +8,7 @@ class DraggableItemInkWell extends StatelessWidget { final Color? hoverColor; final Color? highlightColor; final Color? focusColor; - final MaterialStateProperty? overlayColor; + final WidgetStateProperty? overlayColor; final Color? splashColor; final InteractiveInkFeatureFactory? splashFactory; diff --git a/pubspec.yaml b/pubspec.yaml index 65e9635..d1c51c2 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,23 +1,21 @@ name: multi_image_picker_view description: A complete widget which can easily pick multiple images from device and display them in UI. Also picked image can be re-ordered and removed easily. -version: 1.0.3 +version: 1.0.5 homepage: https://github.com/shubham-gupta-16/multi_image_picker_view repository: https://github.com/shubham-gupta-16/multi_image_picker_view issue_tracker: https://github.com/shubham-gupta-16/multi_image_picker_view/issues environment: - sdk: ">=2.18.6 <4.0.0" - flutter: ">=1.17.0" + sdk: '>=3.4.0 <4.0.0' dependencies: flutter: sdk: flutter - flutter_reorderable_grid_view: ^4.0.0 - + flutter_reorderable_grid_view: ^5.0.1 dev_dependencies: flutter_test: sdk: flutter - flutter_lints: ^2.0.0 + flutter_lints: ^4.0.0 flutter: \ No newline at end of file