flutter - 如何在颤动中将容器绘制在屏幕宽度之外?
问题描述
如何创建一个带有圆角的容器,如下所示?我尝试使用宽度大于屏幕宽度的容器。但这将它限制在屏幕内。我尝试使用溢出框,但也无法获得相同的结果。我不想使用 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)),
),
),
),
);
}
推荐阅读
- python - 基于大多数正则表达式匹配的 Python CSV 正则表达式所有列和输出列列表索引号
- spring-data-cassandra - 创建名称为“productController”的 bean 时出错:通过字段“productRepository”表示的依赖关系不满足;
- python - matplotlib.pyplot x 值未按预期显示
- php - 图像未显示在 Blade.php 文件中
- android - 如何扫描并连接到一个片段中的蓝牙设备并读取另一个片段中的特征?
- sql - 基于 Microsoft SQL Server 中的模式与 groupby 一起使用时如何连接行?
- apache-spark - 在PySpark中动态生成连接条件作为列表时,如何在元素之间应用“OR”而不是“AND”?
- java - 错误:(14, 33) java: 无法访问 org.springframework.core.env.EnvironmentCapable
- bash - Git 钩子。如何从用户输入中读取变量?
- reactjs - 如何通过filepond最好地上传大量资源?