我在Stackoverflow上发布了解决方案
但它仍然水平有一个空间
我想将这些图标设置得非常接近
我的代码是这个
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
MediaQuery.removePadding(
context: context,
removeLeft: true,
removeRight: true,
child: GestureDetector(
onTap: () {},
child: Container(
padding: const EdgeInsets.all(0.0),
width: 30.0,
child: IconButton(
icon: Icon(
Icons.keyboard_arrow_right,
color: Color(0xff60B906),
),
color: Color(0xff60B906),
iconSize: 30,
),
),
),
),
MediaQuery.removePadding(
context: context,
removeLeft: true,
removeRight: true,
child: GestureDetector(
onTap: () {},
child: Container(
padding: const EdgeInsets.all(0.0),
width: 30.0,
child: IconButton(
icon: Icon(
Icons.keyboard_arrow_right,
color: Color(0xff60B906),
),
color: Color(0xff60B906),
iconSize: 30,
),
),
),
),
],
),
请问有什么不同的解决方案吗?
而且我希望它非常接近
您可以使用Stack
小部件
样本代码
Stack(
alignment: Alignment.center,
children: <Widget>[
IconButton(
onPressed: null,
icon: Icon(
Icons.keyboard_arrow_right,
color: Color(0xff60B906),
),
color: Color(0xff60B906),
iconSize: 30,
),
Positioned(
right: 20,
child: IconButton(
onPressed: null,
icon: Icon(
Icons.keyboard_arrow_right,
color: Color(0xff60B906),
),
color: Color(0xff60B906),
iconSize: 30,
),
),
],
)
输出