【问题标题】:How to set Flutter AppBar Transparent without the Status bar如何在没有状态栏的情况下设置 Flutter AppBar 透明
【发布时间】:2021-10-28 22:39:46
【问题描述】:

我尝试使用设置一个透明的应用栏。

return Scaffold(
  extendBodyBehindAppBar: true,
      appBar: AppBar(
      backgroundColor: Colors.transparent,
      elevation: 0.0,
  ),
)

当我添加安全区域小部件时,状态栏会变暗。未显示时间和其他指标。

如何在不使用状态栏的情况下使用 Flutter 仅设置 AppBar 透明?

【问题讨论】:

    标签: android ios flutter mobile flutter-layout


    【解决方案1】:

    您可以尝试使用 Stack 小部件来达到您的目的:

               Scaffold(
                body: Stack(
                  children: <Widget>[
                    Scaffold(
                      backgroundColor: Colors.transparent,
                      extendBodyBehindAppBar: true,
                      appBar: AppBar(
                        centerTitle: true,
                        title: Text(
                          "Transparent AppBar",
                          style: TextStyle(color: Colors.red),
                        ),
                        backgroundColor: Colors.transparent,
                        elevation: 0.0,
                      ),
                      body: SingleChildScrollView(
                        child: Column(
                          children: [
                            new Placeholder(
                              fallbackHeight: 500,
                              color: Colors.red,
                            ),
                            new Placeholder(
                              fallbackHeight: 500,
                              color: Colors.green,
                            ),
                          ],
                        ),
                      ),
                    ),
                  ],
                ),
              )
    

    【讨论】:

      猜你喜欢
      • 2020-04-06
      • 1970-01-01
      • 2018-11-03
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-07-18
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多