build method

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

Builds the UI according to the state in model.

Implementation

@override
Widget build(BuildContext context, LogsOptionsViewModel model) => Column(
  children: [
    Row(
      mainAxisAlignment: MainAxisAlignment.center,
      children: [
        for (final device in _devices) SizedBox(
          width: 250,
          child: Card(
            child: Column(
              children: [
                ListTile(
                  onTap: () => model.resetDevice(device),
                  leading: const Icon(Icons.restart_alt),
                  title: Text("Reset ${device.humanName}"),
                  subtitle: const Text("The device will reboot"),
                ),
                Padding(
                  padding: const EdgeInsets.all(4),
                  child: Row(
                    mainAxisAlignment: MainAxisAlignment.spaceEvenly,
                    children: [
                      Icon(Icons.circle, color: getStatusColor(device)),
                      NetworkStatusIcon(
                        device: device,
                        tooltip: "Ping Device",
                        onPressed: Platform.isWindows ? () => model.ping(device) : null,
                      ),
                      sshButton(device) ?? Container(),
                    ],
                  ),
                ),
              ],
            ),
          ),
        ),
      ],
    ),
    Row(
      mainAxisAlignment: MainAxisAlignment.center,
      children: [
        DropdownMenu<Device?>(
          label: const Text("Select Device"),
          initialSelection: model.deviceFilter,
          onSelected: model.setDeviceFilter,
          dropdownMenuEntries: [
            for (final device in [Device.SUBSYSTEMS, Device.VIDEO, Device.AUTONOMY, Device.DASHBOARD, null])
              DropdownMenuEntry(label: device?.humanName ?? "All", value: device),
          ],
        ),
        const SizedBox(width: 8),
        DropdownMenu<BurtLogLevel>(
          label: const Text("Select Severity"),
          initialSelection: model.levelFilter,
          onSelected: model.setLevelFilter,
          dropdownMenuEntries: [
            for (final level in BurtLogLevel.values.filtered)
              DropdownMenuEntry(label: level.humanName, value: level),
          ],
        ),
        const SizedBox(width: 8),
        SizedBox(
          width: 250,
          child: CheckboxListTile(
            title: const Text("Autoscroll"),
            subtitle: const Text("Scroll to override"),
            value: model.autoscroll,
            onChanged: model.setAutoscroll,
          ),
        ),
        const SizedBox(width: 8),
        IconButton(
          onPressed: model.togglePause,
          icon: Icon((model.paused) ? Icons.play_arrow : Icons.pause),
        ),
      ],
    ),
  ],
);