首页 > 解决方案 > 覆盖一个小部件颤动

问题描述

我正在用颤振写一个应用程序。我的问题是我必须用这样的卡片覆盖一个容器:

图片

我不知道如何用文本食物覆盖小部件。

更新:

我尝试使用下面的代码,但没有得到我想要的结果。

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,
                            ),
                          ),
                        ),
                      ),
                    ],
                  ),
                ),
              ],
            ),
          ),
        ],
      ),
    );
  }
}

容器卡是我创建的一个小部件。具有与容器相同的功能。

这就是小部件现在的样子

标签: flutterdartwidget

解决方案


使用Stack小部件,更多信息在这里


推荐阅读