build method

  1. @override
Widget build(
  1. BuildContext context,
  2. GpsBuilder model
)
override

Builds the UI according to the state in model.

Implementation

@override
Widget build(BuildContext context, GpsBuilder model) => Column(
  crossAxisAlignment: CrossAxisAlignment.start,
  children: [
    DropdownEditor(
      name: "Type",
      value: model.type,
      onChanged: model.updateType,
      items: GpsType.values,
      humanName: (type) => type.humanName,
    ),
    const SizedBox(width: 12),
    if (model.type == GpsType.degrees) ...[
      const Text("Longitude:"),
      SizedBox(
        width: 240,
        child: NumberEditor(
          name: "Degrees",
          width: 12,
          titleFlex: 1,
          model: model.longDegrees,
        ),
      ),
      SizedBox(
        width: 240,
        child: NumberEditor(
          name: "Minutes",
          width: 12,
          titleFlex: 1,
          model: model.longMinutes,
        ),
      ),
      SizedBox(
        width: 240,
        child: NumberEditor(
          name: "Seconds",
          width: 12,
          titleFlex: 1,
          model: model.longSeconds,
        ),
      ),
      const Text("Latitude:"),
      SizedBox(
        width: 240,
        child: NumberEditor(
          name: "Degrees",
          width: 12,
          titleFlex: 1,
          model: model.latDegrees,
        ),
      ),
      SizedBox(
        width: 240,
        child: NumberEditor(
          name: "Minutes",
          width: 12,
          titleFlex: 1,
          model: model.latMinutes,
        ),
      ),
      SizedBox(
        width: 240,
        child: NumberEditor(
          name: "Seconds",
          width: 12,
          titleFlex: 1,
          model: model.latSeconds,
        ),
      ),
    ] else ...[
      SizedBox(
        width: 240,
        child: NumberEditor(
          name: "Longitude",
          width: 0,
          titleFlex: 1,
          model: model.longDecimal,
        ),
      ),
      SizedBox(
        width: 240,
        child: NumberEditor(
          name: "Latitude",
          width: 0,
          titleFlex: 1,
          model: model.latDecimal,
        ),
      ),
    ],
  ],
);