[英]How do I bring the button closer to the Flutter
如图所示,第一个按钮、数字和第二个按钮之间有很大的差距。 我尝试使用和不使用容器,我在 body: Center 和 Listview 之间切换。 我非常希望箭头直接位于数字的上方和下方。
body: ListView(
children: <Widget>[
Container(
width: 350,
height: 36,
child: Row(children: <Widget>[
Text(
"ATH: " + highScore.toString(),
textAlign: TextAlign.right,
style: TextStyle(
fontSize: 30, color: Color.fromRGBO(0, 136, 255, 70)),
),
Spacer(),
Text(
Score.toString(),
textAlign: TextAlign.right,
style: TextStyle(
fontSize: 30, color: Color.fromRGBO(0, 136, 255, 70)),
)
]),
),
IconButton(
onPressed: PfeilHoch,
alignment: Alignment.bottomCenter,
icon: Icon(Icons.arrow_drop_up),
iconSize: 350,
color: Color.fromRGBO(0, 300, 0, 100),
padding: EdgeInsets.all(0),
),
Text(
(randomNumber.toString()),
textAlign: TextAlign.center,
style: TextStyle(fontSize: 90, ),
),
IconButton(
alignment: Alignment.topCenter,
onPressed: PfeilRunter,
icon: Icon(Icons.arrow_drop_down),
iconSize: 350,
color: Color.fromRGBO(300, 0, 0, 100),
padding: EdgeInsets.all(0),
),
],
)
它现在的样子
而不是 Listview 使用 Column 和 SingleScrollChild
这是因为 IconButton 是一个 Material Design 小部件,它遵循可点击对象每边至少需要 48px 的规范。 您可以从任何 IDE 中单击图标按钮实现
使用GestureDetector
代替IconButton
Container(
padding: const EdgeInsets.all(0.0),
height: 200,
width: 200,
child: GestureDetector(onTap: () {}, child: Icon(Icons.arrow_drop_up, size: 200) )
,
)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.