翩翩起舞 我怎么能连续异化一个图标呢?

问题描述 投票:0回答:1

我的当前屏幕,

我怎么想它锁定像这样的手动制作

如何让左边边框旁边的那行图标排成一排?

我的代码是

Container(
        width: MediaQuery.of(context).size.width,
        height: MediaQuery.of(context).size.height / 13,
        alignment: AlignmentDirectional.centerStart,
        child: Row(
          children: <Widget>[
            SizedBox(width: 25.0),
            Text(
              "hello world"
            ),
            SizedBox(width: getWidth() * 185.0),
            Align(
              alignment: Alignment.centerLeft,
              child: Icon(
                Icons.check,
                size: 20,
                color: Colors.grey,
              ),
            ),
          ],
        ),
      ),
flutter dart
1个回答
0
投票

试试这样包装你的 Text 小部件 Expanded() 小部件

Container(
          width: MediaQuery.of(context).size.width,
          height: MediaQuery.of(context).size.height / 13,
          alignment: AlignmentDirectional.centerStart,
          child: Row(
            children: <Widget>[
              SizedBox(width: 25.0),
              Expanded(
                child: Text(
                    "hello world"
                ),
              ),
              SizedBox(width: 20),
              Align(
                alignment: Alignment.centerLeft,
                child: Icon(
                  Icons.check,
                  size: 20,
                  color: Colors.grey,
                ),
              ),
              SizedBox(width: 20),
            ],
          ),
        )

输出

enter image description here

© www.soinside.com 2019 - 2024. All rights reserved.