颤振:AppBar背景图片

问题描述 投票:3回答:1

是否可以在Scaffold的AppBar中添加背景图像?我知道条子但是当你向下滚动时,图像会被隐藏,而AppBar会改变颜色吗?所以我想知道这是否可能,如果没有,是否有任何现有的解决方法?谢谢!

dart flutter appbar
1个回答
7
投票
Widget build(BuildContext context) {

return new Container(
  child: new Stack(children: <Widget>[
    new Container(
      child: new Image.asset('assets/appimage.jpg'),
      color: Colors.lightGreen,
    ),
    new Scaffold(
      appBar: new AppBar(title: new Text('Hello'),
      backgroundColor: Colors.transparent,
        elevation: 0.0,
      ),
      backgroundColor: Colors.transparent,
      body: new Container(
        color: Colors.white,
        child: new Center(
        child: new Text('Hello how are you?'),),)
    )
  ],),
);
}
© www.soinside.com 2019 - 2024. All rights reserved.