When composer does not have focus, hide border.

This commit is contained in:
Benoit Marty
2023-06-29 17:14:35 +02:00
committed by Benoit Marty
parent c1a2ffbcc4
commit d502c5ade7
@@ -123,7 +123,9 @@ fun TextComposer(
val roundedCorners = RoundedCornerShape(roundedCornerSizeState.value) val roundedCorners = RoundedCornerShape(roundedCornerSizeState.value)
val minHeight = 42.dp val minHeight = 42.dp
val bgColor = ElementTheme.colors.bgSubtleSecondary val bgColor = ElementTheme.colors.bgSubtleSecondary
val borderColor = ElementTheme.colors.borderDisabled // Change border color depending on focus
var hasFocus by remember { mutableStateOf(false) }
val borderColor = if (hasFocus) ElementTheme.colors.borderDisabled else bgColor
Column( Column(
modifier = Modifier modifier = Modifier
.fillMaxWidth() .fillMaxWidth()
@@ -141,7 +143,10 @@ fun TextComposer(
.fillMaxWidth() .fillMaxWidth()
.heightIn(min = minHeight) .heightIn(min = minHeight)
.focusRequester(focusRequester) .focusRequester(focusRequester)
.onFocusEvent { onFocusChanged(it.hasFocus) }, .onFocusEvent {
hasFocus = it.hasFocus
onFocusChanged(it.hasFocus)
},
value = text, value = text,
onValueChange = { onComposerTextChange(it) }, onValueChange = { onComposerTextChange(it) },
onTextLayout = { onTextLayout = {