build method

  1. @override
Widget build(
  1. BuildContext context,
  2. NumberBuilder<num> model
)
override

Builds the UI according to the state in model.

Implementation

@override
Widget build(BuildContext context, NumberBuilder model) => Row(
    mainAxisSize: MainAxisSize.min,
    children: [
      Expanded(
        flex: titleFlex,
        child: subtitle == null ? ListTile(title: Text(name)) : ListTile(
          title: Text(name),
          subtitle: Text(subtitle!),
        ),
      ),
      if (width == null) const Spacer()
      else SizedBox(width: width),
      Expanded(child: TextField(
        onChanged: model.update,
        decoration: InputDecoration(errorText: model.error),
        controller: model.controller,
        inputFormatters: [FilteringTextInputFormatter.allow(RegExp(r"\d|\.|-"))],
      ),),
    ],
);