flutter 制作渐变色的appbar

  Widget build(BuildContext context) {
    return new Scaffold(
      appBar: PreferredSize(
        preferredSize: Size.fromHeight(50),
        child: Container(
          decoration: new BoxDecoration(
            color: Colors.blue,
            gradient: new LinearGradient(colors: [
              Color.fromRGBO(75, 167, 247, 1),
              Color.fromRGBO(57, 132, 247, 1)
            ]),
          ),
          child: new AppBar(
            elevation: 0,
            backgroundColor: Colors.transparent,
            title: new Text(
                        'title',
                        style: new TextStyle(
                            color: GlobalConfig.fontColor, fontSize: 18),
                      ),
          ),
        ),
      ),
      body: renderBody(),
    );
  }
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。