From 2484560cedc58c216e3244ef61266b73ad8e5ba0 Mon Sep 17 00:00:00 2001 From: Chaoscaot Date: Fri, 27 Jan 2023 15:51:34 +0100 Subject: [PATCH] Updating some more UI --- lib/src/dialogs/create_event_dialog.dart | 2 +- .../event/components/dialogs/add_fight.dart | 4 +- .../screens/event/components/fight_list.dart | 6 +- .../event/components/loaded_event.dart | 1 + lib/src/screens/event/event.dart | 4 +- lib/src/screens/home/home.dart | 85 ++++++++++--------- lib/src/screens/home/lists/events_list.dart | 20 +++-- 7 files changed, 66 insertions(+), 56 deletions(-) diff --git a/lib/src/dialogs/create_event_dialog.dart b/lib/src/dialogs/create_event_dialog.dart index 49a1f4f..8a22a80 100644 --- a/lib/src/dialogs/create_event_dialog.dart +++ b/lib/src/dialogs/create_event_dialog.dart @@ -82,7 +82,7 @@ class CreateEventDialog extends HookConsumerWidget { style: TextStyle(color: Colors.red), ), ), - TextButton( + FilledButton( onPressed: () async { final event = await ref.read(eventRepositoryProvider.future).then( (value) => value.createEvent( diff --git a/lib/src/screens/event/components/dialogs/add_fight.dart b/lib/src/screens/event/components/dialogs/add_fight.dart index 37dc404..4ccb08d 100644 --- a/lib/src/screens/event/components/dialogs/add_fight.dart +++ b/lib/src/screens/event/components/dialogs/add_fight.dart @@ -136,12 +136,12 @@ class AddFightDialog extends HookConsumerWidget { ], ), actions: [ - TextButton( + ElevatedButton( onPressed: () { Navigator.of(context).pop(); }, child: const Text("Cancel")), - TextButton( + FilledButton( onPressed: canCreate ? () async { final nav = Navigator.of(context); diff --git a/lib/src/screens/event/components/fight_list.dart b/lib/src/screens/event/components/fight_list.dart index 3ae5667..ac4b33c 100644 --- a/lib/src/screens/event/components/fight_list.dart +++ b/lib/src/screens/event/components/fight_list.dart @@ -131,13 +131,13 @@ class EventFightList extends HookConsumerWidget { ], ), actions: [ - TextButton( + ElevatedButton( onPressed: () { Navigator.of(context).pop(); }, child: const Text("Cancel"), ), - ElevatedButton( + FilledButton( onPressed: () async { final selectedFights = fights.value .where((element) => selected.value @@ -285,7 +285,7 @@ class EventFightList extends HookConsumerWidget { ], ), const Spacer(), - FloatingActionButton.extended( + FilledButton.icon( onPressed: () { showDialog( context: context, diff --git a/lib/src/screens/event/components/loaded_event.dart b/lib/src/screens/event/components/loaded_event.dart index e699c82..4e2f4cc 100644 --- a/lib/src/screens/event/components/loaded_event.dart +++ b/lib/src/screens/event/components/loaded_event.dart @@ -125,6 +125,7 @@ class LoadedEventScreen extends HookConsumerWidget { final accepted = await showDialog( context: context, builder: (context) => AlertDialog( + icon: const Icon(Icons.warning), title: const Text("Unsaved changes"), content: const Text( "You have unsaved changes. Do you want to discard them?"), diff --git a/lib/src/screens/event/event.dart b/lib/src/screens/event/event.dart index dcb4f43..d1b5e84 100644 --- a/lib/src/screens/event/event.dart +++ b/lib/src/screens/event/event.dart @@ -60,9 +60,7 @@ class EditEventScreen extends HookConsumerWidget { appBar: AppBar( title: const Text('Loading'), ), - body: const Center( - child: CircularProgressIndicator(), - ), + body: const LinearProgressIndicator(), ); } final eventData = snapshot.data as EventExtended; diff --git a/lib/src/screens/home/home.dart b/lib/src/screens/home/home.dart index cc06e60..df5cc1e 100644 --- a/lib/src/screens/home/home.dart +++ b/lib/src/screens/home/home.dart @@ -52,9 +52,43 @@ class HomeScreen extends HookConsumerWidget { final navRailIndex = useState(0); return Scaffold( + drawer: NavigationDrawer( + selectedIndex: navRailIndex.value, + onDestinationSelected: (index) { + if (index == 2) { + context.go('/settings'); + return; + } + navRailIndex.value = index; + }, + children: [ + Padding( + padding: const EdgeInsets.fromLTRB(28, 16, 16, 10), + child: Text( + 'SteamWar', + style: Theme.of(context).textTheme.titleSmall, + ), + ), + const NavigationDrawerDestination( + icon: Icon(Icons.calendar_today_outlined), + label: Text("Events"), + selectedIcon: Icon(Icons.calendar_today), + ), + const NavigationDrawerDestination( + icon: Icon(Icons.developer_mode_outlined), + label: Text("Mods"), + selectedIcon: Icon(Icons.developer_mode), + ), + const Spacer(), + const NavigationDrawerDestination( + icon: Icon(Icons.settings_outlined), + label: Text("Settings"), + selectedIcon: Icon(Icons.settings), + ), + ], + ), appBar: AppBar( title: const Text('Home'), - automaticallyImplyLeading: false, actions: [ IconButton( onPressed: () { @@ -95,44 +129,17 @@ class HomeScreen extends HookConsumerWidget { ), ], ), - body: Row( - children: [ - NavigationRail( - elevation: 1, - destinations: const [ - NavigationRailDestination( - icon: Icon(Icons.calendar_today), - label: Text('Events'), - ), - NavigationRailDestination( - icon: Icon(Icons.developer_mode), - label: Text('Mods'), - ), - ], - labelType: NavigationRailLabelType.selected, - trailing: IconButton( - icon: const Icon(Icons.person), - onPressed: () { - context.go('/settings'); - }, - ), - selectedIndex: navRailIndex.value, - onDestinationSelected: (index) { - navRailIndex.value = index; - }, - ), - Expanded( - child: IndexedStack( - index: navRailIndex.value, - children: const [ - //ServerListComponent(), - EventListComponent(), - Placeholder(), - //ModListComponent(), - ], - ), - ), - ], + body: Padding( + padding: const EdgeInsets.all(8.0), + child: IndexedStack( + index: navRailIndex.value, + children: const [ + //ServerListComponent(), + EventListComponent(), + Placeholder(), + //ModListComponent(), + ], + ), ), ); } diff --git a/lib/src/screens/home/lists/events_list.dart b/lib/src/screens/home/lists/events_list.dart index c774e8b..e907dce 100644 --- a/lib/src/screens/home/lists/events_list.dart +++ b/lib/src/screens/home/lists/events_list.dart @@ -39,14 +39,18 @@ class EventListComponent extends HookConsumerWidget { final currentEvent = data.indexWhere((element) => element.isCurrent); return ListView( children: [ - FloatingActionButton.extended( - onPressed: () { - showDialog( - context: context, - builder: (context) => const CreateEventDialog()); - }, - label: const Text("Create Event"), - icon: const Icon(Icons.add), + Row( + children: [ + FilledButton.icon( + onPressed: () { + showDialog( + context: context, + builder: (context) => const CreateEventDialog()); + }, + label: const Text("Create Event"), + icon: const Icon(Icons.add), + ), + ], ), const SizedBox( height: 16,