build method
- @override
- BuildContext context,
- SerialModel model
override
Builds the UI according to the state in model
.
Implementation
@override
Widget build(BuildContext context, SerialModel model) => PopupMenuButton(
icon: Icon(
Icons.usb,
color: model.hasDevice ? Colors.green : context.colorScheme.onSecondary,
),
tooltip: "Select device",
onSelected: model.toggle,
itemBuilder: (_) => [
for (final String port in DelegateSerialPort.allPorts) PopupMenuItem(
value: port,
child: ListTile(
title: Text(port),
leading: model.isConnected(port) ? const Icon(Icons.check) : null,
),
),
],
);