Fix double window-inset padding from the mini-player Scaffold hoist
Hoisting the mini-player into an outer Scaffold (previous commit) introduced a real regression: extra space above the top header, and a dead gap between the bottom tab bar and the mini-player. Root cause: TopAppBar and Material3's NavigationBar (used by BottomNavBar) are self-inset-aware - they only ever looked correct because they sat directly at the true screen edges. Now they're nested one level deeper inside the outer Scaffold's content area: - The outer Scaffold has no topBar, so with its default contentWindowInsets it fell back to reserving the raw status-bar inset itself as top padding on the NavHost - on top of MainScreen's own TopAppBar doing the same thing a second time. - BottomNavBar unconditionally pads itself for the navigation-bar inset regardless of what's below it, but MiniPlayerBar (which already self-pads for that inset) now always sits below it - so BottomNavBar was reserving space for an inset it's no longer adjacent to. Fixed by zeroing contentWindowInsets on the outer Scaffold (it has nothing of its own to protect beyond MiniPlayerBar's already-real measured height) and zeroing BottomNavBar's own windowInsets (since MiniPlayerBar is now what's genuinely bottom-adjacent). Verified on-device across Home/Library/ArtistDetail/Settings: tight header spacing restored, tab bar sits flush against the mini-player with no gap. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 5
parent
f79da367dc
commit
ad10f891b6
@@ -1,6 +1,7 @@
|
||||
package com.InfernalAquatics.deepwave.ui.components
|
||||
|
||||
import android.content.res.Configuration
|
||||
import androidx.compose.foundation.layout.WindowInsets
|
||||
import androidx.compose.material.icons.Icons
|
||||
import androidx.compose.material.icons.filled.Home
|
||||
import androidx.compose.material.icons.filled.LibraryMusic
|
||||
@@ -28,7 +29,10 @@ enum class BottomTab(val labelRes: Int, val icon: ImageVector) {
|
||||
|
||||
@Composable
|
||||
fun BottomNavBar(selectedTab: BottomTab, onTabSelected: (BottomTab) -> Unit) {
|
||||
NavigationBar {
|
||||
// Zero: MiniPlayerBar always sits below this now, so this is never actually the true
|
||||
// bottom-most element - it would otherwise pad itself for a nav-bar inset that isn't
|
||||
// adjacent to it anymore, leaving a dead gap above MiniPlayerBar.
|
||||
NavigationBar(windowInsets = WindowInsets(0, 0, 0, 0)) {
|
||||
BottomTab.entries.forEach { tab ->
|
||||
val label = stringResource(tab.labelRes)
|
||||
NavigationBarItem(
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.InfernalAquatics.deepwave.ui.navigation
|
||||
|
||||
import androidx.compose.foundation.layout.Box
|
||||
import androidx.compose.foundation.layout.WindowInsets
|
||||
import androidx.compose.foundation.layout.fillMaxSize
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.material3.CircularProgressIndicator
|
||||
@@ -52,6 +53,13 @@ fun DeepwaveNavHost(
|
||||
} ?: false
|
||||
|
||||
Scaffold(
|
||||
// Zero: this Scaffold has no topBar, and MiniPlayerBar already handles its own
|
||||
// bottom nav-bar inset. Without this, Scaffold falls back to reserving the raw
|
||||
// system-bar insets itself (since there's no topBar to "own" them), stacking on
|
||||
// top of what each screen's own Scaffold below already does - double top padding,
|
||||
// and a BottomNavBar that no longer sits at the true bottom edge padding for a
|
||||
// nav-bar inset that isn't there anymore.
|
||||
contentWindowInsets = WindowInsets(0, 0, 0, 0),
|
||||
bottomBar = {
|
||||
if (showMiniPlayer) {
|
||||
MiniPlayerBar(
|
||||
|
||||
Reference in New Issue
Block a user