From 502515002dd92039b47b2c185024609812d869d1 Mon Sep 17 00:00:00 2001 From: mathiskirchner Date: Wed, 25 Jun 2025 14:30:33 +0200 Subject: [PATCH] added changing appbar title for each tab --- .../main_menu/custom_navigation_bar.dart | 26 +++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/lib/presentation/views/main_menu/custom_navigation_bar.dart b/lib/presentation/views/main_menu/custom_navigation_bar.dart index 6bf16d2..57b8519 100644 --- a/lib/presentation/views/main_menu/custom_navigation_bar.dart +++ b/lib/presentation/views/main_menu/custom_navigation_bar.dart @@ -32,6 +32,14 @@ class _CustomNavigationBarState extends State Widget build(BuildContext context) { return Scaffold( appBar: AppBar( + centerTitle: true, + title: Text( + _currentTabTitle(), + style: const TextStyle( + fontSize: 20, + fontWeight: FontWeight.bold, + ), + ), backgroundColor: CustomTheme.backgroundColor, scrolledUnderElevation: 0, actions: [ @@ -83,7 +91,7 @@ class _CustomNavigationBarState extends State const SizedBox(width: 40), IconButton( icon: Icon( - Icons.group, + Icons.groups, color: currentIndex == 2 ? Colors.white : Colors.black, ), onPressed: () => onTabTapped(2), @@ -106,4 +114,18 @@ class _CustomNavigationBarState extends State currentIndex = index; }); } -} + String _currentTabTitle() { + switch (currentIndex) { + case 0: + return 'Home'; + case 1: + return 'Game History'; + case 2: + return 'Groups'; + case 3: + return 'Statistics'; + default: + return ''; + } + } +} \ No newline at end of file