gpt4 book ai didi

flutter - flutter 我如何连续外星图标

转载 作者:行者123 更新时间:2023-12-03 03:55:48 24 4
gpt4 key购买 nike

My current screen

how I want it to lock like this made manually

如何使图标行在左边框旁边排成一行?

我的代码是:

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

最佳答案

尝试这种方式将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

关于flutter - flutter 我如何连续外星图标,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61371217/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com