1

I want to show a validation message in a overlay box at the nearest of textformfield . Can you help me? I want like this.This image shows what I want

User
  • 105
  • 10

2 Answers2

1

Try below code using Tooltip Widget hope its help to you refer Tooltip Widget here

 TextFormField(
            textCapitalization: TextCapitalization.sentences,
            decoration: InputDecoration(
              border: OutlineInputBorder(),
              labelText: 'Name',
              hintText: 'Card Holder Name',
              suffixIcon: Tooltip(
                message: 'Required',
               
                child: Icon(
                  Icons.info,
                ),
              ),
            ),
          ),

Result of your screen enter image description here

Ravindra S. Patil
  • 11,757
  • 3
  • 13
  • 40
0

Result you can use errorStyle to modify

enter image description here

Code snippet

 Padding(
              padding: const EdgeInsets.all(8.0),
              child: TextField(
                controller: controller,
                decoration: InputDecoration(
                  border: OutlineInputBorder(),
                  errorText: _isError? " required" : null,
                ),
              ),
            ),
Md. Yeasin Sheikh
  • 54,221
  • 7
  • 29
  • 56