image_picker_type 0.0.3
image_picker_type: ^0.0.3 copied to clipboard

Flutter Android iOS

A Flutter plugin for iOS and Android for picking images from the image library and crop it.

example/lib/main.dart

import 'dart:io';

import 'package:flutter/material.dart';
import 'package:image_picker_type/image_picker_type.dart';

void main() {
  runApp(MyApp());
}

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        primarySwatch: Colors.blue,
        visualDensity: VisualDensity.adaptivePlatformDensity,
      ),
      home: MyHomePage(),
    );
  }
}

class MyHomePage extends StatefulWidget {
  @override
  _MyHomePageState createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  File _image;

  @override
  Widget build(BuildContext context) {
    return Scaffold(
        appBar: AppBar(
          title: Text("Sample Imagepicker Widget"),
          backgroundColor: Colors.black45,
        ),
        body: Center(
          child: Container(
            child: Column(
              children: [
                Container(
                  color: Colors.black12,
                  height: 300.0,
                  width: 900.0,
                  child: _image == null
                      ? Text("Still waiting!")
                      : Image.file(_image),
                ),
                FlatButton(
                  color: Colors.deepOrangeAccent,
                  child: Text(
                    "Select Image",
                    style: TextStyle(color: Colors.white),
                  ),
                  onPressed: () {
                    // show bottom sheet to select image option
                    showModalBottomSheet<void>(
                        context: context,
                        builder: (BuildContext context) {
                          return ImagePickerHelper(
                            // isSave: true,  //if you want to save image in directory
                            size: Size(300, 300),
                            onDone: (file) {
                              if (file == null) {
                                print(null);
                              } else {
                                setState(() {
                                  _image = file;
                                });
                              }
                            },
                          );
                        });
                  },
                ),
              ],
            ),
          ),
        ));
  }
}
5
likes
90
pub points
63%
popularity

A Flutter plugin for iOS and Android for picking images from the image library and crop it.

Repository (GitHub)
View/report issues

Documentation

API reference

Uploader

pansheriyajayesh@gmail.com

License

Apache 2.0 (LICENSE)

Dependencies

flutter, image_cropper, image_picker

More

Packages that depend on image_picker_type