美文网首页
flutter AppBar 设置标题 设置颜色 隐藏底部阴影分

flutter AppBar 设置标题 设置颜色 隐藏底部阴影分

作者: Faith_K | 来源:发表于2020-03-12 10:39 被阅读0次

    flutter Scaffold AppBar 导航有三部分,左边 中间 右边,当我们

    image.png
    AppBar(
             title: Text(titleList[this._currentIndex],//标题显示什么
               style: TextStyle(
                   color: Colors.black,//设置字体颜色
                   fontSize: 20,//设置字体大小
               ),
             ),
    //              leading  automaticallyImplyLeading 一起使用可以在有返回的按钮吧返回按钮位置给覆盖显示比如使用场景搜索,
                 leading: null,
                  automaticallyImplyLeading: false,
    //            titleSpacing 距离屏幕两边的距离默认16,当我们设置搜索的时候感觉两边距离太大太小可以调
                  titleSpacing: 10,
             backgroundColor: Colors.white,//设置导航背景颜色
             elevation: 0,//隐藏底部阴影分割线
             centerTitle: true,//标题是否居中 安卓上有效ios默认居中
             leading: IconButton(
               icon: Icon(Icons.arrow_back_ios,color: Colors.black,),
               onPressed: (){
                 print('点击了返回');
               },
             ), // leading 设置左侧返回
             actions: <Widget>[
               RaisedButton(
                 child: Text('菜单'),
                 onPressed: (){
                   print('点击了菜单');
    
                 },
                 color: Colors.red,
               ),
               IconButton(
                 icon: Icon(Icons.favorite,color: Colors.black,),
                 onPressed: (){
                   print('点击了心心');
                 },
               ),
    
             ],//actions 设置左侧按钮
             
           );
    

    相关文章

      网友评论

          本文标题:flutter AppBar 设置标题 设置颜色 隐藏底部阴影分

          本文链接:https://www.haomeiwen.com/subject/dhsyjhtx.html