diff options
Diffstat (limited to 'lib/ui.dart')
| -rw-r--r-- | lib/ui.dart | 46 |
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), + ); + }, + ); + }, ); } } |
