build method
- @override
- BuildContext context,
- Controller model
override
Builds the UI according to the state in model.
Implementation
@override
Widget build(BuildContext context, Controller model) => ValueListenableBuilder(
valueListenable: models.rover.status,
builder: (context, status, _) => IconButton(
icon: Stack(
children: [
const SizedBox(height: 32),
const Icon(Icons.sports_esports),
Positioned(
bottom: 0,
right: 8,
child: Text(
"${model.index + 1}",
style: TextStyle(
fontSize: 12,
color: context.colorScheme.onSurface,
fontWeight: FontWeight.bold,
),
),
),
],
),
color: isDisabled(status) || !model.isConnected
? context.colorScheme.onSurface
: getColor(model.gamepad.batteryLevel),
onPressed: model.connect,
),
);