Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

the topbar is not displaying properly. #568

Closed
MasterChen1016 opened this issue Jan 25, 2024 · 1 comment
Closed

the topbar is not displaying properly. #568

MasterChen1016 opened this issue Jan 25, 2024 · 1 comment

Comments

@MasterChen1016
Copy link

I found an issue while trying to use it, the topbar is not displaying properly.

`@Composable
fun RallyApp() {
RallyTheme {
val navController = rememberNavController()
val currentBackStackEntryAsState by navController.currentBackStackEntryAsState()
val destination = currentBackStackEntryAsState?.destination

    var currentScreen = rallyTabRowScreens.find {
        it.route == destination?.route
    }
    var isShowBackButton by rememberSaveable {
        mutableStateOf(false)
    }
    isShowBackButton = currentScreen == null
    Scaffold(
        topBar = {
            if (currentScreen != null) {
                RallyTabRow(
                    allScreens = rallyTabRowScreens,
                    onTabSelected = { screen ->
                        navController.navigateSingleTop(screen.route)
                    },
                    currentScreen = currentScreen
                )
            }
        }
    ) { innerPadding ->
        DestinationsNavHost(navGraph = NavGraphs.root , modifier = Modifier.padding(innerPadding))
    }
}

}`
Screenshot_20240125_164826

@MasterChen1016
Copy link
Author

I found an issue while trying to use it, the topbar is not displaying properly.

`@Composable fun RallyApp() { RallyTheme { val navController = rememberNavController() val currentBackStackEntryAsState by navController.currentBackStackEntryAsState() val destination = currentBackStackEntryAsState?.destination

    var currentScreen = rallyTabRowScreens.find {
        it.route == destination?.route
    }
    var isShowBackButton by rememberSaveable {
        mutableStateOf(false)
    }
    isShowBackButton = currentScreen == null
    Scaffold(
        topBar = {
            if (currentScreen != null) {
                RallyTabRow(
                    allScreens = rallyTabRowScreens,
                    onTabSelected = { screen ->
                        navController.navigateSingleTop(screen.route)
                    },
                    currentScreen = currentScreen
                )
            }
        }
    ) { innerPadding ->
        DestinationsNavHost(navGraph = NavGraphs.root , modifier = Modifier.padding(innerPadding))
    }
}

}` Screenshot_20240125_164826

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant