gpt4 book ai didi

checkbox - flutter 复选框不需要的触摸空间

转载 作者:IT老高 更新时间:2023-10-28 12:40:51 24 4
gpt4 key购买 nike

我尝试使用 flutter 创建登录屏幕,在那里我添加了记住我复选框,但我无法正确对齐它,

Flutter 复选框在其周围占据了不需要的空间,以提供良好的触摸用户体验。

这是我的布局显示方式,

enter image description here

检查下面的代码,

        new Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
new Row(
children: <Widget>[
new Checkbox(
activeColor: Colors.grey,
value: _isChecked,
onChanged: (bool value) {
_onChecked(value);
},
),
new GestureDetector(
onTap: () => print("Remember me"),
child: new Text(
"Remember me",
style: new TextStyle(color: Colors.white70),
),
)
],
),
new Text(
"Forgot password ?",
style: new TextStyle(color: Colors.white70),
)
],
),

最佳答案

使用 SizedBox
该小部件基本上是为调整其子级大小而设计的。

SizedBox(
width: 15,
height: 15,
child: Checkbox(value: false, onChanged: null)
)

关于checkbox - flutter 复选框不需要的触摸空间,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50486675/

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