When composer does not have focus, hide border.
This commit is contained in:
parent
ad1b5700ab
commit
ff13651b4c
1 changed files with 7 additions and 2 deletions
|
|
@ -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 = {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue