【问题标题】:How can I make a button's corner only rounded on the top?如何使按钮的角仅在顶部变圆?
【发布时间】:2019-04-07 21:37:58
【问题描述】:

我正在尝试制作一个顶部有圆角和底部有普通角的按钮。我怎样才能做到这一点?

【问题讨论】:

  • 阅读BorderRadius文档
  • 添加一些你尝试过的代码和你想要的截图..
  • 你可以使用BorderRadius.all而不是BorderRadius.only({Radius topLeft: Radius.zero, Radius topRight: Radius.zero, Radius bottomLeft: Radius.zero, Radius bottomRight: Radius.zero })
  • @Potato OP 只想要顶部的角落,所以 BorderRadius.vertical 会更容易

标签: dart flutter flutter-layout


【解决方案1】:

一般例子:

RaisedButton(
              onPressed: () {},
              shape: RoundedRectangleBorder(
                  borderRadius: BorderRadius.only(
                      topLeft: Radius.circular(15.0),
                      topRight: Radius.circular(15.0))),
              child: Text('Click Me!'),
              color: Colors.blueAccent,
              textColor: Colors.white,
            ),

根据 pskink 评论:

RaisedButton(
              onPressed: () {},
              shape: RoundedRectangleBorder(
                  borderRadius: BorderRadius.vertical(
                top: Radius.circular(15.0),
              )),
              child: Text('Click Me!'),
              color: Colors.blueAccent,
              textColor: Colors.white,
            ),

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2012-05-06
    • 2011-06-30
    • 2019-09-21
    • 2023-02-03
    • 2011-11-09
    • 1970-01-01
    • 1970-01-01
    • 2012-01-27
    相关资源
    最近更新 更多