Flutter 导航栏上添加搜索按钮


代码:

Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('搜索条'),
actions: <Widget>[//导航条右方 类似rightBarItem
IconButton(
icon: Icon(Icons.search),
onPressed: (){
print('点击了搜索');
},
)
],
 
),
);
}
总结:
 

//导航栏上的搜索条

AppBar(

actions:<widget>{//类似于OC的rightBarItem

IconButton(

icon:Icon(Icons.xx)

Onpress(){

print(‘xxx’)//控制台输出

}

)

 

}

 

)


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM