how to sloved Text Overflowed in flutter

how to sloved Text Overflowed in flutter

Problem Description:

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

Solution – 1

wrap your Text widget with Expanded:

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

Solution – 2

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…

Rate this post
We use cookies in order to give you the best possible experience on our website. By continuing to use this site, you agree to our use of cookies.
Accept
Reject