Flutter Can';在Widget中不能去掉垂直边距

Flutter Can';在Widget中不能去掉垂直边距,flutter,flutter-layout,Flutter,Flutter Layout,右边的按钮有问题圆形的绿色有一些垂直边缘(黄色),我不知道如何去除它,这让我发疯 我希望它像左边升起的按钮一样 这是创建以下内容的代码: Widget myWidget() { return Row ( mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: [ Container( color: Colors.red, child:

右边的按钮有问题圆形的绿色有一些垂直边缘(黄色),我不知道如何去除它,这让我发疯

我希望它像左边升起的按钮一样

这是创建以下内容的代码:

Widget myWidget() {
    return Row (
      mainAxisAlignment: MainAxisAlignment.spaceEvenly,
      children: [
        Container(
            color: Colors.red,
            child:
            RaisedButton(
              color: Colors.red,
              onPressed: () {},
              child: Container(child: Text("+")),
            )),
        Container(
          color: Colors.yellow,
          child:ClipOval(
              child: Container(
                  child:InkWell(
                      onTap: () {
                        setState((){
                          
                        });
                      },
                      child: myButton("+")
                  )
              )
          ),
        ),
以及myButton小部件:

Widget myButton(text) {
    return new Container(
      margin: EdgeInsets.only(left: 20.0, right: 20.0, top: 0, bottom: 0), //horizontal margin works but vertical margin is not impacted by whatever I put here
      padding: EdgeInsets.all(20),
      decoration: new BoxDecoration(
        shape: BoxShape.circle,
        color: Colors.green,
      ),
      child: new Text(text,
          style: new TextStyle(
              color: Colors.white,
              fontSize:
              50.0)),
    );
  }
Widget myButton(text) {//remove the margin that not needed
  return new Container(
    padding: EdgeInsets.all(20),
    decoration: new BoxDecoration(
      borderRadius: BorderRadius.circular(50),
      color: Colors.green,
    ),
    child: Center(
      child: new Text(text,
          style: new TextStyle(color: Colors.white, fontSize: 50.0)),
    ),
  );
}
父窗口小部件:

return Column(
      mainAxisAlignment: MainAxisAlignment.spaceAround,
      children: [
        Row(
          mainAxisAlignment: MainAxisAlignment.spaceEvenly,
          mainAxisSize: MainAxisSize.max,
          children: [
            Align(...),
            Align(...)
          ]
        ),
        Expanded(
          child: Card(
            child: InputControlParent(),
          ),
        ),
        Row(
          mainAxisAlignment: MainAxisAlignment.spaceEvenly,
          children: [
              myWidget() #<= child presented above
          ],
        )
      ],
    );
返回列(
mainAxisAlignment:mainAxisAlignment.spaceAround,
儿童:[
划船(
mainAxisAlignment:mainAxisAlignment.space,
mainAxisSize:mainAxisSize.max,
儿童:[
对齐(…),
对齐(…)
]
),
扩大(
孩子:卡片(
子项:InputControlParent(),
),
),
划船(
mainAxisAlignment:mainAxisAlignment.space,
儿童:[
myWidget()#父代码

 Widget myWidget() {
    return Row(
      mainAxisAlignment: MainAxisAlignment.spaceEvenly,
      crossAxisAlignment: CrossAxisAlignment.center,
      children: [
        Container(
            color: Colors.red,
            child: RaisedButton(
              color: Colors.red,
              onPressed: () {},
              child: Container(child: Text("+")),
            )),
        Container(
          height: 100,//i put height
          width: 100,// i put weidth
          color: Colors.yellow,
          child: InkWell(
              onTap: () {
                setState(() {});
              },
              child: myButton("+")),
        ),
      ])
myButton小部件:

Widget myButton(text) {
    return new Container(
      margin: EdgeInsets.only(left: 20.0, right: 20.0, top: 0, bottom: 0), //horizontal margin works but vertical margin is not impacted by whatever I put here
      padding: EdgeInsets.all(20),
      decoration: new BoxDecoration(
        shape: BoxShape.circle,
        color: Colors.green,
      ),
      child: new Text(text,
          style: new TextStyle(
              color: Colors.white,
              fontSize:
              50.0)),
    );
  }
Widget myButton(text) {//remove the margin that not needed
  return new Container(
    padding: EdgeInsets.all(20),
    decoration: new BoxDecoration(
      borderRadius: BorderRadius.circular(50),
      color: Colors.green,
    ),
    child: Center(
      child: new Text(text,
          style: new TextStyle(color: Colors.white, fontSize: 50.0)),
    ),
  );
}

现在让我吃惊的是,你给了它一个<代码>页边<代码>属性。如果你不想要<代码>页边<代码>,考虑删除它吗?@空隙我想要垂直边距离开而不是水平边距。你可以看到,我将垂直边距设置为0,并且它什么也不做。出于某些原因,移除水平边距确实有效。但是这不是我想要的:-)你能画出你想要的图像吗?这样我就可以解决它了。给按钮上方的小部件添加代码我没有投反对票,但原因可能是感觉偏离了。你认为你符合那里给出的所有建议吗?很好!谢谢!我将fontSize更新为40,高度/宽度更新为70/70以进行补偿。谢谢,一个y问题,尽管你的排名比我高,但你可以和我分享。这是一个只写代码的答案。有解释的答案往往会获得更多的选票。你改变了什么?新代码是如何工作的?为什么旧代码不工作?如果你解释了这一点,这个Q/a对未来的读者很有用,即使他们没有完全相同的问题,也必须修改请选择并调整相关部分。您需要为每个父容器指定高度。这就是请在答案中直接解释,而不是在注释中。解释您所做的更改是如何实现该概念的。在很长的一段时间内,您的解释中更多的词会做出更好的解释。只是很晚,exp语言太冗长了。