Skip to content

Commit

Permalink
Clarify how to use image_picker (flutter#73)
Browse files Browse the repository at this point in the history
* Update README.md

* Update CHANGELOG.md

* Update pubspec.yaml
  • Loading branch information
mit-mit authored May 23, 2017
1 parent 46dbd9e commit 487ca51
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 1 deletion.
4 changes: 4 additions & 0 deletions packages/image_picker/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 0.0.2+2

* Updated README

## 0.0.2+1

* Updated README
Expand Down
47 changes: 47 additions & 0 deletions packages/image_picker/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,54 @@

A Flutter wrapper for the native image picker.

This enables picking images from the image library, or to take new pictures with the camera.

*Note*: This plugin is still under development, and some APIs might not be available yet. [Feedback welcome](https://github.com/flutter/flutter/issues) and [Pull Requests](https://github.com/flutter/plugins/pulls) are most welcome!

## Usage
To use this plugin, add `image_picker` as a [dependency in your pubspec.yaml file](https://flutter.io/platform-plugins/).

Next, to make the app build for android, open the file `android/build.gradle`, and add the `jitpack.io` line shown below:

```
allprojects {
repositories {
jcenter()
maven { url "https://jitpack.io" } // Enable getting dependencies from jitpack.io.
}
}
```

### Example

``` dart
class _MyHomePageState extends State<MyHomePage> {
File imageFile;
getImage() async {
var _fileName = await ImagePicker.pickImage();
setState(() {
imageFile = _fileName;
});
}
@override
Widget build(BuildContext context) {
return new Scaffold(
appBar: new AppBar(
title: new Text('Image Picker Example'),
),
body: new Center(
child: imageFile == null
? new Text('No image selected.')
: new Image.file(imageFile),
),
floatingActionButton: new FloatingActionButton(
onPressed: getImage,
tooltip: 'Pick Image',
child: new Icon(Icons.add_a_photo),
),
);
}
}
```
2 changes: 1 addition & 1 deletion packages/image_picker/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: image_picker
description: Flutter plugin that shows an image picker.
author: Flutter Team <flutter-dev@googlegroups.com>
homepage: https://github.com/flutter/plugins/tree/master/packages/image_picker
version: 0.0.2+1
version: 0.0.2+2

flutter:
plugin:
Expand Down

0 comments on commit 487ca51

Please sign in to comment.