【问题标题】:BottomNavigationBar Transparent BackgroundBottomNavigationBar 透明背景
【发布时间】:2019-02-07 03:39:47
【问题描述】:

我正在尝试构建一个没有背景(透明)的 BottomNavigationBar,到目前为止,这就是我所做的,但我仍然有阴影,也应该删除:

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"),
        )
      ],
    ),
  ),
);

【问题讨论】:

标签: dart flutter


【解决方案1】:

我认为如果您使用透明背景,那么图标将不是很清晰, 或者,您可以像这样使用您的自定义小部件。 这可能对您有帮助。

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)
            ],),
          ),)
        ],),
      ),
    );

【讨论】:

    猜你喜欢
    • 2020-09-11
    • 2011-03-08
    • 2021-09-20
    • 2020-10-15
    • 2017-06-22
    • 2010-10-20
    • 2011-02-01
    • 2013-12-10
    • 2013-07-31
    相关资源
    最近更新 更多