Recently I observed that in few Android apps on clicking the field of credit card input, there comes an option of "Scan a new card" & after scanning it fills the input field with card details. How can I do it in my app for compose
I have tried using autoFill
modifier but it didn't work.
autofillTypes: List<AutofillType>,
onFill: ((String) -> Unit),
) = composed {
val autofill = LocalAutofill.current
val autofillNode = AutofillNode(onFill = onFill, autofillTypes = autofillTypes)
LocalAutofillTree.current += autofillNode
this.onGloballyPositioned {
autofillNode.boundingBox = it.boundsInWindow()
}.onFocusChanged { focusState ->
autofill?.run {
if (focusState.isFocused) {
requestAutofillForNode(autofillNode)
} else {
cancelAutofillForNode(autofillNode)
}
}
}
}
Any idea on how can I achieve this ?
Sharing a screenshot of some other where I observed this
[![enter image description here][1]][1]
[1]: https://i.stack.imgur.com/F11cV.jpg