skip to Main Content

I am getting issues when focusing on multiple lines of placeholder text fields the cursor overlaps with placeholder text while it is working fine with single-line.

TextField(
  keyboardType: TextInputType.multiline,
  maxLines: question.fieldType == "textarea" ? 4 : 1,
  decoration: InputDecoration(label: Text('${question.fieldLabel}')),
)

enter image description here
enter image description here

2

Answers


  1. try this

    TextField(
      keyboardType: TextInputType.multiline,
      maxLines: question.fieldType == "textarea" ? 4 : 1,
      decoration: InputDecoration(
        label: Text('${question.fieldLabel}'),
      ),
      textAlignVertical: TextAlignVertical.top,
    )
    

    here the cursor will be positioned at the top of the text field, preventing it from overlapping with the placeholder text.

    and let us know any.

    Login or Signup to reply.
  2. Refer this
    https://www.geeksforgeeks.org/multiline-textfield-in-flutter/
    Hope this will give you the solution.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search