首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >使AppBar透明并显示设置为全屏的背景图像

使AppBar透明并显示设置为全屏的背景图像
EN

Stack Overflow用户
提问于 2018-10-31 09:30:50
回答 12查看 135.8K关注 0票数 93

我在我的颤振应用程序中添加了AppBar。我的屏幕已经有了一个背景图像,我不想设置appBar颜色,也不希望将单独的背景图像设置为appBar。

我也想向appBar显示同样的屏幕背景图像。

我已经尝试过将appBar颜色设置为透明,但它显示的颜色像灰色。

示例代码:

代码语言:javascript
复制
appBar: new AppBar(
        centerTitle: true,
//        backgroundColor: Color(0xFF0077ED),
        elevation: 0.0,
        title: new Text(
            "DASHBOARD",
            style: const TextStyle(
                color:  const Color(0xffffffff),
                fontWeight: FontWeight.w500,
                fontFamily: "Roboto",
                fontStyle:  FontStyle.normal,
                fontSize: 19.0
            )),
      )

EN

Stack Overflow用户

发布于 2022-01-04 20:56:15

可能有许多情况,例如,您是否希望保持AppBar,无论您是否希望使状态栏可见,为此,您可以将Scaffold.body包装在SafeArea中,如果您希望AppBar没有任何阴影(与我在示例2中提供的红色不同),您可以将其颜色设置为Colors.transparent

  • 完整图像(没有AppBar)

支架( extendBodyBehindAppBar: true,body: SizedBox.expand(儿童: Image.network( 'https://wallpaperaccess.com/full/3770388.jpg',fit: BoxFit.cover,),)

  • 完整图像(使用AppBar)

支架( extendBodyBehindAppBar: true,appBar: AppBar( backgroundColor: Colors.transparent,shadowColor: Colors.red,标题: Text('MyApp'),),body: SizedBox.expand( child: Image.network( https://wallpaperaccess.com/full/3770388.jpg',fit: BoxFit.cover,),)

票数 7
EN
查看全部 12 条回答
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/53080186

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档