我正在编写一个应用程序,它需要一个带有圆角半径的 Bottom Sheet 。您可以在 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"),
)),
);
});
好吧,我找到了一个理由。它确实显示了圆角,但由于脚手架背景颜色,容器的背景保持白色。 现在的问题是如何覆盖脚手架背景颜色。
最佳答案
对于那些仍在努力解决这个问题的人:
由于某些原因 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"),
)),
);
});
关于dart - Flutter 底板圆角半径,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52347349/