如何创建带有圆角的容器,如下所示?
我尝试使用宽度大于屏幕宽度的容器。但这限制了它在屏幕内。我尝试使用 OverFlow 框,但也无法获得相同的结果。我不想使用 clipRect 来制作这个,因为我想在角落上应用动画。
编辑:添加带有结果结果的容器片段以消除疑虑
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.black,
body: Align(
alignment: Alignment.bottomCenter,
child: Container(
height: 500,
decoration: BoxDecoration(
color: Colors.green, borderRadius: BorderRadius.circular(500)),
),
),
);
}
最佳答案
通过使用比例转换,我设法获得了与我想要的相似的效果。虽然希望看到不同的方法。
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.black,
body: Align(
alignment: Alignment.bottomCenter,
child: Transform.scale(
scale: 1.7,
child: Container(
height: 400,
decoration: BoxDecoration(
color: Colors.green, borderRadius: BorderRadius.circular(200)),
),
),
),
);
}
关于flutter - 如何在 flutter 中在屏幕宽度之外绘制容器?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57357023/