mirror of
https://github.com/meshtastic/Meshtastic-Android.git
synced 2026-04-20 22:23:37 +00:00
Clean up spacing
This commit is contained in:
parent
a38f9763e8
commit
3b7ab012c6
2 changed files with 19 additions and 23 deletions
|
|
@ -18,7 +18,9 @@
|
|||
package org.meshtastic.feature.messaging
|
||||
|
||||
import androidx.annotation.StringRes
|
||||
import androidx.compose.foundation.layout.Arrangement
|
||||
import androidx.compose.foundation.layout.Column
|
||||
import androidx.compose.foundation.layout.PaddingValues
|
||||
import androidx.compose.foundation.layout.fillMaxSize
|
||||
import androidx.compose.foundation.layout.fillMaxWidth
|
||||
import androidx.compose.foundation.layout.padding
|
||||
|
|
@ -174,7 +176,13 @@ internal fun MessageList(
|
|||
}
|
||||
|
||||
val coroutineScope = rememberCoroutineScope()
|
||||
LazyColumn(modifier = modifier.fillMaxSize(), state = listState, reverseLayout = true) {
|
||||
LazyColumn(
|
||||
modifier = modifier.fillMaxSize(),
|
||||
state = listState,
|
||||
reverseLayout = true,
|
||||
contentPadding = PaddingValues(vertical = 8.dp),
|
||||
verticalArrangement = Arrangement.spacedBy(8.dp),
|
||||
) {
|
||||
items(messages, key = { it.uuid }) { msg ->
|
||||
if (ourNode != null) {
|
||||
val selected by remember { derivedStateOf { selectedIds.value.contains(msg.uuid) } }
|
||||
|
|
|
|||
|
|
@ -87,7 +87,8 @@ internal fun MessageItem(
|
|||
modifier =
|
||||
modifier
|
||||
.fillMaxWidth()
|
||||
.background(color = if (selected) Color.Gray else MaterialTheme.colorScheme.background),
|
||||
.background(color = if (selected) Color.Gray else MaterialTheme.colorScheme.background)
|
||||
.padding(horizontal = 8.dp),
|
||||
) {
|
||||
var showMessageActionsDialog by remember { mutableStateOf(false) }
|
||||
var showEmojiPickerDialog by remember { mutableStateOf(false) }
|
||||
|
|
@ -115,36 +116,23 @@ internal fun MessageItem(
|
|||
|
||||
val containsBel = message.text.contains('\u0007')
|
||||
val containerColor =
|
||||
Color(
|
||||
if (message.fromLocal) {
|
||||
ourNode.colors.second
|
||||
} else {
|
||||
node.colors.second
|
||||
},
|
||||
)
|
||||
.copy(alpha = 0.2f)
|
||||
Color(if (message.fromLocal) ourNode.colors.second else node.colors.second).copy(alpha = 0.2f)
|
||||
|
||||
val cardColors =
|
||||
CardDefaults.cardColors()
|
||||
.copy(containerColor = containerColor, contentColor = contentColorFor(containerColor))
|
||||
val messageModifier =
|
||||
Modifier.padding(start = 8.dp, top = 8.dp, end = 8.dp)
|
||||
|
||||
Card(
|
||||
modifier =
|
||||
Modifier.fillMaxWidth(.9f)
|
||||
.align(if (message.fromLocal) Alignment.End else Alignment.Start)
|
||||
.then(
|
||||
if (containsBel) {
|
||||
Modifier.border(2.dp, MessageItemColors.Red, shape = MaterialTheme.shapes.medium)
|
||||
} else {
|
||||
Modifier
|
||||
},
|
||||
)
|
||||
|
||||
Card(
|
||||
modifier =
|
||||
Modifier.align(if (message.fromLocal) Alignment.End else Alignment.Start)
|
||||
.padding(
|
||||
top = 4.dp,
|
||||
start = if (!message.fromLocal) 0.dp else 16.dp,
|
||||
end = if (message.fromLocal) 0.dp else 16.dp,
|
||||
)
|
||||
.then(messageModifier),
|
||||
),
|
||||
colors = cardColors,
|
||||
) {
|
||||
Column(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue