IconButton throws an exception. IconButton is a Material Widget, so you need to use it inside a Material parent, for example something like this:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | Widget build(BuildContext context) { return new Scaffold( appBar: new AppBar(title: new Text(widget.title), actions: <Widget>[ new IconButton( icon: new Icon(Icons.favorite), tooltip: 'Favorite', onPressed: () {}, ), new IconButton( icon: new Icon(Icons.more_vert), tooltip: 'Navigation menu', onPressed: () {}, ), ]), body: new Center( child: new Text('This is the body of the page.'), ), ); } |
If you like this question & answer and want to contribute, then write your question & answer and email to freewebmentor[@]gmail.com. Your question and answer will appear on FreeWebMentor.com and help other developers.