buildInputWidget method

  1. @override
Widget buildInputWidget(
  1. BuildContext context,
  2. InputChanged onChanged,
  3. Map<String, InputValue> values
)
override

Implementation

@override
Widget buildInputWidget(
  BuildContext context,
  InputChanged onChanged,
  Map<String, InputValue> values,
) {
  final controller = values[id]?.controller;
  assert(
    controller != null && controller is TextEditingController,
    'Controller for $id is not a TextEditingController',
  );

  evaluateConditions(
    values: values,
    onChanged: onChanged,
  );

  _validator = _validator ?? ListValidator(items: options);

  return TextInput(
    labelText: labelText,
    fixedHeight: true,
    isRequired: isRequired,
    enabled: isEnabled,
    controller: controller as TextEditingController,
    validator: _validator,
    options: options
        .map(
          (e) => DropdownListItem(
            id: e,
          ),
        )
        .toList(),
    onChanged: (value) {
      onChanged(
        id,
        isValid(value),
        value,
      );
    },
  );
}