flutter - 颤振如何摆脱图标填充?
问题描述
我在 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,
),
),
],
)
输出
推荐阅读
- spring-cloud-dataflow - spring数据云,测试任务,在kubernetes上运行,抛出maven repo错误
- angular - 如何构建一个大型 Angular 库
- python - PyQt5、Tensorflow、Keras 和 PyInstaller 的兼容版本集
- javascript - Ajax 请求保持在 readyState=1
- assembly - x86-64 程序集 XMM1 寄存器丢失其值
- python-3.x - 为什么小数和仍然有浮点错误?
- docker - 如何将 docker 映像连接到 docker-composed 网络
- amazon-web-services - 如何使用 AWS Elastic Beanstalk 创建 Ubuntu 服务器应用程序?
- jquery - 如何使用 jquery 将 CSS 添加到 after 伪元素?
- electron - 如何在 Electron 环境中使用 nodegit