如何摆脱图标填充?

问题描述 投票:0回答:1

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

请问有什么不同的解决方案吗?

current image

而且我希望它非常接近

flutter flutter-layout
1个回答
0
投票

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

输出

enter image description here

© www.soinside.com 2019 - 2024. All rights reserved.