From 02d79574dd024194221b0df8f8a5c7a24b18a406 Mon Sep 17 00:00:00 2001 From: Felix Kirchner Date: Wed, 7 Jan 2026 14:43:13 +0100 Subject: [PATCH] Simplified app bar logic in views --- lib/core/custom_theme.dart | 3 +++ .../main_menu/group_view/create_group_view.dart | 10 +--------- .../match_view/create_match/choose_game_view.dart | 8 +------- .../match_view/create_match/choose_group_view.dart | 8 +------- .../match_view/create_match/choose_ruleset_view.dart | 8 +------- .../match_view/create_match/create_match_view.dart | 10 +--------- .../main_menu/match_view/match_result_view.dart | 12 +----------- 7 files changed, 9 insertions(+), 50 deletions(-) diff --git a/lib/core/custom_theme.dart b/lib/core/custom_theme.dart index 5930901..a9a31b2 100644 --- a/lib/core/custom_theme.dart +++ b/lib/core/custom_theme.dart @@ -25,10 +25,13 @@ class CustomTheme { backgroundColor: backgroundColor, foregroundColor: Colors.white, elevation: 0, + scrolledUnderElevation: 0, + centerTitle: true, titleTextStyle: const TextStyle( color: Colors.white, fontSize: 20, fontWeight: FontWeight.bold, + overflow: TextOverflow.ellipsis, ), iconTheme: const IconThemeData(color: Colors.white), ); diff --git a/lib/presentation/views/main_menu/group_view/create_group_view.dart b/lib/presentation/views/main_menu/group_view/create_group_view.dart index 8037de4..3d09561 100644 --- a/lib/presentation/views/main_menu/group_view/create_group_view.dart +++ b/lib/presentation/views/main_menu/group_view/create_group_view.dart @@ -46,15 +46,7 @@ class _CreateGroupViewState extends State { final loc = AppLocalizations.of(context); return Scaffold( backgroundColor: CustomTheme.backgroundColor, - appBar: AppBar( - backgroundColor: CustomTheme.backgroundColor, - scrolledUnderElevation: 0, - title: Text( - loc.create_new_group, - style: const TextStyle(fontSize: 20, fontWeight: FontWeight.bold), - ), - centerTitle: true, - ), + appBar: AppBar(title: Text(loc.create_new_group)), body: SafeArea( child: Column( mainAxisAlignment: MainAxisAlignment.start, diff --git a/lib/presentation/views/main_menu/match_view/create_match/choose_game_view.dart b/lib/presentation/views/main_menu/match_view/create_match/choose_game_view.dart index 01981e2..5976f72 100644 --- a/lib/presentation/views/main_menu/match_view/create_match/choose_game_view.dart +++ b/lib/presentation/views/main_menu/match_view/create_match/choose_game_view.dart @@ -38,19 +38,13 @@ class _ChooseGameViewState extends State { return Scaffold( backgroundColor: CustomTheme.backgroundColor, appBar: AppBar( - backgroundColor: CustomTheme.backgroundColor, - scrolledUnderElevation: 0, leading: IconButton( icon: const Icon(Icons.arrow_back_ios), onPressed: () { Navigator.of(context).pop(selectedGameIndex); }, ), - title: Text( - loc.choose_game, - style: const TextStyle(fontSize: 20, fontWeight: FontWeight.bold), - ), - centerTitle: true, + title: Text(loc.choose_game), ), body: PopScope( // This fixes that the Android Back Gesture didn't return the diff --git a/lib/presentation/views/main_menu/match_view/create_match/choose_group_view.dart b/lib/presentation/views/main_menu/match_view/create_match/choose_group_view.dart index 011b819..97fbcef 100644 --- a/lib/presentation/views/main_menu/match_view/create_match/choose_group_view.dart +++ b/lib/presentation/views/main_menu/match_view/create_match/choose_group_view.dart @@ -38,8 +38,6 @@ class _ChooseGroupViewState extends State { return Scaffold( backgroundColor: CustomTheme.backgroundColor, appBar: AppBar( - backgroundColor: CustomTheme.backgroundColor, - scrolledUnderElevation: 0, leading: IconButton( icon: const Icon(Icons.arrow_back_ios), onPressed: () { @@ -52,11 +50,7 @@ class _ChooseGroupViewState extends State { ); }, ), - title: Text( - loc.choose_group, - style: const TextStyle(fontSize: 20, fontWeight: FontWeight.bold), - ), - centerTitle: true, + title: Text(loc.choose_group), ), body: PopScope( // This fixes that the Android Back Gesture didn't return the diff --git a/lib/presentation/views/main_menu/match_view/create_match/choose_ruleset_view.dart b/lib/presentation/views/main_menu/match_view/create_match/choose_ruleset_view.dart index 73be471..ca021af 100644 --- a/lib/presentation/views/main_menu/match_view/create_match/choose_ruleset_view.dart +++ b/lib/presentation/views/main_menu/match_view/create_match/choose_ruleset_view.dart @@ -37,8 +37,6 @@ class _ChooseRulesetViewState extends State { child: Scaffold( backgroundColor: CustomTheme.backgroundColor, appBar: AppBar( - backgroundColor: CustomTheme.backgroundColor, - scrolledUnderElevation: 0, leading: IconButton( icon: const Icon(Icons.arrow_back_ios), onPressed: () { @@ -49,11 +47,7 @@ class _ChooseRulesetViewState extends State { ); }, ), - title: Text( - loc.choose_ruleset, - style: const TextStyle(fontSize: 20, fontWeight: FontWeight.bold), - ), - centerTitle: true, + title: Text(loc.choose_ruleset), ), body: PopScope( // This fixes that the Android Back Gesture didn't return the diff --git a/lib/presentation/views/main_menu/match_view/create_match/create_match_view.dart b/lib/presentation/views/main_menu/match_view/create_match/create_match_view.dart index 7b7deb0..e99dfc1 100644 --- a/lib/presentation/views/main_menu/match_view/create_match/create_match_view.dart +++ b/lib/presentation/views/main_menu/match_view/create_match/create_match_view.dart @@ -121,15 +121,7 @@ class _CreateMatchViewState extends State { final loc = AppLocalizations.of(context); return Scaffold( backgroundColor: CustomTheme.backgroundColor, - appBar: AppBar( - backgroundColor: CustomTheme.backgroundColor, - scrolledUnderElevation: 0, - title: Text( - loc.create_new_match, - style: const TextStyle(fontSize: 20, fontWeight: FontWeight.bold), - ), - centerTitle: true, - ), + appBar: AppBar(title: Text(loc.create_new_match)), body: SafeArea( child: Column( mainAxisAlignment: MainAxisAlignment.start, diff --git a/lib/presentation/views/main_menu/match_view/match_result_view.dart b/lib/presentation/views/main_menu/match_view/match_result_view.dart index 93ebbc6..0d624f0 100644 --- a/lib/presentation/views/main_menu/match_view/match_result_view.dart +++ b/lib/presentation/views/main_menu/match_view/match_result_view.dart @@ -51,17 +51,7 @@ class _MatchResultViewState extends State { Navigator.of(context).pop(); }, ), - backgroundColor: CustomTheme.backgroundColor, - scrolledUnderElevation: 0, - title: Text( - widget.match.name, - style: const TextStyle( - fontSize: 20, - fontWeight: FontWeight.bold, - overflow: TextOverflow.ellipsis, - ), - ), - centerTitle: true, + title: Text(widget.match.name), ), body: SafeArea( child: Column(