build method
- @override
- BuildContext context,
- FooterViewModel model
override
Builds the UI according to the state in model.
Implementation
@override
Widget build(BuildContext context, FooterViewModel model) => Row(
mainAxisSize: MainAxisSize.min,
children: [
const ControllerMenu(),
SerialButton(),
IconButton(
tooltip: model.batteryMessage,
onPressed: null,
icon: Icon(
model.isConnected
? getBatteryIcon(model.batteryPercentage)
: Icons.battery_unknown,
color: model.isConnected
? getColor(model.batteryPercentage)
: Colors.black,
),
),
PopupMenuButton(
// rover mode
tooltip: "Change mode",
onSelected: (input) => changeMode(context, input),
icon: Icon(
getStatusIcon(model.status),
color: getStatusColor(model.status),
),
itemBuilder: (_) => [
for (final value in RoverStatus.values)
if (value != RoverStatus.DISCONNECTED) // can't select this!
PopupMenuItem(value: value, child: Text(value.humanName)),
],
),
NetworkStatusIcon(
// network icon
device: Device.SUBSYSTEMS,
tooltip: "${model.connectionSummary}\nClick to reset",
onPressed: model.resetNetwork,
),
IconButton(
// LED strip
icon: Icon(
Icons.circle,
color: model.isConnected ? getLedColor(model.ledColor) : Colors.black,
),
onPressed: () => showDialog<void>(
context: context,
builder: (_) => ColorEditor(ColorBuilder()),
),
tooltip: "Change LED strip",
),
const SizedBox(width: 4),
],
);