mirror of
https://github.com/mihonapp/mihon.git
synced 2025-02-23 15:34:09 +01:00
Lambda
This commit is contained in:
parent
1c5a4d223c
commit
f94183142f
@ -149,34 +149,28 @@ private fun <T> WheelPicker(
|
|||||||
}
|
}
|
||||||
|
|
||||||
val scope = rememberCoroutineScope()
|
val scope = rememberCoroutineScope()
|
||||||
|
val processManualInput: () -> Unit = {
|
||||||
|
scope.launch {
|
||||||
|
items
|
||||||
|
.indexOfFirst { it.toString() == value.text }
|
||||||
|
.takeIf { it >= 0 }
|
||||||
|
?.apply {
|
||||||
|
internalOnSelectionChanged(this)
|
||||||
|
lazyListState.scrollToItem(this)
|
||||||
|
}
|
||||||
|
showManualInput = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
BasicTextField(
|
BasicTextField(
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.align(Alignment.Center)
|
.align(Alignment.Center)
|
||||||
.showSoftKeyboard(true)
|
.showSoftKeyboard(true)
|
||||||
.clearFocusOnSoftKeyboardHide {
|
.clearFocusOnSoftKeyboardHide {
|
||||||
scope.launch {
|
processManualInput()
|
||||||
items
|
|
||||||
.indexOfFirst { it.toString() == value.text }
|
|
||||||
.takeIf { it >= 0 }
|
|
||||||
?.apply {
|
|
||||||
internalOnSelectionChanged(this)
|
|
||||||
lazyListState.scrollToItem(this)
|
|
||||||
}
|
|
||||||
|
|
||||||
showManualInput = false
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
onKeyboardAction = {
|
onKeyboardAction = {
|
||||||
scope.launch {
|
processManualInput()
|
||||||
items
|
|
||||||
.indexOfFirst { it.toString() == value.text }
|
|
||||||
.takeIf { it >= 0 }
|
|
||||||
?.apply {
|
|
||||||
internalOnSelectionChanged(this)
|
|
||||||
lazyListState.scrollToItem(this)
|
|
||||||
}
|
|
||||||
showManualInput = false
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
state = value,
|
state = value,
|
||||||
lineLimits = TextFieldLineLimits.SingleLine,
|
lineLimits = TextFieldLineLimits.SingleLine,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user