summaryrefslogtreecommitdiff
path: root/lib/ui.dart
diff options
context:
space:
mode:
authorxengineering <me@xengineering.eu>2026-01-16 21:19:16 +0100
committerxengineering <me@xengineering.eu>2026-01-16 21:19:16 +0100
commite2a1b271e2cf417cd3104e6e0679cb54993e6d8f (patch)
tree7758484c6ad0514ff63e0efd0c6b54dac8ded1aa /lib/ui.dart
parentae6b85d25cc07ba972f550152a003fe9f9a4951f (diff)
downloadsia-app-e2a1b271e2cf417cd3104e6e0679cb54993e6d8f.tar
sia-app-e2a1b271e2cf417cd3104e6e0679cb54993e6d8f.tar.zst
sia-app-e2a1b271e2cf417cd3104e6e0679cb54993e6d8f.zip
Move Scaffold up to UI class
That balances the scopes of UI and ContactList better and allows to add more Widgets on the UI level.
Diffstat (limited to 'lib/ui.dart')
-rw-r--r--lib/ui.dart46
1 files changed, 23 insertions, 23 deletions
diff --git a/lib/ui.dart b/lib/ui.dart
index 4a513c6..ff8c3a8 100644
--- a/lib/ui.dart
+++ b/lib/ui.dart
@@ -8,8 +8,11 @@ class UI extends StatelessWidget {
@override
Widget build(BuildContext context) {
- return const MaterialApp(
- home: ContactList(),
+ return MaterialApp(
+ home: Scaffold(
+ appBar: AppBar(title: const Text("Contacts")),
+ body: const ContactList(),
+ ),
);
}
}
@@ -19,27 +22,24 @@ class ContactList extends StatelessWidget {
@override
Widget build(BuildContext context) {
- return Scaffold(
- appBar: AppBar(title: const Text("Contacts")),
- body: Consumer<AppState>(
- builder: (BuildContext context, AppState state, Widget? child) {
- return ListView.builder(
- itemCount: state.contacts.length,
- itemBuilder: (BuildContext context, int index) {
- MapEntry<String, bool> data = state.contacts.entries.elementAt(index);
- String address = data.key;
- bool isOpen = data.value;
- return ListTile(
- leading: Icon(
- isOpen ? Icons.meeting_room : Icons.door_front_door,
- color: isOpen ? Colors.red : Colors.green,
- ),
- title: Text(address),
- );
- },
- );
- },
- ),
+ return Consumer<AppState>(
+ builder: (BuildContext context, AppState state, Widget? child) {
+ return ListView.builder(
+ itemCount: state.contacts.length,
+ itemBuilder: (BuildContext context, int index) {
+ MapEntry<String, bool> data = state.contacts.entries.elementAt(index);
+ String address = data.key;
+ bool isOpen = data.value;
+ return ListTile(
+ leading: Icon(
+ isOpen ? Icons.meeting_room : Icons.door_front_door,
+ color: isOpen ? Colors.red : Colors.green,
+ ),
+ title: Text(address),
+ );
+ },
+ );
+ },
);
}
}