【问题标题】:overlay a widget flutter覆盖一个小部件颤动
【发布时间】:2021-07-12 05:34:30
【问题描述】:

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

image

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

更新:

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

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

【问题讨论】:

  • 您可以使用 Stack 小部件。

标签: flutter dart widget


【解决方案1】:

使用Stack Widget,更多信息here

【讨论】:

    猜你喜欢
    • 2021-06-27
    • 1970-01-01
    • 2019-10-29
    • 1970-01-01
    • 2021-04-01
    • 2010-12-09
    • 1970-01-01
    • 2012-04-10
    • 2019-08-22
    相关资源
    最近更新 更多