filesystem_picker
filesystem_picker copied to clipboard
Multiple selections, multiple root directories, and more...
- ~~Parameter rootDirectory becomes optional. When not set, internal storage will be set as root, another external storage may be selected by accessing the Drawer on dialog.~~
- Parameter
rootDirectory
changed torootDirectories
, takes List<Directory>. Throws exception if list is empty. - Optional parameter
rootName
changed torootNames
, takes List<String>. UsesPath.basename
when ignored, and for values that equals empty string. - ~~Implemented MANAGE_EXTERNAL_STORAGE permission for Android 11. It is required to access files outside app storage.~~
- Implemented Multi-select mode for both Directory and File.
- Confirming File selections are now done by bottom bar buttons, previously by tapping on the File.
- Intercepted back button behavior. Back button will moves view to previous directory. Close dialog when on root.
- Added horizontal divider for File/Directory items.
- Dialog returns Iterable<String>?, containing Files/Directories paths. The return value will contain exactly one file/directory on single-select mode. Returns null if canceled.
- Handles long file name better, by adding ellipsis right before file extension (if any). For directory, the ellipsis will be put on the end.
- Refactored structure of package (thanks @alr2413, it was a lot easier).
- ~~(Temporary) Target SDK reverted to API level 29. Reason: https://stackoverflow.com/questions/65885987/after-adding-manage-external-storage-permission-i-can-not-upload-apk-to-google~~
Great improvement.
Ping @andyduke. Is there any problem with this PR that is not merged yet?
@kuchienkz, i've tested your fork. when i set the "fixedRootDirectory" it stuck at loading state. also, why did you change the minSDK from 16 to 19? thanks.
when i set the "fixedRootDirectory" it stuck at loading state.
Fixed that silly bug. I was so focused on the new features that I forgot to test the original ones, my bad.
also, why did you change the minSDK from 16 to 19?
No particular reason. If I'm not mistaken, the original native codes used the old flutter project format, I'm simply too lazy to migrate it and decided to create a new flutter project with the exact same package names, and import the native/android project, and do some minor adjustments. The minSDK 19 was used by default when you create a new project.
hmmm,
i agree with that change but you drop the support of older SDKs (the library must be backward compatible). Also, it seems that you made this package to be platform dependent. i think it's better to manage the directory outside of this package with path_provider.
please, let me know if i'm wrong. thanks
Now that you mention it, I really forgot to consider another platform since I'm using this package mainly on android projects 😅 .
I agree with that change but you drop the support of older SDKs (the library must be backward compatible).
Based on your suggestion, I modified the native codes so that it is backward compatible to SDK 16 (and changed the minSDK).
Also, it seems that you made this package to be platform-dependent. I think it's better to manage the directory outside of this package with path_provider.
I'm not really familiar with plugin (or package?) development so I don't think I fully understand what you mean.
CMIIW, instead of using the native android codes to get all available storage roots (which made it platform-dependent), so it's better to get storage roots with path_provider?
Or should I just remove the "optional rootDirectory" feature and make it mandatory again?
thanks
You're migrating this package from dart to plugin type. Check this Package types for more information. if you make it a plugin type, you've to implement the storage functionality for all platforms.
i think you should do this.
remove the "optional rootDirectory" feature and make it mandatory again
@kuchienkz, i've forked your repo and refactored base code for better management. i also created a PR in your repo. Please take a look. Thanks
Also, modified example app to use the new themeData
parameter.
Please tell me if there is something wrong. Thanks.
I couldn't build that for my android 10 device. the permission_handler in example app throws lots of exception. i'm still looking for a solution.
> Task :permission_handler:compileDebugJavaWithJavac FAILED
/Users/alireza/bin/flutter/.pub-cache/hosted/pub.dartlang.org/permission_handler-7.0.0/android/src/main/java/com/baseflow/permissionhandler/PermissionManager.java:54: error: cannot find symbol
status = Environment.isExternalStorageManager()
^
symbol: method isExternalStorageManager()
location: class Environment
/Users/alireza/bin/flutter/.pub-cache/hosted/pub.dartlang.org/permission_handler-7.0.0/android/src/main/java/com/baseflow/permissionhandler/PermissionManager.java:218: error: cannot find symbol
if (permission == PermissionConstants.PERMISSION_GROUP_MANAGE_EXTERNAL_STORAGE && Build.VERSION.SDK_INT < Build.VERSION_CODES.R) {
^
symbol: variable R
location: class VERSION_CODES
/Users/alireza/bin/flutter/.pub-cache/hosted/pub.dartlang.org/permission_handler-7.0.0/android/src/main/java/com/baseflow/permissionhandler/PermissionManager.java:232: error: cannot find symbol
} else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R && permission == PermissionConstants.PERMISSION_GROUP_MANAGE_EXTERNAL_STORAGE) {
^
symbol: variable R
location: class VERSION_CODES
/Users/alireza/bin/flutter/.pub-cache/hosted/pub.dartlang.org/permission_handler-7.0.0/android/src/main/java/com/baseflow/permissionhandler/PermissionManager.java:234: error: cannot find symbol
Settings.ACTION_MANAGE_APP_ALL_FILES_ACCESS_PERMISSION,
^
symbol: variable ACTION_MANAGE_APP_ALL_FILES_ACCESS_PERMISSION
location: class Settings
/Users/alireza/bin/flutter/.pub-cache/hosted/pub.dartlang.org/permission_handler-7.0.0/android/src/main/java/com/baseflow/permissionhandler/PermissionManager.java:293: error: cannot find symbol
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.R) {
^
symbol: variable R
location: class VERSION_CODES
/Users/alireza/bin/flutter/.pub-cache/hosted/pub.dartlang.org/permission_handler-7.0.0/android/src/main/java/com/baseflow/permissionhandler/PermissionManager.java:322: error: cannot find symbol
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.R) {
^
symbol: variable R
location: class VERSION_CODES
/Users/alireza/bin/flutter/.pub-cache/hosted/pub.dartlang.org/permission_handler-7.0.0/android/src/main/java/com/baseflow/permissionhandler/PermissionManager.java:326: error: cannot find symbol
return Environment.isExternalStorageManager()
^
symbol: method isExternalStorageManager()
location: class Environment
/Users/alireza/bin/flutter/.pub-cache/hosted/pub.dartlang.org/permission_handler-7.0.0/android/src/main/java/com/baseflow/permissionhandler/PermissionUtils.java:64: error: cannot find symbol
case Manifest.permission.MANAGE_EXTERNAL_STORAGE:
^
symbol: variable MANAGE_EXTERNAL_STORAGE
location: class permission
/Users/alireza/bin/flutter/.pub-cache/hosted/pub.dartlang.org/permission_handler-7.0.0/android/src/main/java/com/baseflow/permissionhandler/PermissionUtils.java:223: error: cannot find symbol
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R && hasPermissionInManifest(context, permissionNames, Manifest.permission.MANAGE_EXTERNAL_STORAGE ))
^
symbol: variable R
location: class VERSION_CODES
/Users/alireza/bin/flutter/.pub-cache/hosted/pub.dartlang.org/permission_handler-7.0.0/android/src/main/java/com/baseflow/permissionhandler/PermissionUtils.java:223: error: cannot find symbol
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R && hasPermissionInManifest(context, permissionNames, Manifest.permission.MANAGE_EXTERNAL_STORAGE ))
^
symbol: variable MANAGE_EXTERNAL_STORAGE
location: class permission
/Users/alireza/bin/flutter/.pub-cache/hosted/pub.dartlang.org/permission_handler-7.0.0/android/src/main/java/com/baseflow/permissionhandler/PermissionUtils.java:224: error: cannot find symbol
permissionNames.add(Manifest.permission.MANAGE_EXTERNAL_STORAGE);
^
symbol: variable MANAGE_EXTERNAL_STORAGE
location: class permission
11 errors
i updated compileSdkVersion
to 30, and it's solved.
i'm testing now
@kuchienkz nice work. i created a PR that fixed the above issue. thanks.
Please note that if you use this on an app that also uses MANAGE_EXTERNAL_STORAGE permission, you can't upload it to PlayStore until 5 May 2021.
Read more: https://support.google.com/googleplay/android-developer/answer/10467955
Thank you so much for adding these features! Not sure why this hasn't been merged! At this point you should probably just publish it haha!
Actually, I really want Multiple selections.