mirror of
https://github.com/msfjarvis/compose-lobsters
synced 2025-08-15 07:37:03 +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 systemUiController = rememberSystemUiController()
|
||||||
val listState = rememberLazyListState()
|
val listState = rememberLazyListState()
|
||||||
val navController = rememberNavController()
|
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) }
|
var isFabVisible by remember { mutableStateOf(false) }
|
||||||
val nestedScrollConnection = remember {
|
val nestedScrollConnection = remember {
|
||||||
object : NestedScrollConnection {
|
object : NestedScrollConnection {
|
||||||
|
@ -85,6 +88,9 @@ fun LobstersApp(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
navController.addOnDestinationChangedListener { _, destination, _ ->
|
||||||
|
currentDestination = destination.route ?: Destinations.Hottest.getRoute()
|
||||||
|
}
|
||||||
LobstersTheme(
|
LobstersTheme(
|
||||||
LocalUriHandler provides urlLauncher,
|
LocalUriHandler provides urlLauncher,
|
||||||
LocalHTMLConverter provides htmlConverter,
|
LocalHTMLConverter provides htmlConverter,
|
||||||
|
@ -103,9 +109,7 @@ fun LobstersApp(
|
||||||
topBar = { ClawAppBar(modifier = Modifier.statusBarsPadding()) },
|
topBar = { ClawAppBar(modifier = Modifier.statusBarsPadding()) },
|
||||||
floatingActionButton = {
|
floatingActionButton = {
|
||||||
ClawFab(
|
ClawFab(
|
||||||
isFabVisible =
|
isFabVisible = isFabVisible && currentDestination == Destinations.Hottest.getRoute(),
|
||||||
isFabVisible &&
|
|
||||||
navController.currentDestination?.route == Destinations.Hottest.getRoute(),
|
|
||||||
listState = listState,
|
listState = listState,
|
||||||
modifier = Modifier.navigationBarsPadding(),
|
modifier = Modifier.navigationBarsPadding(),
|
||||||
)
|
)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue