mirror of
https://github.com/atsunatsu/Look4Sat.git
synced 2026-10-02 03:15:37 +00:00
fix(radar): elevation color thresholds not applied on radar page
Root cause: LocalElevationThresholds was provided inside MainScreen, but RadarDestination is a root-level sibling entry in NavRoot's NavDisplay, so it fell outside the CompositionLocal scope and always used the default 15/45 thresholds. Fix: hoist the CompositionLocalProvider to NavRoot so both the tab content and the root-level RadarDestination read the user's low/high elevation thresholds. Also affects upstream (same navigation structure).
This commit is contained in:
1 parent
4020381b03
commit
462c3de155
1 file changed
+39
-25
@@ -104,33 +104,47 @@ fun NavRoot(deeplink: String? = null) {
|
|||||||
// Reverse: outgoing slides out to the right, incoming drifts in from the left
|
// Reverse: outgoing slides out to the right, incoming drifts in from the left
|
||||||
val popTransition = slideInHorizontally(tween(300)) { -it / 3 } togetherWith
|
val popTransition = slideInHorizontally(tween(300)) { -it / 3 } togetherWith
|
||||||
slideOutHorizontally(tween(300)) { it }
|
slideOutHorizontally(tween(300)) { it }
|
||||||
NavDisplay(
|
// Elevation color thresholds must be provided at the root level so that BOTH
|
||||||
modifier = Modifier.fillMaxSize(),
|
// the tab content (MainScreen) and the root-level RadarDestination see the
|
||||||
backStack = rootBackStack,
|
// user's custom thresholds. RadarDestination is a sibling entry of MainScreen
|
||||||
onBack = navigateBack,
|
// in this NavDisplay, so a provider inside MainScreen never reaches it.
|
||||||
transitionSpec = { pushTransition },
|
val context = LocalContext.current
|
||||||
popTransitionSpec = { popTransition },
|
val container = (context.applicationContext as IContainerProvider).getMainContainer()
|
||||||
predictivePopTransitionSpec = { popTransition },
|
val otherSettings by container.settingsRepo.otherSettings.collectAsStateWithLifecycle()
|
||||||
entryDecorators = listOf(
|
CompositionLocalProvider(
|
||||||
rememberSaveableStateHolderNavEntryDecorator(),
|
LocalElevationThresholds provides ElevationThresholds(
|
||||||
rememberViewModelStoreNavEntryDecorator()
|
low = otherSettings.lowElevation,
|
||||||
),
|
high = otherSettings.highElevation
|
||||||
entryProvider = entryProvider {
|
)
|
||||||
entry<Screen.Passes> {
|
) {
|
||||||
MainScreen(
|
NavDisplay(
|
||||||
navigateToRadar = navigateToRadar
|
modifier = Modifier.fillMaxSize(),
|
||||||
)
|
backStack = rootBackStack,
|
||||||
}
|
onBack = navigateBack,
|
||||||
entry<RadarDestination> {
|
transitionSpec = { pushTransition },
|
||||||
Surface(
|
popTransitionSpec = { popTransition },
|
||||||
modifier = Modifier.fillMaxSize(),
|
predictivePopTransitionSpec = { popTransition },
|
||||||
color = MaterialTheme.colorScheme.background
|
entryDecorators = listOf(
|
||||||
) {
|
rememberSaveableStateHolderNavEntryDecorator(),
|
||||||
RadarDestination(navigateUp = navigateBack)
|
rememberViewModelStoreNavEntryDecorator()
|
||||||
|
),
|
||||||
|
entryProvider = entryProvider {
|
||||||
|
entry<Screen.Passes> {
|
||||||
|
MainScreen(
|
||||||
|
navigateToRadar = navigateToRadar
|
||||||
|
)
|
||||||
|
}
|
||||||
|
entry<RadarDestination> {
|
||||||
|
Surface(
|
||||||
|
modifier = Modifier.fillMaxSize(),
|
||||||
|
color = MaterialTheme.colorScheme.background
|
||||||
|
) {
|
||||||
|
RadarDestination(navigateUp = navigateBack)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
)
|
||||||
)
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
|
|||||||
Reference in new issue
Block a user