本文介绍了移除Flutter Container中的填充> FlatButton的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望删除FlatButton的默认边距,但似乎无法设置/覆盖它.

I am looking to remove the default margin of the FlatButton but can't seem to set/override it.

Column(children: <Widget>[
      Container(
          children: [
            FractionallySizedBox(
              widthFactor: 0.6,
              child: FlatButton(
                  color: Color(0xFF00A0BE),
                  textColor: Color(0xFFFFFFFF),
                  child: Text('LOGIN', style: TextStyle(letterSpacing: 4.0)),
                  shape: RoundedRectangleBorder(side: BorderSide.none)))),
      Container(
          margin: const EdgeInsets.only(top: 0.0),
          child: FractionallySizedBox(
              widthFactor: 0.6,
              child: FlatButton(
                  color: Color(0xFF00A0BE),
                  textColor: Color(0xFF525252),
                  child: Text('SIGN UP',
                      style: TextStyle(
                          fontFamily: 'Lato',
                          fontSize: 12.0,
                          color: Color(0xFF525252),
                          letterSpacing: 2.0)))))
    ])

我遇到过ButtonTheme甚至debugDumpRenderTree()之类的东西,但是无法正确实现它们.

I've come across things like ButtonTheme and even debugDumpRenderTree() but haven't been able to implement them properly.

推荐答案

FlatButton(materialTapTargetSize: MaterialTapTargetSize.shrinkWrap,)

这篇关于移除Flutter Container中的填充&gt; FlatButton的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-23 04:24