ZetaSelectInput<T> constructor
- Key? key,
- bool? rounded,
- FormFieldValidator<
T> ? validator, - ValueChanged<
T?> ? onFieldSubmitted, - AutovalidateMode? autovalidateMode,
- FormFieldSetter<
T> ? onSaved, - bool disabled = false,
- T? initialValue,
- ValueChanged<
T?> ? onChange, - ZetaFormFieldRequirement? requirementLevel,
- required List<
ZetaDropdownItem< items,T> > - ValueSetter<
String> ? onTextChanged, - ZetaWidgetSize size = ZetaWidgetSize.medium,
- String? label,
- String? hintText,
- Widget? prefix,
- String? placeholder,
- String? errorText,
- String? dropdownSemantics,
Constructor of ZetaSelectInput
Implementation
ZetaSelectInput({
super.key,
bool? rounded,
super.validator,
super.onFieldSubmitted,
super.autovalidateMode,
super.onSaved,
super.disabled = false,
super.initialValue,
super.onChange,
super.requirementLevel,
required this.items,
this.onTextChanged,
this.size = ZetaWidgetSize.medium,
this.label,
this.hintText,
this.prefix,
this.placeholder,
this.errorText,
this.dropdownSemantics,
}) : super(
builder: (field) {
final _ZetaSelectInputState<T> state = field as _ZetaSelectInputState<T>;
final colors = Zeta.of(field.context).colors;
return ZetaRoundedScope(
rounded: rounded ?? field.context.rounded,
child: ZetaDropdown<T>(
disableButtonSemantics: true,
items: state.currentItems,
onChange: !disabled ? state.setItem : null,
key: state.dropdownKey,
value: state._selectedItem?.value,
offset: Offset(0, Zeta.of(field.context).spacing.xl * -1),
onDismissed: state.onDropdownDismissed,
builder: (context, _, controller) {
return InternalTextInput(
size: size,
requirementLevel: requirementLevel,
disabled: disabled,
controller: state.inputController,
focusNode: state.inputFocusNode,
prefix: state._selectedItem?.icon ?? prefix,
label: label,
onSubmit: (_) {
state.onInputSubmitted(controller);
onFieldSubmitted?.call(state._selectedItem?.value);
},
errorText: field.errorText ?? errorText,
placeholder: placeholder,
hintText: hintText,
onChange: (val) => state.onInputChanged(controller),
suffix: InputIconButton(
semanticLabel: dropdownSemantics,
icon: controller.isOpen ? ZetaIcons.expand_less : ZetaIcons.expand_more,
disabled: disabled,
size: size,
color: colors.iconSubtle,
onTap: () => state.onIconTapped(controller),
),
);
},
),
);
},
);