Increase content padding, and apply it to the space tab too.

This commit is contained in:
Benoit Marty
2026-02-09 12:47:24 +01:00
committed by Benoit Marty
parent 56165b2faf
commit 42308f46bd
2 changed files with 12 additions and 15 deletions

View File

@@ -243,6 +243,9 @@ private fun HomeScaffold(
},
floatingActionButtonPosition = FabPosition.Center,
content = { padding ->
val contentPadding = PaddingValues(
bottom = 112.dp,
)
when (state.currentHomeNavigationBarItem) {
HomeNavigationBarItem.Chats -> {
RoomListContentView(
@@ -256,15 +259,7 @@ private fun HomeScaffold(
onConfirmRecoveryKeyClick = onConfirmRecoveryKeyClick,
onRoomClick = ::onRoomClick,
onCreateRoomClick = onStartChatClick,
contentPadding = PaddingValues(
// FAB height is 56dp, bottom padding is 16dp, we add 8dp as extra margin -> 56+16+8 = 80,
// and include provided bottom padding
// Disable contentPadding due to navigation issue using the keyboard
// See https://issuetracker.google.com/issues/436432313
bottom = 80.dp,
// bottom = 80.dp + padding.calculateBottomPadding(),
// top = padding.calculateTopPadding()
),
contentPadding = contentPadding,
modifier = Modifier
.padding(
PaddingValues(
@@ -287,6 +282,7 @@ private fun HomeScaffold(
.padding(padding)
.consumeWindowInsets(padding)
.hazeSource(state = hazeState),
contentPadding = contentPadding,
state = state.homeSpacesState,
lazyListState = spacesLazyListState,
onSpaceClick = { spaceId ->

View File

@@ -10,6 +10,7 @@ package io.element.android.features.home.impl.spaces
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.PaddingValues
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.lazy.LazyColumn
@@ -48,6 +49,7 @@ import kotlinx.collections.immutable.toImmutableList
fun HomeSpacesView(
state: HomeSpacesState,
lazyListState: LazyListState,
contentPadding: PaddingValues,
onSpaceClick: (RoomId) -> Unit,
onCreateSpaceClick: () -> Unit,
onExploreClick: () -> Unit,
@@ -55,7 +57,7 @@ fun HomeSpacesView(
) {
if (state.canCreateSpaces && state.spaceRooms.isEmpty()) {
EmptySpaceHomeView(
modifier = modifier,
modifier = modifier.padding(contentPadding),
onCreateSpaceClick = onCreateSpaceClick,
onExploreClick = onExploreClick,
canExploreSpaces = state.canExploreSpaces,
@@ -63,7 +65,8 @@ fun HomeSpacesView(
} else {
LazyColumn(
modifier = modifier,
state = lazyListState
state = lazyListState,
contentPadding = contentPadding,
) {
val space = state.space
when (space) {
@@ -147,10 +150,7 @@ private fun EmptySpaceHomeView(
}
},
footer = {
ButtonColumnMolecule(
// Add a padding bottom for the navigation bar
modifier = Modifier.padding(bottom = 112.dp)
) {
ButtonColumnMolecule {
Button(
modifier = Modifier.fillMaxWidth(),
text = stringResource(CommonStrings.action_create_space),
@@ -179,5 +179,6 @@ internal fun HomeSpacesViewPreview(
onSpaceClick = {},
onCreateSpaceClick = {},
onExploreClick = {},
contentPadding = PaddingValues(bottom = 112.dp),
)
}