Selectable<T> constructor
Selectable<T> ({
- Key? key,
- required List<
T> parentList, - required List childList(
- T model
- required BuilderSelect builder,
- required dynamic onSelect(),
- required BuilderInnerSelect childBuilder,
- required List<
int> selectedList, - Widget? icon,
- Widget? closeButton,
- double? mainAxisExtent,
- ImageFilter? imageFilter,
- Color? backgroundColor,
- EdgeInsets? headerPadding,
- double? crossAxisSpacing,
- double? mainAxisSpacing,
- double? childAspectRatio,
- double? maxCrossAxisExtent,
- int? crossAxisCount,
You must define a model required for multiple selection
This model can be any way you want.
The only thing required is to have a variable in this model that can tell if it is selected or not.
this variable must be id
. You can define a Map or create an Object.
If you have created a map, don't forget to add {"id" : "--"}
in it
If this variable is not found, the widget returns an error.
Implementation
Selectable({
Key? key,
required this.parentList,
required this.childList,
required this.builder,
required this.onSelect,
required this.childBuilder,
required this.selectedList,
this.icon,
this.closeButton,
this.mainAxisExtent,
ImageFilter? imageFilter,
Color? backgroundColor,
EdgeInsets? headerPadding,
double? crossAxisSpacing,
double? mainAxisSpacing,
double? childAspectRatio,
double? maxCrossAxisExtent,
int? crossAxisCount,
}) : imageFilter = imageFilter ?? ImageFilter.blur(sigmaX: 4.0, sigmaY: 4.0),
backgroundColor = backgroundColor ?? Colors.black.withOpacity(.65),
padding = headerPadding ?? const EdgeInsets.all(10.0),
crossAxisSpacing = crossAxisSpacing ?? 5.0,
mainAxisSpacing = mainAxisSpacing ?? 4.0,
childAspectRatio = childAspectRatio ?? (1 / 1),
crossAxisCount = crossAxisCount ?? 2,
super(key: key);