FSelectTileGroup<T> constructor

FSelectTileGroup<T>({
  1. required FSelectGroupController<T> groupController,
  2. required List<FSelectTile<T>> children,
  3. ScrollController? scrollController,
  4. FTileGroupStyle? style,
  5. double? cacheExtent,
  6. double maxHeight = double.infinity,
  7. DragStartBehavior dragStartBehavior = DragStartBehavior.start,
  8. FTileDivider divider = FTileDivider.indented,
  9. Widget? label,
  10. Widget? description,
  11. Widget errorBuilder(
    1. BuildContext,
    2. String
    ) = _errorBuilder,
  12. String? semanticLabel,
  13. FormFieldSetter<Set<T>>? onSaved,
  14. FormFieldValidator<Set<T>>? validator,
  15. Set<T>? initialValue,
  16. String? forceErrorText,
  17. bool enabled = true,
  18. AutovalidateMode? autovalidateMode,
  19. String? restorationId,
  20. Key? key,
})

Creates a FSelectTileGroup.

Implementation

FSelectTileGroup({
  required this.groupController,
  required List<FSelectTile<T>> children,
  this.scrollController,
  this.style,
  this.cacheExtent,
  this.maxHeight = double.infinity,
  this.dragStartBehavior = DragStartBehavior.start,
  this.divider = FTileDivider.indented,
  this.label,
  this.description,
  this.errorBuilder = _errorBuilder,
  this.semanticLabel,
  super.onSaved,
  super.validator,
  super.initialValue,
  super.forceErrorText,
  super.enabled = true,
  super.autovalidateMode,
  super.restorationId,
  super.key,
}) : super(
        builder: (field) {
          final state = field as _State;
          final groupStyle = style ?? state.context.theme.tileGroupStyle;
          final (labelState, error) = switch (state.errorText) {
            _ when !enabled => (FLabelState.disabled, null),
            final text? => (FLabelState.error, errorBuilder(state.context, text)),
            null => (FLabelState.enabled, null),
          };

          return FTileGroup(
            controller: scrollController,
            style: groupStyle,
            cacheExtent: cacheExtent,
            maxHeight: maxHeight,
            dragStartBehavior: dragStartBehavior,
            divider: divider,
            label: label,
            enabled: enabled,
            description: description,
            error: error,
            semanticLabel: semanticLabel,
            children: [
              for (final child in children)
                FSelectTileData<T>(
                  controller: groupController,
                  selected: groupController.contains(child.value),
                  child: child,
                ),
            ],
          );
        },
      );