mirror of
https://github.com/permissionlesstech/bitchat-android.git
synced 2026-08-08 06:46:11 +00:00
wear: dynamic bottom padding - last message clears floating buttons at newest, text flows behind them when scrolled up
This commit is contained in:
parent
5e937fa816
commit
f64338a3b8
@ -91,6 +91,14 @@ fun ChatScreen(onOpenPeople: () -> Unit, onOpenTextInput: () -> Unit) {
|
||||
|
||||
val buttonsVisible = rememberBottomBarVisibility(scrollState)
|
||||
val headerExpanded = scrollState.maxValue - scrollState.value > 60
|
||||
// Full bottom clearance only at the newest message, so the last message sits comfortably
|
||||
// above the floating buttons; collapses when scrolling up so history flows behind them.
|
||||
val atNewest = scrollState.maxValue - scrollState.value < 40
|
||||
val listBottomPadding by androidx.compose.animation.core.animateDpAsState(
|
||||
targetValue = if (atNewest) 56.dp else 8.dp,
|
||||
animationSpec = androidx.compose.animation.core.tween(BitchatMotion.STANDARD_MS),
|
||||
label = "listBottomPad"
|
||||
)
|
||||
|
||||
Column(modifier = Modifier.fillMaxSize()) {
|
||||
// Sticky header
|
||||
@ -116,7 +124,7 @@ fun ChatScreen(onOpenPeople: () -> Unit, onOpenTextInput: () -> Unit) {
|
||||
Column(
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.padding(bottom = 8.dp)
|
||||
.padding(bottom = listBottomPadding)
|
||||
.rotaryScrollable(
|
||||
RotaryScrollableDefaults.behavior(scrollState),
|
||||
rotaryFocus
|
||||
|
||||
@ -91,6 +91,12 @@ fun DmScreen(peerID: String, onOpenTextInput: () -> Unit) {
|
||||
|
||||
val buttonsVisible = rememberBottomBarVisibility(scrollState)
|
||||
val headerExpanded = scrollState.maxValue - scrollState.value > 60
|
||||
val atNewest = scrollState.maxValue - scrollState.value < 40
|
||||
val listBottomPadding by androidx.compose.animation.core.animateDpAsState(
|
||||
targetValue = if (atNewest) 56.dp else 8.dp,
|
||||
animationSpec = androidx.compose.animation.core.tween(BitchatMotion.STANDARD_MS),
|
||||
label = "listBottomPad"
|
||||
)
|
||||
val headerIconSize by androidx.compose.animation.core.animateDpAsState(
|
||||
targetValue = if (headerExpanded) 16.dp else 11.dp,
|
||||
animationSpec = androidx.compose.animation.core.tween(BitchatMotion.STANDARD_MS),
|
||||
@ -145,7 +151,7 @@ fun DmScreen(peerID: String, onOpenTextInput: () -> Unit) {
|
||||
Column(
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.padding(bottom = 8.dp)
|
||||
.padding(bottom = listBottomPadding)
|
||||
.rotaryScrollable(
|
||||
RotaryScrollableDefaults.behavior(scrollState),
|
||||
rotaryFocus
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user