首页 > 解决方案 > 颤振如何摆脱图标填充?

问题描述

我在 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,
                ),
              ),
            ),
          ),
        ],
      ),

请问有什么和我有区别的解决方案吗?

当前图像

我希望它非常接近

标签: flutterflutter-layout

解决方案


您可以使用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,
                ),
              ),
            ],
          )

输出

在此处输入图像描述


推荐阅读