如何在颤振中在屏幕宽度之外绘制容器?

Roy*_*fin 5 dart flutter

如何创建带有圆角的容器,如下所示?我尝试使用宽度大于屏幕宽度的容器。但这限制了它在屏幕内。我尝试使用 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)),
    ),
  ),
);
}
Run Code Online (Sandbox Code Playgroud)

结果

Roy*_*fin 9

通过使用比例变换,我已经成功地获得了与我想要的类似的结果。但希望看到不同的方法。

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)),
      ),
    ),
  ),
);
}
Run Code Online (Sandbox Code Playgroud)

在此输入图像描述


R. *_*man -1

我相信你应该在容器内使用 SafeArea 来填充它。像这样:

Container(
  color: Colors.blue,
  child: SafeArea(child: ### // you nav or functions),
),


Run Code Online (Sandbox Code Playgroud)

请参阅: https: //api.flutter.dev/flutter/widgets/SafeArea-class.html