Skip to content

Commit

Permalink
updates readme and changelog
Browse files Browse the repository at this point in the history
  • Loading branch information
Miguel Ruivo committed Mar 10, 2019
1 parent aa2cfc9 commit 977498b
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 54 deletions.
3 changes: 1 addition & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@

## 1.2.0

**Breaking change**
Migrate from the deprecated original Android Support Library to AndroidX. This shouldn't result in any functional changes, but it requires any Android apps using this plugin to [also migrate](https://developer.android.com/jetpack/androidx/migrate) if they're using the original support library.
**Breaking change**: Migrate from the deprecated original Android Support Library to AndroidX. This shouldn't result in any functional changes, but it requires any Android apps using this plugin to [also migrate](https://developer.android.com/jetpack/androidx/migrate) if they're using the original support library.

## 1.1.1

Expand Down
54 changes: 8 additions & 46 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,15 +44,21 @@ Picking multiple paths from iOS gallery (image and video) aren't currently suppo

#### Usages

So, a few basically usages can be as follow:
So, a few example usages can be as follow:
```
// Single file path
String filePath;
filePath = await FilePicker.getFilePath(type: FileType.ANY); // will let you pick one file, from all extensions
filePath = await FilePicker.getFilePath(type: FileType.CUSTOM, fileExtension: 'svg'); // will filter and only let you pick files with svg extension.
// Multi file path
Map<String,String> filesPaths;
filePaths = await FilePicker.getMultiFilePath(); // will let you pick multiple files of any format at once
filePaths = await FilePicker.getMultiFilePath(fileExtension: 'pdf'); // will let you pick multiple pdf files at once
List<String> allNames = filePaths.keys; // List of all file names
List<String> allPaths = filePaths.values; // List of all paths
String someFilePath = filePaths['fileName']; // Access a file path directly by its name (matching a key)
```

##### A few notes
Expand All @@ -73,51 +79,7 @@ filePaths = await FilePicker.getMultiFilePath(fileExtension: 'pdf'); // will let
![Demo](https://github.com/miguelpruivo/plugins_flutter_file_picker/blob/master/example/example.gif)

## Example
```
import 'package:file_picker/file_picker.dart';
class MyHomePage extends StatefulWidget {
@override
_MyHomePageState createState() => new _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
String _filePath;
void getFilePath() async {
try {
String filePath = await FilePicker.getFilePath(type: FileType.ANY);
if (filePath == '') {
return;
}
print("File path: " + filePath);
setState((){this._filePath = filePath;});
} on PlatformException catch (e) {
print("Error while picking the file: " + e.toString());
}
}
@override
Widget build(BuildContext context) {
return new Scaffold(
appBar: new AppBar(
title: new Text('File Picker Example'),
),
body: new Center(
child: _filePath == null
? new Text('No file selected.')
: new Text('Path' + _filePath),
),
floatingActionButton: new FloatingActionButton(
onPressed: getFilePath,
tooltip: 'Select file',
child: new Icon(Icons.sd_storage),
),
);
}
}
```
See example app.

## Getting Started

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,8 @@
import android.util.Log;
import android.webkit.MimeTypeMap;

import java.io.BufferedOutputStream;

import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;


Expand Down Expand Up @@ -176,8 +173,6 @@ private static void startFileExplorer(String type) {
intent.putExtra(Intent.EXTRA_ALLOW_MULTIPLE, isMultipleSelection);
intent.addCategory(Intent.CATEGORY_OPENABLE);

Log.d(TAG, "Intent: " + intent.toString());

instance.activity().startActivityForResult(intent, REQUEST_CODE);
} else {
requestPermission();
Expand Down
Binary file modified example/example.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 977498b

Please sign in to comment.