FlowRow를 활용해 낱말,텍스트를 컴포넌트로 만들어 추가 및 삭제하도록 구성하였다.
낱말 및 텍스트를 추가하는 과정에서, 2번째 줄 넘어서부터 생성된 컴포넌트가
키보드 자판에 의해 가려지는 상황이 일어났다.
아래는 낱말 컴포넌트의 코드이다.
@Composable
fun ConsumeBlankContentUi(
word: String,
index: Int = 0,
onContentRemove: (Int) -> Unit,
removeIconVisible: Boolean = true,
onValueChanged: (String, Int) -> Unit,
textFieldEnabled: Boolean = true,
clickableEnabled: Boolean = true,
) {
Row(
modifier = Modifier
.shadow(
elevation = 10.dp,
shape = RoundedCornerShape(4.dp),
clip = false,
)
.background(
color = Color.White,
shape = RoundedCornerShape(4.dp),
)
.clickable(
enabled = clickableEnabled,
onClick = { onContentRemove(index) },
)
.padding(10.dp),
verticalAlignment = Alignment.CenterVertically,
horizontalArrangement = Arrangement.spacedBy(8.dp),
) {
BasicTextField(
value = word,
onValueChange = { newValue ->
onValueChanged(newValue, index)
},
modifier = Modifier
.width(IntrinsicSize.Min),
enabled = textFieldEnabled,
)
if (removeIconVisible) {
Icon(
imageVector = Icons.Outlined.Cancel,
contentDescription = stringResource(R.string.des_remove_blank),
tint = MaterialTheme.colorScheme.onSurfaceVariant,
)
}
}
}
해당 블로그 등 많은 블로그가 언급하는 imePadding을 적용해도 여전히 키보드에 가려지는 오류가 발생하였다.
대신 imePadding 덕에 아래에 공간이 생겨 텍스트를 입력할 수는 있게 되었다.
하지만 근본적인 해결법이 되지는 못하므로, 추가적인 해결방법을 고민해야했다.