ScrollPickerFormField<T> constructor
Implementation
ScrollPickerFormField({
required List<T> values,
required ScrollPickerDecoration decoration,
required FormFieldSetter<T> super.onSaved,
required String Function(T) childToString,
int? initialIndex,
void Function(T value)? onChanged,
super.key,
}) : super(
initialValue: values[initialIndex ?? (values.length / 2).floor()],
builder: (FormFieldState<T> state) => ScrollPicker(
list: values.map((e) => childToString(e)).toList(),
decoration: decoration,
initialIndex: initialIndex,
onChanged: (int index) {
onChanged?.call(values[index]);
state.didChange(values[index]);
},
),
);