[英]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.