summaryrefslogtreecommitdiff
path: root/lib/ui.dart
diff options
context:
space:
mode:
Diffstat (limited to 'lib/ui.dart')
-rw-r--r--lib/ui.dart26
1 files changed, 15 insertions, 11 deletions
diff --git a/lib/ui.dart b/lib/ui.dart
index e14895b..7a97f32 100644
--- a/lib/ui.dart
+++ b/lib/ui.dart
@@ -98,18 +98,22 @@ class ConnectionStatus extends StatelessWidget {
return SafeArea(
child: Consumer<AppState>(
builder: (BuildContext context, AppState state, Widget? child) {
- Icon icon;
- Text text;
+ Icon icon = const Icon(Icons.cloud_off, color: Colors.grey);
+ Text text = const Text('Disconnected');
- if (state.brokerConnected && state.serverConnected) {
- icon = const Icon(Icons.cloud, color: Colors.green);
- text = const Text('Connected');
- } else if (state.brokerConnected && !state.serverConnected) {
- icon = const Icon(Icons.cloud_off, color: Colors.orange);
- text = const Text('Connection issue');
- } else {
- icon = const Icon(Icons.cloud_off, color: Colors.red);
- text = const Text('Disconnected');
+ switch (state.state) {
+ case MachineState.init:
+ icon = const Icon(Icons.cloud_off, color: Colors.grey);
+ text = const Text('Off');
+ case MachineState.disconnected:
+ icon = const Icon(Icons.cloud_off, color: Colors.red);
+ text = const Text('Disconnected');
+ case MachineState.unreachable:
+ icon = const Icon(Icons.cloud_off, color: Colors.orange);
+ text = const Text('Unreachable');
+ case MachineState.reachable:
+ icon = const Icon(Icons.cloud, color: Colors.green);
+ text = const Text('Connected');
}
MachineEvent event = MachineEvent.disconnect;