This commit is contained in:
Miguel Ruivo 2019-03-24 13:39:43 +00:00
parent 43796d2a21
commit 8f6c488fb4
5 changed files with 17 additions and 7 deletions

View File

@ -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.

View File

@ -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 `<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>` 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).

View File

@ -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());

View File

@ -56,7 +56,7 @@ class _FilePickerDemoState extends State<FilePickerDemo> {
),
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,

View File

@ -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 <miguelpruivo@outlook.com>
author: Miguel Ruivo <miguel@miguelruivo.com>
homepage: https://github.com/miguelpruivo/plugins_flutter_file_picker
version: 1.3.2
version: 1.3.3
dependencies: