Александр Репин

    Александр Репин

    11 months ago
    Hello. What is the best way to decorate each symbol in text field? Each symbol in the text field should be in own composable. It should look like first is a round square, second is a circle and so on
    d

    dewildte

    11 months ago
    Can you explain in more detail what you are trying to do?
    Does this go beyond the capabilities of the
    VisualTransformation
    interface?
    Александр Репин

    Александр Репин

    11 months ago
    Hello, Eric, thank you for response. No,
    VisualTransformation
    does not fully meet my requirements. I need specific view for each symbol in the row
    Row
     -> Box1
     -> Box2
     -> Box2
    The controller of the view should track clicks on keyboard and add new character to the value. The only solution I found is to use multiple
    TextField
    , one for each
    BoxN
    . In this case the controller should move focus to another
    BoxN's TextField
    after value entered. But if do so, then I should somehow set caret position to the end when a
    BoxN
    clicked. And check that only the last empty
    BoxN
    is focused. There's another option - use one transparent
    TextField
    and display values. But it looks like a hack. @dewildte It should look like this
    d

    dewildte

    11 months ago
    So upon entering a valid character into the current box the focus needs to shift to the next box correct?
    This looks like you are expecting the user to enter some kind of verification PIN. Is that the usecase?
    You could set up a
    FocusRequester
    for each box. As the user enters valid characters you could use the requesters to shift focus to the next box as needed. I suggest ignoring any characters that are invalid. Once the last box contains valid text you can continue on with the rest of the user flow. Deletion can be handled as well by detecting certain key strokes and performing the needed operations in response.
    Zach Klippenstein (he/him) [MOD]

    Zach Klippenstein (he/him) [MOD]

    11 months ago
    I think the approaches you described are what other people in this channel have been doing. We’re working on improving the APIs for building this sort of stuff.