[英]overlay a widget flutter
我正在使用 flutter 编写应用程序。 我的问题是我必须用这样的卡片覆盖一个容器:
我不知道如何用文本食物覆盖小部件。
更新:
我尝试使用下面的代码,但没有得到我想要的结果。
class _ProductsScreenState extends State<ProductsScreen> {
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: kBackgroundColor,
body: Stack(
children: [
SafeArea(
child: Column(
children: [
TextNameApp(),
ContainerCard(
child: Column(
children: [
Positioned(
child: Container(
alignment: Alignment.topCenter,
padding: EdgeInsets.only(right: 20.0, left: 20.0),
child: Container(
height: 100.0,
width: 250.0,
child: Card(
color: Colors.white,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(45.0),
),
elevation: 4.0,
),
),
),
),
],
),
),
],
),
),
],
),
);
}
}
容器卡是我创建的一个小部件。 拥有同一个容器的function。
使用Stack
Widget,这里有更多信息。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.