Flutter 如何使按钮更靠近颤振
如图所示,第一个按钮、数字和第二个按钮之间存在巨大的差距。我尝试使用和不使用容器,我在body:Center和Listview之间切换。我非常希望箭头直接位于数字的上方和下方Flutter 如何使按钮更靠近颤振,flutter,dart,button,flutter-layout,flutter-widget,Flutter,Dart,Button,Flutter Layout,Flutter Widget,如图所示,第一个按钮、数字和第二个按钮之间存在巨大的差距。我尝试使用和不使用容器,我在body:Center和Listview之间切换。我非常希望箭头直接位于数字的上方和下方 body: ListView( children: <Widget>[ Container( width: 350, height: 36, child: Row(children:
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),
),
],
)
body:ListView(
儿童:[
容器(
宽度:350,
身高:36,
子对象:行(子对象:[
正文(
“ATH:+highScore.toString(),
textAlign:textAlign.right,
样式:TextStyle(
fontSize:30,color:color.fromRGBO(0136255,70)),
),
垫片(),
正文(
Score.toString(),
textAlign:textAlign.right,
样式:TextStyle(
fontSize:30,color:color.fromRGBO(0136255,70)),
)
]),
),
图标按钮(
已发布:PfeilHoch,
对齐:对齐.bottomCenter,
图标:图标(图标。箭头下拉),
iconSize:350,
颜色:color.fromRGBO(0,300,0,100),
填充:边缘集。全部(0),
),
正文(
(randomNumber.toString()),
textAlign:textAlign.center,
样式:TextStyle(字体大小:90,),
),
图标按钮(
对齐:alignment.topCenter,
按下:PfeilRunter,
图标:图标(图标。箭头下拉),
iconSize:350,
颜色:颜色。来自RGBO(300,0,0,100),
填充:边缘集。全部(0),
),
],
)
现在看起来怎么样
使用带有SingleScrollChild的Column代替Listview,这是因为IconButton是一个材质设计小部件,它遵循如下规范:可点击对象的每侧至少需要48px。您可以从任何IDE单击图标按钮实现 使用
手势检测器
代替图标按钮
Container(
padding: const EdgeInsets.all(0.0),
height: 200,
width: 200,
child: GestureDetector(onTap: () {}, child: Icon(Icons.arrow_drop_up, size: 200) )
,
)
谢谢你的意思是像
body:SingleChildScrollView(child:Column)(childs:[Container(
?如果我没有做错什么,这并没有真正关闭缝隙,我实现了它。我给容器上色,这样我可以更好地解释我要做什么。无论如何,我可以将底部箭头放在红色容器中更高的位置吗?这样底部箭头和文本之间的距离就像距离一样在顶部箭头和文本之间的ce。我也应用了许多解决方案,但没有其他方法