diff --git a/CHANGELOG.md b/CHANGELOG.md index 8711964..3c45a28 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,9 @@ +## 1.3.3 + +**Bug fixes** + * Fixes an issue where sometimes a single file path was being returned as a `List` instead of `String`. + * `requestCode` in Android intents are now restricted to 16 bits. + ## 1.3.2 **Bug fix:** Returns a `null` value in the `getFile()` when the picker is canceled. diff --git a/README.md b/README.md index 8c22b65..d71655d 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ A package that allows you to use a native file explorer to pick single or multip First, add *file_picker* as a dependency in [your pubspec.yaml file](https://flutter.io/platform-plugins/). ``` -file_picker: ^1.3.2 +file_picker: ^1.3.3 ``` ### Android Add `` to your app `AndroidManifest.xml` file. This is required due to file caching when a path is required from a remote file (eg. Google Drive). diff --git a/android/src/main/java/com/mr/flutter/plugin/filepicker/FilePickerPlugin.java b/android/src/main/java/com/mr/flutter/plugin/filepicker/FilePickerPlugin.java index 9d24186..03f3be1 100644 --- a/android/src/main/java/com/mr/flutter/plugin/filepicker/FilePickerPlugin.java +++ b/android/src/main/java/com/mr/flutter/plugin/filepicker/FilePickerPlugin.java @@ -27,8 +27,8 @@ import io.flutter.plugin.common.PluginRegistry.Registrar; /** FilePickerPlugin */ public class FilePickerPlugin implements MethodCallHandler { - private static final int REQUEST_CODE = FilePickerPlugin.class.hashCode() + 43; - private static final int PERM_CODE = FilePickerPlugin.class.hashCode() + 50; + private static final int REQUEST_CODE = (FilePickerPlugin.class.hashCode() + 43) & 0x0000ffff; + private static final int PERM_CODE = (FilePickerPlugin.class.hashCode() + 50) & 0x0000ffff; private static final String TAG = "FilePicker"; private static final String permission = Manifest.permission.WRITE_EXTERNAL_STORAGE; @@ -60,7 +60,11 @@ public class FilePickerPlugin implements MethodCallHandler { Log.i(TAG, "[MultiFilePick] File #" + currentItem + " - URI: " +currentUri.getPath()); currentItem++; } - result.success(paths); + if(paths.size() > 1){ + result.success(paths); + } else { + result.success(paths.get(0)); + } } else if (data != null) { Uri uri = data.getData(); Log.i(TAG, "[SingleFilePick] File URI:" +data.getData().toString()); diff --git a/example/lib/main.dart b/example/lib/main.dart index 65197d2..f771e95 100644 --- a/example/lib/main.dart +++ b/example/lib/main.dart @@ -56,7 +56,7 @@ class _FilePickerDemoState extends State { ), body: new Center( child: new Padding( - padding: const EdgeInsets.only(top: 50.0, left: 10.0, right: 10.0), + padding: const EdgeInsets.only(left: 10.0, right: 10.0), child: new SingleChildScrollView( child: new Column( mainAxisAlignment: MainAxisAlignment.center, diff --git a/pubspec.yaml b/pubspec.yaml index 5689b5b..6abdcb2 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,8 +1,8 @@ name: file_picker description: A package that allows you to use a native file explorer to pick single or multiple absolute file paths, with extensions filtering support. -author: Miguel Ruivo +author: Miguel Ruivo homepage: https://github.com/miguelpruivo/plugins_flutter_file_picker -version: 1.3.2 +version: 1.3.3 dependencies: