FSelectTileGroup<T> constructor
FSelectTileGroup<T> ({
- required FSelectGroupController<
T> controller, - required List<
FSelectTile< children,T> > - FTileGroupStyle? style,
- FTileDivider divider = FTileDivider.indented,
- Widget? label,
- Widget? description,
- Widget errorBuilder() = _errorBuilder,
- String? semanticLabel,
- FormFieldSetter<
Set< ? onSaved,T> > - FormFieldValidator<
Set< ? validator,T> > - Set<
T> ? initialValue, - String? forceErrorText,
- bool enabled = true,
- AutovalidateMode? autovalidateMode,
- String? restorationId,
- Key? key,
Creates a FSelectTileGroup.
Implementation
FSelectTileGroup({
required this.controller,
required this.children,
this.style,
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(
style: groupStyle,
divider: divider,
label: label,
enabled: enabled,
description: description,
error: error,
semanticLabel: semanticLabel,
children: [
for (final child in children)
FSelectTileData<T>(
controller: controller,
selected: controller.contains(child.value),
child: child,
),
],
);
},
);