首页 > 解决方案 > Flutter:忽略图标的空间

问题描述

我试图在我的应用程序的左上角或右上角创建一个设置图标。我通过资产图像为设置添加了图标,但我知道我的完整应用程序已向下移动以为图标腾出空间。

我很陌生,所以我不知道如何让我的应用程序的其余部分忽略图标。

感谢帮助!

https://i.stack.imgur.com/DH8JY.png

标签: flutterandroid-studiodartflutter-layout

解决方案


也许您正在使用 IconButton,它具有默认填充,

尝试使用InkWell

InkWell( 
   child: Icon(Icons.setting)
)

或使用堆栈

Stack(
  children: [
     *** your body ***
     IconButton(icon: Icon(Icons.settings), onPressed: () {})
    ]
 )

推荐阅读