如何制作透明的应用栏?

时间:2020-09-23 13:19:24

标签: flutter

return Scaffold(
  backgroundColor: Color(0xfff2edd7),
  appBar: AppBar(
    backgroundColor: Color(0x00000000),
    elevation: 0,
  ),
  drawer: _drawer(),
  body: SingleChildScrollView(
    child: Column(
      children: <Widget>[
        Stack(
          children: <Widget>[
            Container(
              height: size.height * 0.3+100,
              decoration: BoxDecoration(
                  gradient: LinearGradient(
                      begin: Alignment.topCenter,
                      end: Alignment.bottomCenter,
                      //stops: [0.1, 0.6, 1],
                      colors: [Color(0xff4165a4), Color(0xff6573a4), Color(0xffa28aa5),Color(0xffccaaa7),Color(0xfff2edd7)])),
            ),

这是我的代码部分,我想使appbar的颜色根据具有渐变颜色的容器的颜色而变化。

如果我将身体部位定位在高于appbar部位,会解决吗?

1 个答案:

答案 0 :(得分:0)

backgroundColor设置为透明

  appBar: new AppBar(
          backgroundColor: Colors.transparent,
          elevation: 0.0,
        ),