Flutter 项目实战 05AppBar 的背景图片,沉浸式状态栏背景

首先我们得状态栏透明,new AppBar(
backgroundColor: Colors.transparent,
elevation: 0, // 阴影0,这个很重要
),

算了,直接上代码吧,很简单的代码。

Scaffold(
      body: new Stack(
       children: <Widget>[
         new AppBar(
           backgroundColor: Colors.transparent,
           elevation: 0,
         ),
         new Positioned(
           child: new Container(
             height: FHAdapt.px(300),
             decoration: new BoxDecoration(
               image: new DecorationImage(
                   image: AssetImage('assets/images/team_header_bg.png'),
                   fit: BoxFit.fill
               ),
             ),

           ),
         ),
       ],
      ),
    );

猜你喜欢

转载自blog.csdn.net/u010755471/article/details/103123227
今日推荐