toWidget method

  1. @override
Widget toWidget(
  1. BuildContext context,
  2. String group,
  3. Duration? value
)
override

Builds the current field into a Widget to be used for input in the side panel.

Implementation

@override
Widget toWidget(
  BuildContext context,
  String group,
  Duration? value,
) {
  return TextFormField(
    initialValue: codec.toParam(value ?? initialValue ?? defaultDuration),
    keyboardType: TextInputType.number,
    decoration: const InputDecoration(
      suffix: Text('ms'),
    ),
    onChanged: (value) => updateField(
      context,
      group,
      codec.toValue(value) ?? initialValue ?? defaultDuration,
    ),
  );
}