FormBuilderImagePicker class
Field for picking image(s) from Gallery or Camera.
Field value is a list of objects.
the widget can internally handle displaying objects of type XFile
,Uint8List,String (for an image url),ImageProvider (for any flutter image), Widget (for any widget)
and appends XFile
to the list for picked images.
if you want to use a different object (e.g. a class from the backend that has imageId and imageUrl) you need to implement displayCustomType
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatefulWidget
- FormField<
List> - FormBuilderImagePicker
Constructors
-
FormBuilderImagePicker({Key? key, required String name, FormFieldValidator<
List> ? validator, List? initialValue, InputDecoration decoration = const InputDecoration(), ValueChanged<List?> ? onChanged, ValueTransformer<List?> ? valueTransformer, bool enabled = true, FormFieldSetter<List> ? onSaved, AutovalidateMode autovalidateMode = AutovalidateMode.disabled, VoidCallback? onReset, FocusNode? focusNode, WidgetBuilder? loadingWidget, BoxFit fit = BoxFit.cover, bool preventPop = false, dynamic displayCustomType(dynamic obj)?, double previewWidth = 130, double previewHeight = 130, EdgeInsets? previewMargin, Color? iconColor, double? maxHeight, double? maxWidth, int? imageQuality, CameraDevice preferredCameraDevice = CameraDevice.rear, void onImage(Image)?, int? maxImages, Widget cameraIcon = const Icon(Icons.camera_enhance), Widget galleryIcon = const Icon(Icons.image), Widget cameraLabel = const Text('Camera'), Widget galleryLabel = const Text('Gallery'), EdgeInsets bottomSheetPadding = EdgeInsets.zero, ImageProvider<Object> ? placeholderImage})
Properties
- autovalidateMode → AutovalidateMode
-
Used to enable/disable this form field auto validation and update its
error text.
finalinherited
- bottomSheetPadding → EdgeInsets
-
final
-
builder
→ FormFieldBuilder<
List> -
Function that returns the widget representing this form field. It is
passed the form field state as input, containing the current value and
validation state of this field.
finalinherited
- cameraIcon → Widget
-
final
- cameraLabel → Widget
-
final
- decoration → InputDecoration
-
The border, labels, icons, and styles used to decorate the field.
finalinherited
- displayCustomType → dynamic Function(dynamic obj)?
-
use this to get an image from a custom object to either Uint8List or
XFile
or String (url) or ImageProviderfinal - enabled → bool
-
Whether the form is able to receive user input.
finalinherited
- fit → BoxFit
-
fit for each image
final
- focusNode → FocusNode?
-
An optional focus node to use as the focus node for this widget.
finalinherited
- forceErrorText → String?
-
An optional property that forces the FormFieldState into an error state
by directly setting the FormFieldState.errorText property without
running the validator function.
finalinherited
- galleryIcon → Widget
-
final
- galleryLabel → Widget
-
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- iconColor → Color?
-
final
- imageQuality → int?
-
The imageQuality argument modifies the quality of the image, ranging from
0-100 where 100 is the original/max quality. If imageQuality is null, the
image with the original quality will be returned. See
ImagePicker
.final - initialValue → List?
-
An optional value to initialize the form field to, or null otherwise.
finalinherited
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
- maxHeight → double?
-
Optional maximum height of image; see
ImagePicker
.final - maxImages → int?
-
final
- maxWidth → double?
-
Optional maximum width of image; see
ImagePicker
.final - name → String
-
Used to reference the field within the form, or to reference form data
after the form is submitted.
finalinherited
-
onChanged
→ ValueChanged<
List?> ? -
Called when the field value is changed.
finalinherited
- onImage → void Function(Image)?
-
final
- onReset → VoidCallback?
-
Called when the field value is reset.
finalinherited
-
onSaved
→ FormFieldSetter<
List> ? -
An optional method to call with the final value when the form is saved via
FormState.save.
finalinherited
-
placeholderImage
→ ImageProvider<
Object> ? -
final
- preferredCameraDevice → CameraDevice
-
Use preferredCameraDevice to specify the camera to use when the source is
ImageSource.camera
. The preferredCameraDevice is ignored when source isImageSource.gallery
. It is also ignored if the chosen camera is not supported on the device. Defaults toCameraDevice.rear
. SeeImagePicker
.final - preventPop → bool
-
final
- previewHeight → double
-
final
- previewMargin → EdgeInsets?
-
final
- previewWidth → double
-
final
- restorationId → String?
-
Restoration ID to save and restore the state of the form field.
finalinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
validator
→ FormFieldValidator<
List> ? -
An optional method that validates an input. Returns an error string to
display if the input is invalid, or null otherwise.
finalinherited
-
valueTransformer
→ ValueTransformer<
List?> ? -
Called just before field value is saved. Used to massage data just before
committing the value.
finalinherited
Methods
-
createElement(
) → StatefulElement -
Creates a StatefulElement to manage this widget's location in the tree.
inherited
-
createState(
) → _FormBuilderImagePickerState - Creates the mutable state for this widget at a given location in the tree.
-
debugDescribeChildren(
) → List< DiagnosticsNode> -
Returns a list of DiagnosticsNode objects describing this node's
children.
inherited
-
debugFillProperties(
DiagnosticPropertiesBuilder properties) → void -
Add additional properties associated with the node.
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toDiagnosticsNode(
{String? name, DiagnosticsTreeStyle? style}) → DiagnosticsNode -
Returns a debug representation of the object that is used by debugging
tools and by DiagnosticsNode.toStringDeep.
inherited
-
toString(
{DiagnosticLevel minLevel = DiagnosticLevel.info}) → String -
A string representation of this object.
inherited
-
toStringDeep(
{String prefixLineOne = '', String? prefixOtherLines, DiagnosticLevel minLevel = DiagnosticLevel.debug, int wrapWidth = 65}) → String -
Returns a string representation of this node and its descendants.
inherited
-
toStringShallow(
{String joiner = ', ', DiagnosticLevel minLevel = DiagnosticLevel.debug}) → String -
Returns a one-line detailed description of the object.
inherited
-
toStringShort(
) → String -
A short, textual description of this widget.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited