Home > Blockchain >  how to sloved Text Overflowed in flutter
how to sloved Text Overflowed in flutter

Time:11-19

I have added text widget inside row widget.then 2nd text value

Text(
                      widget.leavemodel.reason ?? '',
                      style: TextStyle(
                        fontSize: 16.0,
                      ),

getting 4 pixcel overflowed.how can i sloved this?

code is bello

 Row(
                children: [
                  Text(
                    'Reason :',
                    style:
                        TextStyle(fontSize: 16.0, fontWeight: FontWeight.w600),
                  ),
                  Padding(
                    padding: const EdgeInsets.only(left: 15.0),
                    child: Text(
                      widget.leavemodel.reason ?? '',
                      style: TextStyle(
                        fontSize: 16.0,
                      ),
                    ),
                  ),
                ],
              ),

solution for text overflowed in flutter

CodePudding user response:

two ways:

  1. Box Constraints box constraint enter image description here
  2. Wrap widget instead of the row enter image description here enter image description here

BEST WAY HERE THOUGH IS TO USE A WRAP WIDGET...

CodePudding user response:

wrap your Text widget with Expanded:

Expanded(
 child: Text(
      'Reason :',
         style:
          TextStyle(fontSize: 16.0, fontWeight: FontWeight.w600),
        ),)
  • Related