skip to Main Content

i used Expanded(Sizedbox()) between my Text Widgets and this happended :

enter image description here

How can i prevent what that happened for my Text ?

this is my code :

Padding(
            padding: const EdgeInsets.symmetric(vertical: 8),
            child: Row(
              mainAxisAlignment: MainAxisAlignment.center,
              crossAxisAlignment: CrossAxisAlignment.center,
              children: [
                Expanded(
                  child: Text(
                    'Awaiting Deposit',
                    style: regularTextStyle.copyWith(fontSize: 12),
                    textAlign: TextAlign.center,
                    maxLines: 2,
                  ),
                ),
                Expanded(child: SizedBox()),
                Expanded(
                  child: Text(
                    'Awaiting Confirmation',
                    style: regularTextStyle.copyWith(fontSize: 12),
                    textAlign: TextAlign.center,
                    maxLines: 2,
                  ),
                ),
                Expanded(child: SizedBox()),
                Expanded(
                  child: Text(
                    'Perform Exchange',
                    style: regularTextStyle.copyWith(fontSize: 12),
                    textAlign: TextAlign.center,
                    maxLines: 2,
                  ),
                ),
                Expanded(child: SizedBox()),
                Expanded(
                  child: Text(
                    'Done',
                    style: regularTextStyle.copyWith(fontSize: 12),
                    textAlign: TextAlign.center,
                    maxLines: 2,
                  ),
                ),
              ],
            ),
          )

when i Used Expanded(Sizedbox()) between my text Widgets my text dosent show properly
example :
awaiting Deposit shows awaitin g ….

2

Answers


  1. Try https://dartpad.dev/?id=edbb1d02d20b7d7d22168782b224a6c8 resize the right side to emulate small screen

    In place of Expanded Use Fitted Box with n like

               FittedBox(
                  fit: BoxFit.fitWidth,
                child: Text(
                'AwaitingnDeposit',
                //style: regularTextStyle.copyWith(fontSize: 12),
                textAlign: TextAlign.center,
                maxLines: 2,
              )),
    
    Login or Signup to reply.
  2. Use softWrap:true inside Text widget.

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