flattening box layer

This commit is contained in:
Adam Brown 2022-09-30 16:46:19 +01:00
parent d03cadb3b7
commit 94a05898c8
1 changed files with 20 additions and 22 deletions

View File

@ -651,31 +651,29 @@ private fun TextComposer(state: ComposerState.Text, onTextChange: (String) -> Un
.background(SmallTalkTheme.extendedColors.othersBubble, RoundedCornerShape(24.dp)), .background(SmallTalkTheme.extendedColors.othersBubble, RoundedCornerShape(24.dp)),
contentAlignment = Alignment.TopStart, contentAlignment = Alignment.TopStart,
) { ) {
Box(Modifier.padding(14.dp)) { BasicTextField(
BasicTextField( modifier = Modifier.fillMaxWidth().padding(14.dp),
modifier = Modifier.fillMaxWidth(), value = state.value,
value = state.value, onValueChange = { onTextChange(it) },
onValueChange = { onTextChange(it) }, cursorBrush = SolidColor(MaterialTheme.colorScheme.primary),
cursorBrush = SolidColor(MaterialTheme.colorScheme.primary), textStyle = LocalTextStyle.current.copy(color = SmallTalkTheme.extendedColors.onOthersBubble),
textStyle = LocalTextStyle.current.copy(color = SmallTalkTheme.extendedColors.onOthersBubble), keyboardOptions = KeyboardOptions(capitalization = KeyboardCapitalization.Sentences, autoCorrect = true),
keyboardOptions = KeyboardOptions(capitalization = KeyboardCapitalization.Sentences, autoCorrect = true), decorationBox = { innerField ->
decorationBox = { innerField -> Row(modifier = Modifier.fillMaxWidth(), horizontalArrangement = Arrangement.SpaceBetween) {
Row(modifier = Modifier.fillMaxWidth(), horizontalArrangement = Arrangement.SpaceBetween) { Box(modifier = Modifier.weight(1f).padding(end = 4.dp)) {
Box(modifier = Modifier.weight(1f).padding(end = 4.dp)) { if (state.value.isEmpty()) {
if (state.value.isEmpty()) { Text("Message", color = SmallTalkTheme.extendedColors.onOthersBubble.copy(alpha = 0.5f))
Text("Message", color = SmallTalkTheme.extendedColors.onOthersBubble.copy(alpha = 0.5f))
}
innerField()
} }
Icon( innerField()
modifier = Modifier.clickable { onAttach() }.wrapContentWidth().align(Alignment.Bottom),
imageVector = Icons.Filled.Image,
contentDescription = "",
)
} }
Icon(
modifier = Modifier.clickable { onAttach() }.wrapContentWidth().align(Alignment.Bottom),
imageVector = Icons.Filled.Image,
contentDescription = "",
)
} }
) }
} )
} }
} }
Spacer(modifier = Modifier.width(6.dp)) Spacer(modifier = Modifier.width(6.dp))