skip to Main Content

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

2

Answers


  1. wrap your Text widget with Expanded:

    Expanded(
     child: Text(
          'Reason :',
             style:
              TextStyle(fontSize: 16.0, fontWeight: FontWeight.w600),
            ),)
    
    Login or Signup to reply.
  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…

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