我如何修改领先和行动与IconButton边距/位置在appbar?什么是leading和IconButton
的默认边距我可以只pust leading和title中的action with row,但我想要更干净的代码,所以我尝试使用leading:
title:
actions:
,但leading & actions不在body中的内容行中,body有margin:24左右我很难从一开始就使用leading:
title:
actions:
在flutter中编写代码
我的意思是使引导和动作与身体一致
这是我的appbar代码
appBar: AppBar(
iconTheme: IconThemeData(color: Colors.black),
backgroundColor: Colors.white,
elevation: 1,
titleSpacing: 0,
automaticallyImplyLeading: false,
leading: IconButton(
onPressed: () {},
icon: Icon(Icons.chevron_left),
),
title: Text(
'City Guide',
style: Constants.textAppBar3,
),
actions: [
IconButton(
onPressed: () {},
icon: Image.asset(
'assets/images/icon/icon_search.png',
width: 24,
height: 24,
),
),
IconButton(
onPressed: () {},
icon: Image.asset(
'assets/images/icon/icon_save.png',
width: 24,
height: 24,
),
),
IconButton(
onPressed: () {},
icon: Image.asset(
'assets/images/icon/icon_ticket.png',
width: 24,
height: 24,
),
),
],
),
3条答案
按热度按时间qhhrdooz1#
IconButton
具有图标的大小(默认值为24),并具有**padding(constrains-min)**本身以创建手势空间。按钮的大小是48,这意味着图标按钮的填充是12,你的身体填充是24,所以我们需要更多的12,尝试用Padding
和left: 12
Package 你的领导示例x1c 0d1xx 1c 1d 1x
xfyts7mz2#
试试这个
k75qkfdt3#
问题是IconButton小部件中的内置填充。在IconButton上使用这个。
如果需要更多的填充,可以根据需要修改EdgeInsets。