SingleValuePickerDialog<T> constructor
SingleValuePickerDialog<T> ({
- String? title,
- Widget? titleWidget,
- TextStyle? titleStyle,
- Color? titleBackgroundColor,
- required List<
T> items, - required Widget itemBuilder(
- BuildContext context,
- T value,
- int index
- DialogButton? dialogButton,
- bool barrierDismissible = true,
- bool showCloseIcon = false,
- double elevation = 10.0,
- double? dialogWidth,
- double? dialogHeight,
- double titleHeight = 60.0,
- double dialogBorderRadius = 4.0,
Creates a SingleValuePickerDialog instance with the specified parameters.
This constructor allows you to create a new SingleValuePickerDialog 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, dialogButton, barrierDismissible,
showCloseIcon, elevation, dialogWidth, dialogHeight, titleHeight,
and dialogBorderRadius.
Example:
var singleValuePickerDialog = SingleValuePickerDialog<String>(
title: 'Select Item',
items: ['Item 1', 'Item 2', 'Item 3'],
itemBuilder: (context, value) => Text(value),
// ... other parameters ...
);
Implementation
SingleValuePickerDialog({
this.title,
this.titleWidget,
this.titleStyle,
this.titleBackgroundColor,
required this.items,
required this.itemBuilder,
this.dialogButton,
this.barrierDismissible = true,
this.showCloseIcon = false,
this.elevation = 10.0,
this.dialogWidth,
this.dialogHeight,
this.titleHeight = 60.0,
this.dialogBorderRadius = 4.0,
}) : assert(
(titleWidget == null ||
(title == null &&
titleBackgroundColor == null &&
!showCloseIcon &&
titleStyle == null)),
"if titleWidget is provided,"
" then title, titleBackgroundColor, showCloseIcon, titleStyle should not be provided",
);