SimpleTopAppBar
0.4.0indexedImplements a simple top app bar with a navigation back button and kebab menu, facilitating seamless navigation and interaction in applications.
0
Stars
—
Used by
dependents
—
Health
/ 100
Implements a simple top app bar with a navigation back button and kebab menu, facilitating seamless navigation and interaction in applications.
A simple TopAppBar for Android and Compose Multiplatrorm, include navigate back button and kebab menu button.
app/build.gradle.kts
dependencies {
...
+ implementation("dev.yuyuyuyuyu:simpletopappbar:0.3.1")
}
composeApp/build.gradle.kts
kotlin {
...
sourceSets {
...
commonMain.dependencies {
...
+ implementation("dev.yuyuyuyuyu:simpletopappbar:0.3.1")
}
}
}
app/src/main/java/dev/yuyuyuyuyu/simpletopappbar/example/android/ui/App.kt
@Composable
fun App(
navController: NavHostController = rememberNavController(),
) {
backStackEntry navController.currentBackStackEntryAsState()
currentScreen = NavigateDestination.valueOf(
value = backStackEntry?.destination?.route
?: NavigateDestination.SimpleTopAppBarExample.name,
)
SimpleTopAppBarTheme {
Scaffold(
topBar = {
SimpleTopAppBar(
title = currentScreen.name,
navigateBackIsPossible = navController.previousBackStackEntry != ,
onNavigateBackButtonClick = { navController.navigateUp() },
onOpenSourceLicensesButtonClick = {
(currentScreen != NavigateDestination.OpenSourceLicenses) {
navController.navigate(NavigateDestination.OpenSourceLicenses.name)
}
},
)
},
) { innerPadding ->
NavHost(
navController = navController,
startDestination = NavigateDestination.SimpleTopAppBarExample.name,
modifier = Modifier.padding(innerPadding),
) {
composable(route = NavigateDestination.SimpleTopAppBarExample.name) {
SimpleTopAppBarExampleScreen()
}
composable(route = NavigateDestination.OpenSourceLicenses.name) {
OpenSourceLicensesScreen()
}
}
}
}
}
composeApp/src/commonMain/kotlin/dev/yuyuyuyuyu/simpletopappbar/example/multiplatform/ui/App.kt
fun App(
navController: NavHostController = rememberNavController(),
) {
val backStackEntry by navController.currentBackStackEntryAsState()
currentScreen = NavigateDestination.valueOf(
value = backStackEntry?.destination?.route
?: NavigateDestination.SimpleTopAppBarExample.name,
)
MaterialTheme {
Scaffold(
topBar = {
SimpleTopAppBar(
title = currentScreen.name,
navigateBackIsPossible = navController.previousBackStackEntry != ,
onNavigateBackButtonClick = { navController.navigateUp() },
onOpenSourceLicensesButtonClick = {
(currentScreen != NavigateDestination.OpenSourceLicenses) {
navController.navigate(NavigateDestination.OpenSourceLicenses.name)
}
},
)
},
) { innerPadding ->
NavHost(
navController = navController,
startDestination = NavigateDestination.SimpleTopAppBarExample.name,
modifier = Modifier.padding(innerPadding),
) {
composable(route = NavigateDestination.SimpleTopAppBarExample.name) {
SimpleTopAppBarExampleScreen()
}
composable(route = NavigateDestination.OpenSourceLicenses.name) {
OpenSourceLicensesScreen()
}
}
}
}
}
Apache License 2.0
Copyright 2025 yu
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http:
Unless applicable law agreed to writing, software
distributed under the License distributed an BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express implied.
See the License the specific language governing permissions
limitations under the License.
Surfaced from shared tags and platforms — no rankings paid for.