Dart 底部导航栏透明背景
我正在尝试构建一个没有透明背景的BottomNavigationBar,到目前为止,这就是我所做的,但是我仍然有阴影,也应该删除这些阴影:Dart 底部导航栏透明背景,dart,flutter,Dart,Flutter,我正在尝试构建一个没有透明背景的BottomNavigationBar,到目前为止,这就是我所做的,但是我仍然有阴影,也应该删除这些阴影: return Scaffold( body: body, bottomNavigationBar: Theme( data: Theme.of(context).copyWith( canvasColor: Colors.transparent, primaryColor: Colors.white,
return Scaffold(
body: body,
bottomNavigationBar: Theme(
data: Theme.of(context).copyWith(
canvasColor: Colors.transparent,
primaryColor: Colors.white,
textTheme: Theme
.of(context)
.textTheme
.copyWith(caption: TextStyle(color: Colors.deepOrange))),
child: BottomNavigationBar(
type: BottomNavigationBarType.fixed,
currentIndex: 0,
items: [
BottomNavigationBarItem(
icon: Icon(Icons.home),
title: Text("Home"),
),
BottomNavigationBarItem(
icon: Icon(Icons.map),
title: Text("Map"),
)
],
),
),
);
因为我认为如果你使用透明的背景,那么图标将不是很清晰, 或者,您可以像这样使用自定义小部件。 这可能对你有帮助
return new Scaffold(
appBar: new AppBar(
title: new Text(widget.title),
),
body: new Container(
child: new Stack(children: <Widget>[
new Container(
color: Colors.lightGreen,
child: new Center(
child: new Text('Hello'),
),
),
new Align(alignment: Alignment.bottomCenter,child: new Container(
height: 100.0,
child: new Row(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: <Widget>[
new Icon(Icons.home),
new Icon(Icons.map)
],),
),)
],),
),
);
声音similar@GünterZöchbauer说,答案仍然会产生模糊效果,而不是完全透明的底部导航条