GridImagePicker class
GridImagePicker widget is used to upload and display images in a grid view.
- uploadMode selects the upload strategy (UploadMode.standard, UploadMode.sequential or UploadMode.gzip).
- compressionOptions controls image compression for UploadMode.gzip.
- itemIdResolver supplies stable string IDs for items that aren't
Maps with an'id'key. Falls back toitem['id'](Map) oritem.id(model) when null. - onUploadImages bypasses MediaApiService entirely (custom upload flow).
- onDragCompletion fires after a drag-reorder with the new ID list.
- onImageLongPress replaces the default action dialog.
- newItemAnimationBuilder, loadingPlaceholderBuilder and pendingTileBuilder override the default tile widgets.
- canDeleteImage is a per-item callback (see GridImagePicker.alwaysAllowDelete for the always-on shortcut).
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatefulWidget
- GridImagePicker
Constructors
-
GridImagePicker({Key? key, required dynamic defaultImages(), required String? setImageUrlFromItem(dynamic item), ApiRequest? apiUpload, ApiRequest apiMainImage(dynamic item)?, ApiRequest apiDeleteImage(dynamic item)?, double height = 400, double width = 70, Widget? loading, int? imageQuality = 80, bool canDeleteImage(dynamic item)?, bool canSetMainImage = true, int maxImages = 11, double maxSize = 1024 * 1024 * 7, List<
String> ? allowedMimeTypes, bool? setMainImageFromItem(dynamic item)?, dynamic onImageUploaded(dynamic response)?, dynamic onMainImageResponse(dynamic response)?, dynamic onDeleteImageResponse(dynamic response)?, String itemIdResolver(dynamic item)?, UploadMode uploadMode = UploadMode.standard, ImageCompressionOptions? compressionOptions, bool displayValidationHint = true, Widget placeholder = const SizedBox.shrink(), void onDragCompletion(List<String> newOrder)?, void onImageLongPress(dynamic item)?, Future onUploadImages(List<XFile> images)?, Widget newItemAnimationBuilder(BuildContext, Widget child)?, Widget loadingPlaceholderBuilder(BuildContext)?, Widget pendingTileBuilder(BuildContext, File file, double? progress)?, Widget dragPlaceholderBuilder(BuildContext)?, Widget dragFeedbackBuilder(BuildContext context, Widget child)?, String deleteConfirmationTitle = "Delete image?"})
Properties
-
allowedMimeTypes
→ List<
String> ? -
final
- apiDeleteImage → ApiRequest Function(dynamic item)?
-
final
- apiMainImage → ApiRequest Function(dynamic item)?
-
final
- apiUpload → ApiRequest?
-
final
- canDeleteImage → bool Function(dynamic item)?
-
Per-item delete gate. When null, no delete button is rendered. When
supplied, a delete button appears only on items for which this returns
true. Use GridImagePicker.alwaysAllowDelete to enable for all items.final - canSetMainImage → bool
-
final
- compressionOptions → ImageCompressionOptions?
-
Compression options forwarded to MediaApiService.uploadImagesGzip when
uploadMode is UploadMode.gzip.
final
- defaultImages → dynamic Function()
-
final
- deleteConfirmationTitle → String
-
Title shown in the Nylo
confirmActiondialog when deleting an image.final - displayValidationHint → bool
-
When true (default), shows the bottom hint listing max images and file
constraints.
final
- dragFeedbackBuilder → Widget Function(BuildContext context, Widget child)?
-
Replaces the default floating widget shown under the finger while
dragging. Receives the dragged tile's child so callers can wrap or
re-style the original content.
final
- dragPlaceholderBuilder → Widget Function(BuildContext)?
-
Replaces the default drop-target placeholder (a white square) shown at
the destination cell while a tile is being dragged over it.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- height → double
-
final
- imageQuality → int?
-
final
- itemIdResolver → String Function(dynamic item)?
-
Returns a stable string ID for an item. Falls back to
item['id'](Map shape) oritem.id(model with id getter) when null.final - items → List
-
final
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
- loading → Widget?
-
final
- loadingPlaceholderBuilder → Widget Function(BuildContext)?
-
Replaces the default LoadingPlaceholderTile for empty slots during
upload.
final
- maxImages → int
-
final
- maxSize → double
-
final
- newItemAnimationBuilder → Widget Function(BuildContext, Widget child)?
-
Replaces the default AnimatedImageTile wrapper for newly uploaded items.
final
- onDeleteImageResponse → dynamic Function(dynamic response)?
-
final
-
onDragCompletion
→ void Function(List<
String> newOrder)? -
Fires after a drag-reorder with the new ID list (resolved via
itemIdResolver).
final
- onImageLongPress → void Function(dynamic item)?
-
When provided, replaces the default action dialog on long-press.
final
- onImageUploaded → dynamic Function(dynamic response)?
-
final
- onMainImageResponse → dynamic Function(dynamic response)?
-
final
-
onUploadImages
→ Future Function(List<
XFile> images)? -
When provided, bypasses MediaApiService entirely. Use for fully
custom upload flows (signed URLs, S3 multipart, etc.).
final
- pendingTileBuilder → Widget Function(BuildContext, File file, double? progress)?
-
Replaces the default PendingUploadTile for in-flight uploads.
final
- picker → ImagePicker
-
final
- placeholder → Widget
-
Widget shown in empty grid slots when no image is available.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- setImageUrlFromItem → String? Function(dynamic item)
-
final
- setMainImageFromItem → bool? Function(dynamic item)?
-
final
- uploadMode → UploadMode
-
Selects the upload strategy when uploading via MediaApiService.
final
- width → double
-
final
Methods
-
createElement(
) → StatefulElement -
Creates a StatefulElement to manage this widget's location in the tree.
inherited
-
createState(
) → State< StatefulWidget> -
Creates the mutable state for this widget at a given location in the tree.
override
-
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
Static Methods
-
alwaysAllowDelete(
dynamic _) → bool -
Convenience helper that always allows deletion regardless of the item.
Pass as
canDeleteImage: GridImagePicker.alwaysAllowDelete.