android - 颤振中的框架布局替代方案
问题描述
我想在另一个容器顶部添加一个颤振容器,顶部容器将是透明的。基本上我在原生 Android 中使用 FrameLayout 来做到这一点。如何在 Flutter 中实现这一点?
解决方案
Stack
很可能是你想要的。
Stack
允许将小部件放在其他人的顶部,但是你喜欢。并且,结合Positioned
,具有自定义职位。
让我们在颤振中绘制一个真实的框架:
Stack(
alignment: Alignment.center,
children: <Widget>[
Container(
width: 200.0,
height: 300.0,
decoration: BoxDecoration(
color: Colors.black12,
border: Border.all(
color: Colors.black,
width: 3.0,
),
),
),
Container(
width: 100.0,
height: 100.0,
color: Colors.blue,
),
Positioned(
bottom: 10.0,
right: 10.0,
child: Card(
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Text("Title"),
),
),
)
],
),
推荐阅读
- c# - 如何防止跟踪来自 TraceListener 中组件的内容?
- python - 有没有什么方法可以在 django 中使用相同的 url 和视图来更新和创建表单数据?
- python - Python在包内添加单元测试
- vba - 根据文本字段中的数据隐藏文本框 Microsoft Access
- git - 如何在 Theia 中重置 Git 凭据?
- python - djongo.models 没有属性 'ArrayModelField'
- mysql - SQL:有没有办法从多个查询中返回一行?
- windows - 无需调用即可批量将变量全部设为小写
- javascript - 函数返回值,如何取而代之的是字符串值
- python - 如何将日期行值转置到列标题中,并为不在输入中的日期引入列?