image_picker 0.1.3

Image Picker plugin for Flutter

pub package

A Flutter plugin for iOS and Android for picking images from the image library, and taking new pictures with the camera.

Note: This plugin is still under development, and some APIs might not be available yet. Feedback welcome and Pull Requests are most welcome!

Usage

To use this plugin, add image_picker as a dependency in your pubspec.yaml file.

Example

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),
      ),
    );
  }
}

0.1.3

  • Added optional source argument to pickImage for controlling where the image comes from.

0.1.2

  • Added optional maxWidth and maxHeight arguments to pickImage.

0.1.1

  • Updated Gradle repositories declaration to avoid the need for manual configuration in the consuming app.

0.1.0+1

  • Updated readme and description in pubspec.yaml

0.1.0

  • Updated dependencies
  • Breaking Change: You need to add a maven section with the "https://maven.google.com" endpoint to the repository section of your android/build.gradle. For example:
allprojects {
    repositories {
        jcenter()
        maven {                              // NEW
            url "https://maven.google.com"   // NEW
        }                                    // NEW
    }
}

0.0.3

  • Fix for crash on iPad when showing the Camera/Gallery selection dialog

0.0.2+2

  • Updated README

0.0.2+1

  • Updated README

0.0.2

  • Fix crash when trying to access camera on a device without camera (e.g. the Simulator)

0.0.1

  • Initial Release

1. Depend on it

Add this to your package's pubspec.yaml file:

dependencies:
  image_picker: "^0.1.3"

2. Install it

You can install packages from the command line:

with Flutter:


$ flutter packages get

Alternatively, your editor might support packages get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:

import 'package:image_picker/image_picker.dart';

Platforms

About

Flutter plugin that shows an image picker and uses the camera.

Author

Flutter Team

Homepage

github.com/flutter/plugins/tree/master/packages/image_picker

Documentation

www.dartdocs.org/documentation/image_picker/0.1.3/

Uploader

goderbauer@google.com
zarah@google.com
jackson@google.com
mit@google.com
mravn@google.com

License

BSD (LICENSE)

Published

Nov 14, 2017