我正在写一个需要底角半径的应用程序。您可以在Google Task应用程序中看到类似的内容。

这是我的代码

showModalBottomSheet(
        context: context,
        builder: (builder) {
          return new Container(
            height: 350.0,
            color: Colors.transparent,
            child: new Container(
                decoration: new BoxDecoration(
                    color: Colors.white,
                    borderRadius: new BorderRadius.only(
                        topLeft: const Radius.circular(10.0), topRight: const Radius.circular(10.0))),
                child: new Center(
                  child: new Text("This is a modal sheet"),
                )),
          );
        });

仍显示没有边框半径的图纸。
dart -  flutter 底片角半径-LMLPHP

好吧,我找到了原因。它确实显示了圆角,但是由于脚手架的背景颜色,容器的背景保持白色。
现在的问题是如何覆盖支架背景颜色。

最佳答案

对于仍在尝试解决此问题的用户:

由于某些原因Colors.transparent不起作用,因此您所需要做的就是将颜色更改为:Color(0xFF737373)

showModalBottomSheet(
        context: context,
        builder: (builder) {
          return new Container(
            height: 350.0,
            color: Color(0xFF737373),
            child: new Container(
                decoration: new BoxDecoration(
                    color: Colors.white,
                    borderRadius: new BorderRadius.only(
                        topLeft: const Radius.circular(10.0), topRight: const Radius.circular(10.0))),
                child: new Center(
                  child: new Text("This is a modal sheet"),
                )),
          );
        });

07-26 05:52
查看更多