flutter 如何在大小框占空抖动时完整显示文本

vm0i2vca  于 2023-05-19  发布在  Flutter
关注(0)|答案(2)|浏览(152)

我在我的文本窗口小部件之间使用了Expanded(Sizedbox()),然后发生了以下情况:

我怎样才能避免我的经文发生这样的事呢?
这是我的代码:

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,
                  ),
                ),
              ],
            ),
          )

当我在我的文本小部件之间使用Expanded(Sizedbox())时,我的文本dosent显示正确示例:等待存款显示等待中

cdmah0mi

cdmah0mi1#

尝试https://dartpad.dev/?id=edbb1d02d20b7d7d22168782b224a6c8调整右侧大小以模拟小屏幕
代替扩展使用的装配盒,\n如

FittedBox(
              fit: BoxFit.fitWidth,
            child: Text(
            'Awaiting\nDeposit',
            //style: regularTextStyle.copyWith(fontSize: 12),
            textAlign: TextAlign.center,
            maxLines: 2,
          )),
laawzig2

laawzig22#

在文本小部件中使用softWrap:true。

相关问题