Skip to content

Commit 4535927

Browse files
feat: remove permissions handler dependency
1 parent aad4fde commit 4535927

File tree

9 files changed

+86
-57
lines changed

9 files changed

+86
-57
lines changed

example/ios/Podfile.lock

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,6 @@ PODS:
3434
- DKImagePickerController/PhotoGallery
3535
- Flutter
3636
- Flutter (1.0.0)
37-
- permission_handler_apple (9.0.4):
38-
- Flutter
3937
- SDWebImage (5.15.4):
4038
- SDWebImage/Core (= 5.15.4)
4139
- SDWebImage/Core (5.15.4)
@@ -44,7 +42,6 @@ PODS:
4442
DEPENDENCIES:
4543
- file_picker (from `.symlinks/plugins/file_picker/ios`)
4644
- Flutter (from `Flutter`)
47-
- permission_handler_apple (from `.symlinks/plugins/permission_handler_apple/ios`)
4845

4946
SPEC REPOS:
5047
trunk:
@@ -58,15 +55,12 @@ EXTERNAL SOURCES:
5855
:path: ".symlinks/plugins/file_picker/ios"
5956
Flutter:
6057
:path: Flutter
61-
permission_handler_apple:
62-
:path: ".symlinks/plugins/permission_handler_apple/ios"
6358

6459
SPEC CHECKSUMS:
6560
DKImagePickerController: b512c28220a2b8ac7419f21c491fc8534b7601ac
6661
DKPhotoGallery: fdfad5125a9fdda9cc57df834d49df790dbb4179
6762
file_picker: ce3938a0df3cc1ef404671531facef740d03f920
6863
Flutter: f04841e97a9d0b0a8025694d0796dd46242b2854
69-
permission_handler_apple: 44366e37eaf29454a1e7b1b7d736c2cceaeb17ce
7064
SDWebImage: 1c39de67663e5eebb2f41324d5d580eeea12dd4c
7165
SwiftyGif: 93a1cc87bf3a51916001cf8f3d63835fb64c819f
7266

example/macos/Podfile.lock

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
PODS:
2+
- FlutterMacOS (1.0.0)
3+
4+
DEPENDENCIES:
5+
- FlutterMacOS (from `Flutter/ephemeral`)
6+
7+
EXTERNAL SOURCES:
8+
FlutterMacOS:
9+
:path: Flutter/ephemeral
10+
11+
SPEC CHECKSUMS:
12+
FlutterMacOS: 8f6f14fa908a6fb3fba0cd85dbd81ec4b251fb24
13+
14+
PODFILE CHECKSUM: 353c8bcc5d5b0994e508d035b5431cfe18c1dea7
15+
16+
COCOAPODS: 1.11.3

example/macos/Runner.xcodeproj/project.pbxproj

Lines changed: 43 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
33CC10F32044A3C60003C045 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 33CC10F22044A3C60003C045 /* Assets.xcassets */; };
2727
33CC10F62044A3C60003C045 /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 33CC10F42044A3C60003C045 /* MainMenu.xib */; };
2828
33CC11132044BFA00003C045 /* MainFlutterWindow.swift in Sources */ = {isa = PBXBuildFile; fileRef = 33CC11122044BFA00003C045 /* MainFlutterWindow.swift */; };
29+
54AF113C5FB97549FCC3FB48 /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9787CF0EDD0A3A77A6DC788D /* Pods_Runner.framework */; };
2930
/* End PBXBuildFile section */
3031

3132
/* Begin PBXContainerItemProxy section */
@@ -52,9 +53,10 @@
5253
/* End PBXCopyFilesBuildPhase section */
5354

5455
/* Begin PBXFileReference section */
56+
2388AB6D3ED4A3A7E09A91E8 /* 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 = "<group>"; };
5557
333000ED22D3DE5D00554162 /* Warnings.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Warnings.xcconfig; sourceTree = "<group>"; };
5658
335BBD1A22A9A15E00E9071D /* GeneratedPluginRegistrant.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GeneratedPluginRegistrant.swift; sourceTree = "<group>"; };
57-
33CC10ED2044A3C60003C045 /* example.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "example.app"; sourceTree = BUILT_PRODUCTS_DIR; };
59+
33CC10ED2044A3C60003C045 /* example.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = example.app; sourceTree = BUILT_PRODUCTS_DIR; };
5860
33CC10F02044A3C60003C045 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
5961
33CC10F22044A3C60003C045 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; name = Assets.xcassets; path = Runner/Assets.xcassets; sourceTree = "<group>"; };
6062
33CC10F52044A3C60003C045 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/MainMenu.xib; sourceTree = "<group>"; };
@@ -66,15 +68,19 @@
6668
33E51913231747F40026EE4D /* DebugProfile.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = DebugProfile.entitlements; sourceTree = "<group>"; };
6769
33E51914231749380026EE4D /* Release.entitlements */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.entitlements; path = Release.entitlements; sourceTree = "<group>"; };
6870
33E5194F232828860026EE4D /* AppInfo.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = AppInfo.xcconfig; sourceTree = "<group>"; };
71+
6324BAC79FCB34434B56513C /* 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 = "<group>"; };
6972
7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Release.xcconfig; sourceTree = "<group>"; };
7073
9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = Debug.xcconfig; sourceTree = "<group>"; };
74+
9787CF0EDD0A3A77A6DC788D /* Pods_Runner.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner.framework; sourceTree = BUILT_PRODUCTS_DIR; };
75+
9C2002B474E29B1807E3E5CA /* 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 = "<group>"; };
7176
/* End PBXFileReference section */
7277

