MultiValuePickerDialog<T> constructor
MultiValuePickerDialog<T> ({
- String? title,
- Widget? titleWidget,
- TextStyle? titleStyle,
- Color? titleBackgroundColor,
- required List<
T> items, - required Widget itemBuilder(
- BuildContext context,
- T value,
- int index
- Widget selectedItemBuilder(
- BuildContext context,
- T value,
- int index
- List<
T> ? initialSelectedItems, - DialogButton? dialogButton,
- bool initiallyMultiSelectAllItems = false,
- MultiDialogSelectionType selectionType = MultiDialogSelectionType.checkboxTap,
- double elevation = 10.0,
- double? dialogWidth,
- double? dialogHeight,
- double titleHeight = 60.0,
- double dialogBorderRadius = 4.0,
- bool showSelectedTextWidget = true,
- TextStyle? selectedTextStyle,
- Widget selectedTextBuilder(
- List<
T> ? value
- List<
Creates a MultiValuePickerDialog instance with the specified parameters.
This constructor allows you to create a new MultiValuePickerDialog instance with
the required and optional parameters. You can customize the appearance and behavior
of the dialog by providing values for title, titleWidget, titleStyle,
titleBackgroundColor, items, itemBuilder, selectedItemBuilder, initialSelectedItems,
dialogButton, initiallyMultiSelectAllItems, selectionType, elevation, dialogWidth,
dialogHeight, titleHeight, dialogBorderRadius, showSelectedTextWidget,
selectedTextStyle, and selectedTextBuilder.
Example:
var multiSelectableDialog = MultiSelectableDialog<String>(
title: 'Select Items',
items: ['Item 1', 'Item 2', 'Item 3'],
itemBuilder: (context, value) => Text(value),
// ... other parameters ...
);
Implementation
MultiValuePickerDialog({
this.title,
this.titleWidget,
this.titleStyle,
this.titleBackgroundColor,
required this.items,
required this.itemBuilder,
this.selectedItemBuilder,
this.initialSelectedItems,
this.dialogButton,
this.initiallyMultiSelectAllItems = false,
this.selectionType = MultiDialogSelectionType.checkboxTap,
this.elevation = 10.0,
this.dialogWidth,
this.dialogHeight,
this.titleHeight = 60.0,
this.dialogBorderRadius = 4.0,
this.showSelectedTextWidget = true,
this.selectedTextStyle,
this.selectedTextBuilder,
}) : assert(
!(initiallyMultiSelectAllItems && initialSelectedItems != null),
"Either 'initiallyMultiSelectAllItems' or 'initialSelectedItems' should be provided.",
),
assert(
(selectionType != MultiDialogSelectionType.itemTap ||
selectedItemBuilder != null),
"If selectionType is '[MultiDialogSelectionType.itemTap]',"
" 'selectedItemBuilder' should be implemented to differentiate the selected and un-selected items",
),
assert(
((initialSelectedItems?.length ?? 0) <= items.length),
"[initialSelectedItems] should be a sublist of [items]."
" No strange values should be provided inside initialSelectedItems",
);