Bottom Sheet Select
C2CBottomSheetSelect is a custom Flutter widget designed for displaying a bottom sheet that allows users to select an item or multiple items from a provided list. It supports single and multiple selection modes, customizable styles, optional filtering, and various callbacks for handling changes and customizations.
Installation
cpub add c2c_select
or
flutter pub add c2c_select --hosted-url=https://pub.csp.scrum-dev.com
Example Usage
C2CBottomSheetSelect<String>(
items: [
C2CSelectItem(value: "apple", label: "Apple"),
C2CSelectItem(value: "banana", label: "Banana"),
// Add more items
],
onChanged: (selectedValue) {
print("Selected Value: $selectedValue");
},
label: "Select Fruit",
placeholder: "Choose...",
enableFilter: true,
)
Properties
| Property | Description | Type |
|---|---|---|
items | The list of items to select from. | List<C2CSelectItem<T>> |
values | The currently selected values (used in multiple mode). | List<T>? |
textStyle | The text style for the TextField. | TextStyle? |
controller | Controller for the select widget. | C2CBottomSheetSelectController? |
error | Error message or widget to display. | dynamic |
onFocus | Callbacks for focus events. | VoidCallback? |
onBlur | Callbacks for blur events. | VoidCallback? |
enabled | Whether the widget is enabled. | bool |
leftIcon | Icons on the left side of the select box. | Widget? |
rightIcon | Icons on the right side of the select box. | Widget? |
leftIconPadding | Padding for the right icons. | EdgeInsets? |
rightIconPadding | Padding for the right icons. | EdgeInsets? |
scrollPadding | Padding for scrolling. | EdgeInsets? |
label | Label for the select box. | dynamic |
helperText | Helper text below the select box. | dynamic |
isRequired | If true, the field is marked as required. | bool |
labelStyle/asteriskStyle/errorStyle/helperStyle | Styles for label, asterisk, error, and helper text. | TextStyle? |
errorMaxLines | Maximum lines for error text. | int? |
helperMaxLines | Maximum lines for helper text. | int? |
bottomSheetMaxHeight | Max height for the bottom sheet. | double? |
header | Header widget for the bottom sheet. | Widget? |
isExpanded | Expands the bottom sheet to full height if true. | bool |
itemTextStyle | Text style for items in the bottom sheet. | TextStyle? |
bottomSheetBackgroundColor | Background color of the bottom sheet. | Color? |
bottomSheetBorderRadius | Border radius of the bottom sheet. | double? |
enableFilter | Enables a filter text box if true. | bool |
type | Type of selection (single/multiple). | SelectType |
onValueChanged | Callback when the value changes. | ValueChanged<List<T>?>? |
placeholder | Placeholder text for the select box. | String? |
borderRadius | Border radius for the select box. | BorderRadius? |
searchBoxBuilder | Builder for custom search box. | C2CSearchBoxBuilder? |
searchBoxPlaceholder | Placeholder for the search box. | String? |
handleCustom | Custom handler widget. | Widget? |
selectItemBuilder | Builder for custom item rendering. | C2CSelectItemBuilder? |
listController | Controller for the item list. | ScrollController? |
footerBuilder | Builder for custom footer. | Widget Function(BuildContext context, Function() handleSubmit)? |
submitText | Text for the submit button. | String? |
checkboxColor | Color of checkboxes (in multiple mode). | Color? |
itemBackgroundColor | Background colors for items. | Color? |
selectedItemBackgroundColor | Background colors for selected item. | Color? |
submitWhenEmpty | Submits even if no item is selected. | bool |