mirror of
https://github.com/msfjarvis/compose-lobsters
synced 2025-08-14 08:17:04 +05:30
Revert "android: remove unnecessary currentDestination variable"
This reverts commit 77d15ae6c6
.
This commit is contained in:
parent
ad818c40a6
commit
6eb815ec3b
1 changed files with 7 additions and 3 deletions
|
@ -49,6 +49,9 @@ fun LobstersApp(
|
|||
val systemUiController = rememberSystemUiController()
|
||||
val listState = rememberLazyListState()
|
||||
val navController = rememberNavController()
|
||||
// The destination needs to be tracked here rather than used directly since
|
||||
// `NavController#currentDestination` is not a Composable state.
|
||||
var currentDestination by remember { mutableStateOf(Destinations.Hottest.getRoute()) }
|
||||
var isFabVisible by remember { mutableStateOf(false) }
|
||||
val nestedScrollConnection = remember {
|
||||
object : NestedScrollConnection {
|
||||
|
@ -85,6 +88,9 @@ fun LobstersApp(
|
|||
}
|
||||
}
|
||||
}
|
||||
navController.addOnDestinationChangedListener { _, destination, _ ->
|
||||
currentDestination = destination.route ?: Destinations.Hottest.getRoute()
|
||||
}
|
||||
LobstersTheme(
|
||||
LocalUriHandler provides urlLauncher,
|
||||
LocalHTMLConverter provides htmlConverter,
|
||||
|
@ -103,9 +109,7 @@ fun LobstersApp(
|
|||
topBar = { ClawAppBar(modifier = Modifier.statusBarsPadding()) },
|
||||
floatingActionButton = {
|
||||
ClawFab(
|
||||
isFabVisible =
|
||||
isFabVisible &&
|
||||
navController.currentDestination?.route == Destinations.Hottest.getRoute(),
|
||||
isFabVisible = isFabVisible && currentDestination == Destinations.Hottest.getRoute(),
|
||||
listState = listState,
|
||||
modifier = Modifier.navigationBarsPadding(),
|
||||
)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue