feat: top app bar title updates based on current route (Closes #22)
TopAppBar title now reflects the current NavController destination: character sheet shows the character name, settings shows "Settings", fallback shows the app name. Uses currentRoute() helper already available from NavHost integration. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -240,12 +240,19 @@ private fun MainScaffold(
|
|||||||
modifier: Modifier = Modifier
|
modifier: Modifier = Modifier
|
||||||
) {
|
) {
|
||||||
var isDark by LocalThemeIsDark.current
|
var isDark by LocalThemeIsDark.current
|
||||||
|
val currentRoute = currentRoute(navController)
|
||||||
|
|
||||||
|
val topBarTitle = when (currentRoute) {
|
||||||
|
AppRoutes.CHARACTER_SHEET -> EXAMPLE_CHARACTER.characterData.name
|
||||||
|
AppRoutes.SETTINGS -> "Settings"
|
||||||
|
else -> "Shadowrun Character Sheet"
|
||||||
|
}
|
||||||
|
|
||||||
Scaffold(
|
Scaffold(
|
||||||
modifier = modifier.fillMaxSize(),
|
modifier = modifier.fillMaxSize(),
|
||||||
topBar = {
|
topBar = {
|
||||||
TopAppBar(
|
TopAppBar(
|
||||||
title = { Text("Shadowrun Character Sheet") },
|
title = { Text(topBarTitle) },
|
||||||
modifier = Modifier.testTag(TestTags.TOP_APP_BAR),
|
modifier = Modifier.testTag(TestTags.TOP_APP_BAR),
|
||||||
navigationIcon = {
|
navigationIcon = {
|
||||||
if (showMenuButton) {
|
if (showMenuButton) {
|
||||||
|
|||||||
Reference in New Issue
Block a user