【问题标题】:How can I remove shadow above AppBar for Android in Flutter?如何在 Flutter 中移除 AppBar for Android 上方的阴影?
【发布时间】:2021-10-30 22:44:04
【问题描述】:

如何在 Flutter 中移除 AppBar for Android 上方的阴影?在 iOS 模拟器上,以下代码可以正常工作。

代码:

    return Scaffold(
        extendBodyBehindAppBar: true,
        appBar: AppBar(
          backgroundColor: Colors.transparent,
          shadowColor: Colors.transparent,
          elevation: 0.0,
          title: Text('Title'),
        ),
        body: Container(
          decoration: BoxDecoration(
            image: DecorationImage(
              image: AssetImage('images/background_01.jpg'),
              fit: BoxFit.cover,
            ),
          ),
          child: SafeArea(
            child: Column(
              children: [
                Container(),
                Container(),
              ],
            ),
          ),
        ));

【问题讨论】:

    标签: android flutter shadow appbar


    【解决方案1】:

    它的状态栏尝试改变状态栏

    【讨论】:

      【解决方案2】:

      将您的安全区域作为整个小部件的父级移动。有关安全区域的更多信息,请参见此处https://api.flutter.dev/flutter/widgets/SafeArea-class.html

      return SafeArea(
        child: Scaffold(
            extendBodyBehindAppBar: true,
            appBar: AppBar(
              backgroundColor: Colors.transparent,
              shadowColor: Colors.transparent,
              elevation: 0.0,
              title: Text('Title'),
            ),
            body: Container(
              decoration: BoxDecoration(
                image: DecorationImage(
                  image: AssetImage('images/background_01.jpg'),
                  fit: BoxFit.cover,
                ),
              ),
              child: Column(
                children: [
                  Container(),
                  Container(),
                ],
              ),
            )),
      );
      

      【讨论】:

        猜你喜欢
        • 2018-08-07
        • 1970-01-01
        • 1970-01-01
        • 2015-04-28
        • 2017-09-06
        • 2015-10-11
        • 1970-01-01
        • 1970-01-01
        • 2015-10-12
        相关资源
        最近更新 更多