diff --git a/app/src/main/kotlin/tm/alashow/datmusic/ui/home/Home.kt b/app/src/main/kotlin/tm/alashow/datmusic/ui/home/Home.kt index 79486c34..9bd5453b 100644 --- a/app/src/main/kotlin/tm/alashow/datmusic/ui/home/Home.kt +++ b/app/src/main/kotlin/tm/alashow/datmusic/ui/home/Home.kt @@ -55,7 +55,7 @@ internal fun Home( val bottomBarHeight = HomeBottomNavigationHeight * (if (isPlayerActive) 1.15f else 1f) Row(Modifier.fillMaxSize()) { if (isWideScreen) - ResizableHomeNavigationRail(isPlayerActive, selectedTab, navController) + ResizableHomeNavigationRail(selectedTab = selectedTab, navController = navController) Scaffold( modifier = Modifier.weight(12f), scaffoldState = scaffoldState, diff --git a/app/src/main/kotlin/tm/alashow/datmusic/ui/home/ResizableHomeNavigationRail.kt b/app/src/main/kotlin/tm/alashow/datmusic/ui/home/ResizableHomeNavigationRail.kt index 04c69a70..b18c1ff1 100644 --- a/app/src/main/kotlin/tm/alashow/datmusic/ui/home/ResizableHomeNavigationRail.kt +++ b/app/src/main/kotlin/tm/alashow/datmusic/ui/home/ResizableHomeNavigationRail.kt @@ -45,12 +45,10 @@ import tm.alashow.ui.theme.AppTheme @OptIn(ExperimentalMaterialApi::class) @Composable internal fun RowScope.ResizableHomeNavigationRail( - isPlayerActive: Boolean, selectedTab: RootScreen, navController: NavHostController, configuration: Configuration = LocalConfiguration.current, - navigationRailWeightWithPlayer: Float = 4.5f, - navigationRailWeightWithoutPlayer: Float = 3.5f, + navigationRailBaseWeight: Float = 4.5f, navigationRailWeightMinWeight: Float = 0.9f, viewModel: ResizableHomeNavigationRailViewModel = hiltViewModel(), dividerDragOffset: State = rememberFlowWithLifecycle(viewModel.dragOffset).collectAsState(initial = 0f), @@ -61,8 +59,6 @@ internal fun RowScope.ResizableHomeNavigationRail( val dragSnapAnchors = listOf(0f, dragRange.endInclusive, dragRange.start) var dragSnapCurrentAnchor by remember { mutableStateOf(0) } val dividerDragOffsetWeight by derivedStateOf { (dividerDragOffset.value / screenWidth) * 12 } - - val navigationRailBaseWeight = if (isPlayerActive) navigationRailWeightWithPlayer else navigationRailWeightWithoutPlayer val navigationRailWeight = navigationRailBaseWeight + dividerDragOffsetWeight Box(Modifier.weight(navigationRailWeight.coerceAtLeast(navigationRailWeightMinWeight))) {