Statusbar seamless (#289)

* wip status bar

* header fix
This commit is contained in:
callebtc
2025-08-23 02:36:36 +02:00
committed by GitHub
parent f13f3063c9
commit 16c55a4105
4 changed files with 62 additions and 21 deletions
@@ -70,18 +70,26 @@ fun ChatScreen(viewModel: ChatViewModel) {
}
// Use WindowInsets to handle keyboard properly
Box(modifier = Modifier.fillMaxSize()) {
Box(
modifier = Modifier
.fillMaxSize()
.background(colorScheme.background) // Extend background to fill entire screen including status bar
) {
val headerHeight = 42.dp
// Main content area that responds to keyboard/window insets
Column(
modifier = Modifier
.fillMaxSize()
.background(colorScheme.background)
.windowInsetsPadding(WindowInsets.ime) // This handles keyboard insets
.windowInsetsPadding(WindowInsets.navigationBars) // Add bottom padding when keyboard is not expanded
) {
// Header spacer - creates space for the floating header
Spacer(modifier = Modifier.height(headerHeight))
// Header spacer - creates exact space for the floating header (status bar + compact header)
Spacer(
modifier = Modifier
.windowInsetsPadding(WindowInsets.statusBars)
.height(headerHeight)
)
// Messages area - takes up available space, will compress when keyboard appears
MessagesList(
@@ -180,6 +188,16 @@ fun ChatScreen(viewModel: ChatViewModel) {
onLocationChannelsClick = { showLocationChannelsSheet = true }
)
// Divider under header - positioned after status bar + header height
HorizontalDivider(
modifier = Modifier
.fillMaxWidth()
.windowInsetsPadding(WindowInsets.statusBars)
.offset(y = headerHeight)
.zIndex(1f),
color = colorScheme.outline.copy(alpha = 0.3f)
)
val alpha by animateFloatAsState(
targetValue = if (showSidebar) 0.5f else 0f,
animationSpec = tween(
@@ -267,8 +285,7 @@ private fun ChatInputSection(
) {
Surface(
modifier = Modifier.fillMaxWidth(),
color = colorScheme.background,
shadowElevation = 8.dp
color = colorScheme.background
) {
Column {
HorizontalDivider(color = colorScheme.outline.copy(alpha = 0.3f))
@@ -324,11 +341,9 @@ private fun ChatFloatingHeader(
Surface(
modifier = Modifier
.fillMaxWidth()
.height(headerHeight)
.zIndex(1f)
.windowInsetsPadding(WindowInsets.statusBars), // Only respond to status bar
color = colorScheme.background.copy(alpha = 0.95f),
shadowElevation = 8.dp
.windowInsetsPadding(WindowInsets.statusBars), // Extend into status bar area
color = colorScheme.background // Solid background color extending into status bar
) {
TopAppBar(
title = {
@@ -351,18 +366,10 @@ private fun ChatFloatingHeader(
},
colors = TopAppBarDefaults.topAppBarColors(
containerColor = Color.Transparent
)
),
modifier = Modifier.height(headerHeight) // Ensure compact header height
)
}
// Divider under header
HorizontalDivider(
modifier = Modifier
.fillMaxWidth()
.offset(y = headerHeight)
.zIndex(1f),
color = colorScheme.outline.copy(alpha = 0.3f)
)
}
@Composable