Selectable<T> constructor

Selectable<T>({
  1. Key? key,
  2. required List<T> parentList,
  3. required List childList(
    1. T model
    ),
  4. required BuilderSelect builder,
  5. required dynamic onSelect(
    1. int id,
    2. bool isSelect
    ),
  6. required BuilderInnerSelect childBuilder,
  7. required List<int> selectedList,
  8. Widget? icon,
  9. Widget? closeButton,
  10. double? mainAxisExtent,
  11. ImageFilter? imageFilter,
  12. Color? backgroundColor,
  13. EdgeInsets? headerPadding,
  14. double? crossAxisSpacing,
  15. double? mainAxisSpacing,
  16. double? childAspectRatio,
  17. double? maxCrossAxisExtent,
  18. 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);