image_selector_formfield 1.0.1

image_selector_formfield #

This widget is a form field that allows the user to pick a image from gallery (soon from camera too), and then crop it. The widget is customizable and has all the posibilities expected on a Form Field.

This widget is using and depends on this other widgets:

So, you need to follow the Installation Guide from each of them.

Getting Started #

To use this package, you only need to install/import it to the project and then call it in the Widget's Build method.

Usage #

This widget is design to create/update a Image like a Profile Photo from a user on any app. So, if the user has a photo already, put the image url in the property ImageURL to display it. If the user tap on the widget, the picker will allow him/her to select a image, crop it and then displaying the result.

Some visuals can be customized:

  • widget Icon,
  • widget background Color
  • widget shape: Circle or Rectangle
  • Aspect Ratio: is calculated from RatioX and RatioY; default 9/16. In circular shape is locked to 1:1
  • borderRadius: customize size in circular shape and border radius on Rectangle corners

Example #

ImageSelectorFormField()

rectangle_9x16.png

ImageSelectorFormField(
    cropRatioX: 16,
    cropRatioY: 9,
)

rectangle_16x9.png

ImageSelectorFormField(
    cropStyle: CropStyle.circle,
)

circle.png

ImageSelectorFormField(
   cropStyle: CropStyle.circle,
   icon: Icon(Icons.add_photo_alternate,size: 100,color: Colors.green,),
   backgroundColor: Colors.blueGrey,
   errorTextStyle: TextStyle(color: Colors.red),
   onSaved: (img) {
     print("ON SAVED EJECUTADO");
   },
   validator: (img) {
     print("validator EJECUTADO");
     return "Error Text";
   },
   cropRatioX: 9,
   cropRatioY: 16,
 )

custom_circle.png

[1.0.1] - November 19, 2019.

  • BUG FIX - Image were not being passed to "onSave" and "Validator" callbacks;
  • Set flutter version in pubspec/environment to flutter: ">= 1.10.15-pre.148 < 2.0.0"

[1.0.0] - November 19, 2019.

  • First Customizable Version.

Use this package as a library

1. Depend on it

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


dependencies:
  image_selector_formfield: ^1.0.1

2. Install it

You can install packages from the command line:

with Flutter:


$ flutter pub get

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

3. Import it

Now in your Dart code, you can use:


import 'package:image_selector_formfield/image_selector_formfield.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
49
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
80
Overall:
Weighted score of the above. [more]
70
Learn more about scoring.

We analyzed this package on Feb 21, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.7.1
  • pana: 0.13.5
  • Flutter: 1.12.13+hotfix.7

Maintenance suggestions

Maintain an example. (-10 points)

Create a short demo in the example/ directory to show how to use this package.

Common filename patterns include main.dart, example.dart, and image_selector_formfield.dart. Packages with multiple examples should provide example/README.md.

For more information see the pub package layout conventions.

The description is too long. (-10 points)

Search engines display only the first part of the description. Try to keep the value of the description field in your package's pubspec.yaml file between 60 and 180 characters.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.1.0 <3.0.0
cached_network_image ^2.0.0-rc.1 2.0.0
flutter 0.0.0
image_cropper ^1.1.0 1.2.1
image_picker_modern ^0.4.12+3 0.4.12+3 0.4.13-1
Transitive dependencies
async 2.4.0
charcode 1.1.3
collection 1.14.11 1.14.12
convert 2.1.1
crypto 2.1.4
flutter_cache_manager 1.1.3
http 0.12.0+4
http_parser 3.1.3
meta 1.1.8
path 1.6.4
path_provider 1.6.1
pedantic 1.9.0
platform 2.2.1
sky_engine 0.0.99
source_span 1.6.0
sqflite 1.2.1
string_scanner 1.0.5
synchronized 2.2.0
term_glyph 1.1.0
typed_data 1.1.6
uuid 2.0.4
vector_math 2.0.8
Dev dependencies
flutter_test