0

I am using InputDecoration to put a hint text in Flutter App. But when I run the app, the text overflown which is not I want as it does not help the user to do it.

decoration: InputDecoration(
    contentPadding: EdgeInsets.fromLTRB(10, 0, 10, 0),
    hintText: 'Enter in numbers (gram)',
    helperText: 'Select teaspoon or tablespoon and click "Calculate" button for Water',
    border: OutlineInputBorder(),
    icon: Icon(Icons.send),
),

I have tried to use Text function at helperText but it has error where Text argument cannot be converted into String. I would prefer to do in InputDecoration rather than using Text function separately. Thanks in advance

3
  • Why not add some small helper Text, Its too long Commented Apr 19, 2021 at 9:09
  • how do you want it to be exactly? show text in 2 lines? Commented Apr 19, 2021 at 9:53
  • @s_erfani - Yes, I want the text to appear in 2 lines so that it does not overflown. Bensal - I will consider it because I want to put instruction to user when they first using it Commented Apr 20, 2021 at 2:52

1 Answer 1

2

You can add helperMaxLine:

InputDecoration(
            contentPadding: EdgeInsets.fromLTRB(10, 0, 10, 0),
            hintText: 'Enter in numbers (gram)',
            helperText: 'Select teaspoon or tablespoon and click "Calculate" button for Water',
            helperMaxLines: 2,
            border: OutlineInputBorder(),
            icon: Icon(Icons.send),
          ),
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.