summaryrefslogtreecommitdiff
path: root/lib/ui.dart
diff options
context:
space:
mode:
authorxengineering <me@xengineering.eu>2026-03-07 11:13:26 +0100
committerxengineering <me@xengineering.eu>2026-03-07 11:14:34 +0100
commitb6f6dc481606d0ffb8c06ffb549cb0221b0c6167 (patch)
tree2c6013843bfc62bfeb20da6b48b9aae5d727c17f /lib/ui.dart
parent6cb5a471a1bb18de802006c1017839c00d1871ad (diff)
downloadsia-app-b6f6dc481606d0ffb8c06ffb549cb0221b0c6167.tar
sia-app-b6f6dc481606d0ffb8c06ffb549cb0221b0c6167.tar.zst
sia-app-b6f6dc481606d0ffb8c06ffb549cb0221b0c6167.zip
Make ConnectionStatus a SafeArea by default
This removes the need to write a SafeArea on each use of ConnectionStatus and replaces it by exactly one occurrence.
Diffstat (limited to 'lib/ui.dart')
-rw-r--r--lib/ui.dart42
1 files changed, 20 insertions, 22 deletions
diff --git a/lib/ui.dart b/lib/ui.dart
index e7c0234..20df8f5 100644
--- a/lib/ui.dart
+++ b/lib/ui.dart
@@ -41,9 +41,7 @@ class ConnectionPage extends StatelessWidget {
),
),
),
- bottomNavigationBar: const SafeArea(
- child: ConnectionStatus(),
- ),
+ bottomNavigationBar: const ConnectionStatus(),
);
}
}
@@ -60,9 +58,7 @@ class DevicesPage extends StatelessWidget {
Expanded(child: ContactList()),
],
),
- bottomNavigationBar: const SafeArea(
- child: ConnectionStatus(),
- ),
+ bottomNavigationBar: const ConnectionStatus(),
);
}
}
@@ -99,24 +95,26 @@ class ConnectionStatus extends StatelessWidget {
@override
Widget build(BuildContext context) {
- return Consumer<AppState>(
- builder: (BuildContext context, AppState state, Widget? child) {
- Icon icon;
- Text text;
+ return SafeArea(
+ child: Consumer<AppState>(
+ builder: (BuildContext context, AppState state, Widget? child) {
+ Icon icon;
+ Text text;
- 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');
- }
+ 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');
+ }
- return ListTile(leading: icon, title: text);
- },
+ return ListTile(leading: icon, title: text);
+ },
+ ),
);
}
}