Flutter FloatingActionButton实现类似闲鱼App底部导航凸起按钮

发布于 5 个月前 作者 phonegap100 175 次浏览 最后一次编辑是 5 个月前 来自 分享

Flutter FloatingActionButton实现类似闲鱼App底部导航凸起按钮

aaa.png

return Scaffold(
        appBar: AppBar(
          title: Text("Flutter App"),
        ),
        floatingActionButton:Container(
          height: 80,
          width: 80,
          decoration: BoxDecoration(
              borderRadius: BorderRadius.circular(40),
              color: Colors.white,
          ),
        
          margin: EdgeInsets.only(top:10),
          padding: EdgeInsets.all(8),
          child:  FloatingActionButton(
            child: Icon(Icons.add),
            backgroundColor: this._currentIndex==1?Colors.red:Colors.yellow,
            onPressed: (){
              // print('点击1');
              setState(() {
               this._currentIndex=1; 
              });
            },
            
          ),
        ),
        floatingActionButtonLocation: FloatingActionButtonLocation.centerDocked,
)
回到顶部