除了将 backgroundColor
设置为 transparent
,还需要将 shadowColor
设置为 transparent
,或者把 elevation
设置为 0:
appBar: AppBar(
title: Text('透明导航栏'),
backgroundColor: Colors.transparent, // 背景颜色设置为透明
shadowColor: Colors.transparent, // 阴影也要设置为透明
//elevation: 0,
),