覆盖小部件颤动

时间:2021-04-17 12:06:22

标签: flutter dart widget

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

image

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

更新:

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

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

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

this is how the widget is now

1 个答案:

答案 0 :(得分:0)

使用 Stack 小部件,更多信息 here