Skip to content
On this page

AttachmentPicker

A selection interface for adding files or media.

AttachmentPicker in FluttyUIAttachmentPicker in FluttyUI dark theme

Import

import 'package:flutter/widgets.dart';
import 'package:fluttyui/fluttyui.dart' as ui;

API Reference

The declarations below match the current FluttyUI source. Types are shown without the optional ui. import prefix.

AttachmentPicker

const AttachmentPicker({
  super.key,
  required this.attachments,
  required this.onChanged,
  this.onDone,
  this.onError,
  this.delegate = const NativeAttachmentPickerDelegate(),
  this.sources = AttachmentPickerSource.values,
  this.maxAttachments = 10,
  this.maxFileBytes = 25 * 1024 * 1024,
  this.maxTotalBytes = 100 * 1024 * 1024,
  this.allowedExtensions = const [],
  this.allowImageEditing = true,
  this.enabled = true,
  this.doneLabel = 'Attach',
  this.motion,
});
ParameterTypeRequiredDefault
keyKey?Nonull
attachmentsList<AttachmentPickerItem>Yes—
onChangedValueChanged<List<AttachmentPickerItem>>Yes—
onDoneValueChanged<List<AttachmentPickerItem>>?Nonull
onErrorvoid Function(Object error)?Nonull
delegateAttachmentPickerDelegateNoconst NativeAttachmentPickerDelegate()
sourcesList<AttachmentPickerSource>NoAttachmentPickerSource.values
maxAttachmentsintNo10
maxFileBytesintNo25 * 1024 * 1024
maxTotalBytesintNo100 * 1024 * 1024
allowedExtensionsList<String>Noconst []
allowImageEditingboolNotrue
enabledboolNotrue
doneLabelStringNo'Attach'
motionComponentMotion?Nonull

Future<List<AttachmentPickerItem>?> show

static Future<List<AttachmentPickerItem>?> show({
  required BuildContext context,
  List<AttachmentPickerItem> initialAttachments = const [],
  AttachmentPickerDelegate delegate = const NativeAttachmentPickerDelegate(),
  List<AttachmentPickerSource> sources = AttachmentPickerSource.values,
  int maxAttachments = 10,
  int maxFileBytes = 25 * 1024 * 1024,
  int maxTotalBytes = 100 * 1024 * 1024,
  List<String> allowedExtensions = const [],
  bool allowImageEditing = true,
});

Application Setup

Place components under FluttyApp to provide theme, navigation, localization, and overlay defaults. Use theme tokens for shared appearance settings.

Source

lib/src/widgets/media/attachment_picker/attachment_picker.dart

This reference is generated from the AttachmentPicker declaration in the FluttyUI core checkout. The component catalog lists the other available building blocks.

DartFlutter

Get started with FluttyUI