7378
/* Begin PBXFrameworksBuildPhase section */
7479
33CC10EA2044A3C60003C045 /* Frameworks */ = {
7580
isa = PBXFrameworksBuildPhase;
7681
buildActionMask = 2147483647;
7782
files = (
83+
54AF113C5FB97549FCC3FB48 /* Pods_Runner.framework in Frameworks */,
7884
);
7985
runOnlyForDeploymentPostprocessing = 0;
8086
};
@@ -99,6 +105,7 @@
99105
33CEB47122A05771004F2AC0 /* Flutter */,
100106
33CC10EE2044A3C60003C045 /* Products */,
101107
D73912EC22F37F3D000D13A0 /* Frameworks */,
108+
E630D796E735551F3FE665F2 /* Pods */,
102109
);
103110
sourceTree = "<group>";
104111
};
@@ -148,17 +155,30 @@
148155
D73912EC22F37F3D000D13A0 /* Frameworks */ = {
149156
isa = PBXGroup;
150157
children = (
158+
9787CF0EDD0A3A77A6DC788D /* Pods_Runner.framework */,
151159
);
152160
name = Frameworks;
153161
sourceTree = "<group>";
154162
};
163+
E630D796E735551F3FE665F2 /* Pods */ = {
164+
isa = PBXGroup;
165+
children = (
166+
9C2002B474E29B1807E3E5CA /* Pods-Runner.debug.xcconfig */,
167+
2388AB6D3ED4A3A7E09A91E8 /* Pods-Runner.release.xcconfig */,
168+
6324BAC79FCB34434B56513C /* Pods-Runner.profile.xcconfig */,
169+
);
170+
name = Pods;
171+
path = Pods;
172+
sourceTree = "<group>";
173+
};
155174
/* End PBXGroup section */
156175

