将内容保留在 AppBar 之后

Keep the Content after the AppBar

我在我的项目中使用 extendBodyBehindAppBar: true,因为当用户滚动时 AppBar.

中有一个透明度

但是我有一个问题,就是如何将内容放在 AppBar 之后并在滚动时保持透明度。

Scaffold(
        backgroundColor: const Color.fromRGBO(240, 240, 240, 1),
        extendBodyBehindAppBar: true,
        extendBody: true,
        appBar: AppBar(
          elevation: 0,
          title: const Text(
            'O que visitar',
            style: TextStyle(
              color: Color.fromRGBO(11, 95, 119, 1),
            ),
          ),
          backgroundColor: const Color.fromRGBO(240, 240, 240, 0.9),
          iconTheme: Theme.of(context).primaryIconTheme,
        ),
        drawer: const DrawerWidget(),
        body: Container(
          child: Padding(
            padding: const EdgeInsets.only(left: 20),
            child: Column(
              children: [
                Expanded(
       
                ),
              ],
            ),
          ),
        ),
      ),

我已经尝试过 SafeArea 可以工作但是当滚动时 AppBar 没有透明度

如果你使用extendBodyBehindAppBar,你的body占据了整个屏幕的高度并且body似乎出现在Appbar的后面。所以在这种情况下,您可以在顶部应用填充作为 kToolBarHeight +(您的特定顶部填充)

const EdgeInsets.only(top: kToolBarHeight + 16)