1

I am using OutlinedTextField.

  1. The placeholder should be placed in the center of the TextField.
  2. The cursor should be positioned in front of the placeholder when the placeholder is visible.
  3. When the placeholder is not visible, the cursor should be located behind the entered text.
OutlinedTextField(
    ~~~
    textStyle = TextStyle(
        textAlign = TextAlign.~~
      
    ),
    placeholder = {
        Text(~~~)
    }
)

When I write code like above, the cursor position is visible from the position I set as textAlign. Overlapped with placeholder. How can I solve this? Do I need to use BasicTextField?
It seems that the cursor position can be changed using the selection of TextFieldValue.Thread
But I'm not sure how to position it before the placeholder.

tuuks
  • 19
  • 3
  • *"The cursor should be positioned in front of the placeholder when the placeholder is visible"*. If the placeholder is centered, it means in the center of the TextField? *"the cursor should be located behind the entered text", does it mean at the start of the text? – Gabriele Mariotti Nov 15 '22 at 12:11
  • "If the placeholder is centered, it means in the center of the TextField?" - Yes placeholder is positioned the center of the TextField. And cursor need to be positioned at the start of the placeholder. ""the cursor should be located behind the entered text", does it mean at the start of the text" - No. at the end of the text. - ex) a b c d | – tuuks Nov 15 '22 at 12:25

0 Answers0