我想showModalBottomSheet在 Flutter 中制作一个带有容器的容器。我希望这个容器有圆形的顶部边框,但是,当我尝试这个时,角落里有一些小的无色空间。我怎样才能删除它们?
这是我使用的代码:
class OverlayWidget extends StatelessWidget {
@override
Widget build(BuildContext context) {
return ElevatedButton(
child: const Text('showModalBottomSheet'),
onPressed: () {
showModalBottomSheet(
context: context,
isScrollControlled: true,
builder: (BuildContext context) {
return Container(
height: MediaQuery.of(context).size.height * 0.80,
decoration: BoxDecoration(
color: Colors.green,
borderRadius: BorderRadius.only(
topLeft: Radius.circular(30.0),
topRight: Radius.circular(30.0),
),
),
child: Center(...),
);
},
);
},
);
}
}
Run Code Online (Sandbox Code Playgroud)
我想删除顶部边框的空白。谢谢。
查看文档,我意识到该showModalBottomSheet<T>函数有一个名为backgroundColor\xe2\x80\x8d\xe2\x99\x80\xef\xb8\x8f 的属性
只需添加:
\nbackgroundColor: Colors.transparent,\nRun Code Online (Sandbox Code Playgroud)\n到showModalBottomSheet作品。
不管怎样,谢谢你的帮助!
\n| 归档时间: |
|
| 查看次数: |
3245 次 |
| 最近记录: |