From b6f6dc481606d0ffb8c06ffb549cb0221b0c6167 Mon Sep 17 00:00:00 2001 From: xengineering Date: Sat, 7 Mar 2026 11:13:26 +0100 Subject: 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. --- lib/ui.dart | 42 ++++++++++++++++++++---------------------- 1 file changed, 20 insertions(+), 22 deletions(-) (limited to 'lib/ui.dart') 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( - builder: (BuildContext context, AppState state, Widget? child) { - Icon icon; - Text text; + return SafeArea( + child: Consumer( + 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); + }, + ), ); } } -- cgit v1.3