mirror of
https://github.com/rhunk/SnapEnhance.git
synced 2025-05-28 12:30:12 +02:00
fix(ui): top bar title translation
This commit is contained in:
parent
1f03592499
commit
9024b22b99
@ -41,7 +41,8 @@ class Navigation(
|
||||
} == true }
|
||||
|
||||
TopAppBar(title = {
|
||||
routes.getCurrentRoute(navBackStackEntry)?.title?.invoke() ?: Text(text = routes.getCurrentRoute(navBackStackEntry)?.routeInfo?.translatedKey ?: "Unknown Page")
|
||||
val currentRoute = routes.getCurrentRoute(navBackStackEntry)
|
||||
currentRoute?.title?.invoke() ?: Text(text = currentRoute?.routeInfo?.translatedKey?.value ?: "Unknown Page")
|
||||
}, navigationIcon = {
|
||||
val backButtonAnimation by animateFloatAsState(if (canGoBack) 1f else 0f,
|
||||
label = "backButtonAnimation"
|
||||
|
@ -35,7 +35,7 @@ data class RouteInfo(
|
||||
val icon: ImageVector = Icons.Default.Home,
|
||||
val primary: Boolean = false,
|
||||
) {
|
||||
var translatedKey: String? = null
|
||||
var translatedKey: Lazy<String?>? = null
|
||||
val childIds = mutableListOf<String>()
|
||||
}
|
||||
|
||||
@ -132,7 +132,7 @@ class Routes(
|
||||
this.routeInfo = routeInfo
|
||||
routes = this@Routes
|
||||
context = this@Routes.context
|
||||
this.routeInfo.translatedKey = context.translation.getOrNull("manager.routes.${route.routeInfo.key.substringBefore("/")}")
|
||||
this.routeInfo.translatedKey = lazy { context.translation.getOrNull("manager.routes.${route.routeInfo.key.substringBefore("/")}") }
|
||||
}
|
||||
routes.add(route)
|
||||
return route
|
||||
|
Loading…
x
Reference in New Issue
Block a user