157176
/* Begin PBXNativeTarget section */
158177
33CC10EC2044A3C60003C045 /* Runner */ = {
159178
isa = PBXNativeTarget;
160179
buildConfigurationList = 33CC10FB2044A3C60003C045 /* Build configuration list for PBXNativeTarget "Runner" */;
161180
buildPhases = (
181+
18356099C58B7A0488D59B8F /* [CP] Check Pods Manifest.lock */,
162182
33CC10E92044A3C60003C045 /* Sources */,
163183
33CC10EA2044A3C60003C045 /* Frameworks */,
164184
33CC10EB2044A3C60003C045 /* Resources */,
@@ -233,6 +253,28 @@
233253
/* End PBXResourcesBuildPhase section */
234254

235255
/* Begin PBXShellScriptBuildPhase section */
256+
18356099C58B7A0488D59B8F /* [CP] Check Pods Manifest.lock */ = {
257+
isa = PBXShellScriptBuildPhase;
258+
buildActionMask = 2147483647;
259+
files = (
260+
);
261+
inputFileListPaths = (
262+
);
263+
inputPaths = (
264+
"${PODS_PODFILE_DIR_PATH}/Podfile.lock",
265+
"${PODS_ROOT}/Manifest.lock",
266+
);
267+
name = "[CP] Check Pods Manifest.lock";
268+
outputFileListPaths = (
269+
);
270+
outputPaths = (
271+
"$(DERIVED_FILE_DIR)/Pods-Runner-checkManifestLockResult.txt",
272+
);
273+
runOnlyForDeploymentPostprocessing = 0;
274+
shellPath = /bin/sh;
275+
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";
276+
showEnvVarsInLog = 0;
277+
};
236278
3399D490228B24CF009A79C7 /* ShellScript */ = {
237279
isa = PBXShellScriptBuildPhase;
238280
alwaysOutOfDate = 1;

example/macos/Runner.xcworkspace/contents.xcworkspacedata

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

example/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ environment:
1010
dependencies:
1111
flutter:
1212
sdk: flutter
13-
flutter_form_builder: ^7.8.0
13+
flutter_form_builder: ^8.0.0
1414
form_builder_file_picker:
1515
path: ../
1616

example/windows/flutter/generated_plugin_registrant.cc

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,6 @@
66

77
#include "generated_plugin_registrant.h"
88

9-
#include <permission_handler_windows/permission_handler_windows_plugin.h>
109

1110
void RegisterPlugins(flutter::PluginRegistry* registry) {
12-
PermissionHandlerWindowsPluginRegisterWithRegistrar(
13-
registry->GetRegistrarForPlugin("PermissionHandlerWindowsPlugin"));
1411
}

example/windows/flutter/generated_plugins.cmake

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
#
44

55
list(APPEND FLUTTER_PLUGIN_LIST
6-
permission_handler_windows
76
)
87

98
list(APPEND FLUTTER_FFI_PLUGIN_LIST

lib/src/form_builder_file_picker.dart

Lines changed: 21 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import 'package:file_picker/file_picker.dart';
66
import 'package:flutter/foundation.dart' show kIsWeb;
77
import 'package:flutter/material.dart';
88
import 'package:flutter_form_builder/flutter_form_builder.dart';
9-
import 'package:permission_handler/permission_handler.dart';
109

1110
/// Signature of a function to build a custom file viewer [Widget] for
1211
/// [FormBuilderFilePicker].
@@ -74,18 +73,18 @@ class FormBuilderFilePicker extends FormBuilderField<List<PlatformFile>> {
7473
/// Creates field for image(s) from user device storage
7574
FormBuilderFilePicker({
7675
//From Super
77-
Key? key,
78-
required String name,
79-
FormFieldValidator<List<PlatformFile>>? validator,
80-
List<PlatformFile>? initialValue,
81-
InputDecoration decoration = const InputDecoration(),
82-
ValueChanged<List<PlatformFile>?>? onChanged,
83-
ValueTransformer<List<PlatformFile>?>? valueTransformer,
84-
bool enabled = true,
85-
FormFieldSetter<List<PlatformFile>>? onSaved,
86-
AutovalidateMode autovalidateMode = AutovalidateMode.disabled,
87-
VoidCallback? onReset,
88-
FocusNode? focusNode,
76+
super.key,
77+
required super.name,
78+
super.validator,
79+
super.initialValue,
80+
super.decoration,
81+
super.onChanged,
82+
super.valueTransformer,
83+
super.enabled,
84+
super.onSaved,
85+
super.autovalidateMode = AutovalidateMode.disabled,
86+
super.onReset,
87+
super.focusNode,
8988
this.maxFiles,
9089
this.withData = kIsWeb,
9190
this.withReadStream = false,
@@ -104,18 +103,6 @@ class FormBuilderFilePicker extends FormBuilderField<List<PlatformFile>> {
104103
this.allowCompression = true,
105104
this.customFileViewerBuilder,
106105
}) : super(
107-
key: key,
108-
initialValue: initialValue,
109-
name: name,
110-
validator: validator,
111-
valueTransformer: valueTransformer,
112-
onChanged: onChanged,
113-
autovalidateMode: autovalidateMode,
114-
onSaved: onSaved,
115-
enabled: enabled,
116-
onReset: onReset,
117-
decoration: decoration,
118-
focusNode: focusNode,
119106
builder: (FormFieldState<List<PlatformFile>?> field) {
120107
final state = field as _FormBuilderFilePickerState;
121108

@@ -198,23 +185,15 @@ class _FormBuilderFilePickerState
198185
FilePickerResult? resultList;
199186

200187
try {
201-
if (kIsWeb ||
202-
Platform.isLinux ||
203-
Platform.isWindows ||
204-
Platform.isMacOS ||
205-
await Permission.storage.request().isGranted) {
206-
resultList = await FilePicker.platform.pickFiles(
207-
type: fileType,
208-
allowedExtensions: widget.allowedExtensions,
209-
allowCompression: widget.allowCompression,
210-
onFileLoading: widget.onFileLoading,
211-
allowMultiple: widget.allowMultiple,
212-
withData: widget.withData,
213-
withReadStream: widget.withReadStream,
214-
);
215-
} else {
216-
throw Exception('Storage Permission not granted');
217-
}
188+
resultList = await FilePicker.platform.pickFiles(
189+
type: fileType,
190+
allowedExtensions: widget.allowedExtensions,
191+
allowCompression: widget.allowCompression,
192+
onFileLoading: widget.onFileLoading,
193+
allowMultiple: widget.allowMultiple,
194+
withData: widget.withData,
195+
withReadStream: widget.withReadStream,
196+
);
218197
} on Exception catch (e) {
219198
debugPrint(e.toString());
220199
}

pubspec.yaml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,10 @@ environment:
1212

1313
dependencies:
1414
community_material_icon: ^5.9.55
15-
file_picker: ^5.2.5
15+
file_picker: ^5.2.11
1616
flutter:
1717
sdk: flutter
18-
flutter_form_builder: ^7.8.0
19-
permission_handler: ^10.2.0
18+
flutter_form_builder: ^8.0.0
2019

2120
platforms:
2221
android:

0 commit comments

Comments
 (0)