class SearchAppbar extends StatefulWidget { @overrIDe _SearchAppbarState createState() => new _SearchAppbarState();}class _SearchAppbarState extends State<SearchAppbar> { Widget appbarTitle = new Text("Appbar Title"); Icon actionIcon = new Icon(Icons.search); @overrIDe Widget build(BuildContext context) { return new Scaffold( appbar: new Appbar( centerTitle: true,Title:appbarTitle,actions: <Widget>[ new Iconbutton(icon: actionIcon,onpressed:(){ setState(() { if ( this.actionIcon.icon == Icons.search){ this.actionIcon = new Icon(Icons.close); this.appbarTitle = new TextFIEld( style: new TextStyle( color: colors.white,),decoration: new inputdecoration( prefixIcon: new Icon(Icons.search,color: colors.white),hintText: "Search...",hintStyle: new TextStyle(color: colors.white) ),);} else { this.actionIcon = new Icon(Icons.search); this.appbarTitle = new Text("Appbar Title"); } }); },] ),); }}总结
以上是内存溢出为你收集整理的dart – 如何在flutter中创建工具栏搜索视图全部内容,希望文章能够帮你解决dart – 如何在flutter中创建工具栏搜索视图所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)