MultiSelectorDialog<T> class
A customizable dialog widget for selecting multiple items with various display options.
This widget provides:
- Checkbox or chip-based selection modes
- Built-in search functionality
- Select All/Deselect All options
- Customizable appearance and behavior
Basic Usage
MultiSelectorDialog<String>(
items: [MultiSelectorItem("1", "Option 1")],
initialValue: ["1"],
onConfirm: (values) => print(values),
)
{@tool snippet} Example with chips and search:
MultiSelectorDialog(
items: items,
initialValue: selectedValues,
useChipsForSelection: true,
searchable: true,
)
{@end-tool}
See also:
- MultiSelectorItem for individual item configuration
- MultiSelectorActions for the underlying selection logic
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatefulWidget
- MultiSelectorDialog
Constructors
-
MultiSelectorDialog({Key? key, required List<
MultiSelectorItem< items, required List<T> >T> initialValue, Widget? title, void onConfirm(List<T> )?, bool searchable = false, Text? confirmText, Text? cancelText, Color? selectedColor, String? searchHint, Color? colorBuilder(T)?, Color? backgroundColor, Color? unselectedColor, Icon? searchIcon, Icon? closeSearchIcon, TextStyle? itemsTextStyle, TextStyle? selectedItemsTextStyle, TextStyle? searchTextStyle, TextStyle? searchHintStyle, bool separateSelectedItems = false, Color? checkColor, double? elevation, ShapeBorder? shape, EdgeInsets? contentPadding, bool showSelectAll = false, String? selectAllText, String? deselectAllText, bool useChipsForSelection = false, double? dialogWidth, double? dialogHeight}) -
Creates a multi-selection dialog
const
Properties
- backgroundColor → Color?
-
Background color of the dialog
final
- cancelText → Text?
-
Custom text for the cancel button
final
- checkColor → Color?
-
Color of the checkbox checkmark
final
- closeSearchIcon → Icon?
-
Custom icon for closing search
final
- colorBuilder → Color? Function(T)?
-
Optional builder for custom per-item colors
final
- confirmText → Text?
-
Custom text for the confirm button
final
- contentPadding → EdgeInsets?
-
Padding around the dialog content
final
- deselectAllText → String?
-
Text for the Deselect All button
final
- dialogHeight → double?
-
Custom height for the dialog
final
- dialogWidth → double?
-
Custom width for the dialog
final
- elevation → double?
-
Elevation of the dialog (defaults to 8)
final
- hashCode → int
-
The hash code for this object.
no setterinherited
-
initialValue
→ List<
T> -
The initially selected values (must match values in items)
final
-
items
→ List<
MultiSelectorItem< T> > -
The list of items available for selection
final
- itemsTextStyle → TextStyle?
-
Text style for unselected items
final
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
-
onConfirm
→ void Function(List<
T> )? -
Callback invoked when selection is confirmed
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- searchable → bool
-
Whether to enable search functionality (defaults to false)
final
- searchHint → String?
-
Hint text displayed in the search field
final
- searchHintStyle → TextStyle?
-
Text style for search hint text
final
- searchIcon → Icon?
-
Custom icon for the search button
final
- searchTextStyle → TextStyle?
-
Text style for search input text
final
- selectAllText → String?
-
Text for the Select All button
final
- selectedColor → Color?
-
The color used for selected items (defaults to theme primary color)
final
- selectedItemsTextStyle → TextStyle?
-
Text style for selected items
final
- separateSelectedItems → bool
-
Whether to group selected items separately (defaults to false)
final
- shape → ShapeBorder?
-
Custom shape for the dialog
final
- showSelectAll → bool
-
Whether to show Select All/Deselect All button (defaults to false)
final
- title → Widget?
-
Optional title widget displayed at the top of the dialog
final
- unselectedColor → Color?
-
Color for unselected items (defaults to theme unselected color)
final
- useChipsForSelection → bool
-
Whether to use chips instead of checkboxes (defaults to false)
final
Methods
-
createElement(
) → StatefulElement -
Creates a StatefulElement to manage this widget's location in the tree.
inherited
-
createState(
) → State< MultiSelectorDialog< T> > -
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