feat: Dynamic header
This commit is contained in:
@@ -37,6 +37,7 @@ import androidx.navigation.NavGraph.Companion.findStartDestination
|
|||||||
import androidx.navigation.NavGraphBuilder
|
import androidx.navigation.NavGraphBuilder
|
||||||
import androidx.navigation.NavOptions
|
import androidx.navigation.NavOptions
|
||||||
import androidx.navigation.compose.composable
|
import androidx.navigation.compose.composable
|
||||||
|
import androidx.navigation.compose.currentBackStackEntryAsState
|
||||||
import kotlinx.coroutines.Dispatchers
|
import kotlinx.coroutines.Dispatchers
|
||||||
import kotlinx.coroutines.Job
|
import kotlinx.coroutines.Job
|
||||||
import kotlinx.coroutines.delay
|
import kotlinx.coroutines.delay
|
||||||
@@ -52,6 +53,28 @@ import org.json.JSONArray
|
|||||||
import org.json.JSONObject
|
import org.json.JSONObject
|
||||||
|
|
||||||
class FeaturesRootSection : Routes.Route() {
|
class FeaturesRootSection : Routes.Route() {
|
||||||
|
override val title: @Composable (() -> Unit)? = @Composable {
|
||||||
|
val navBackStackEntry by routes.navController.currentBackStackEntryAsState()
|
||||||
|
val currentDestination = navBackStackEntry?.destination
|
||||||
|
|
||||||
|
val titleText = when (currentDestination?.route) {
|
||||||
|
FEATURE_CONTAINER_ROUTE -> {
|
||||||
|
navBackStackEntry?.arguments?.getString("name")?.let { containerName ->
|
||||||
|
allContainers[containerName]?.let {
|
||||||
|
context.translation[it.key.propertyName()]
|
||||||
|
}
|
||||||
|
} ?: routeInfo.translatedKey?.value
|
||||||
|
}
|
||||||
|
SEARCH_FEATURE_ROUTE -> {
|
||||||
|
translation["search_button"] ?: "Search"
|
||||||
|
}
|
||||||
|
else -> {
|
||||||
|
routeInfo.translatedKey?.value
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Text(titleText ?: "")
|
||||||
|
}
|
||||||
|
|
||||||
private val alertDialogs by lazy { AlertDialogs(context.translation) }
|
private val alertDialogs by lazy { AlertDialogs(context.translation) }
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
|
|||||||
0
composer/node_modules/.bin/tsc
generated
vendored
Normal file → Executable file
0
composer/node_modules/.bin/tsc
generated
vendored
Normal file → Executable file
Reference in New Issue
Block a user