Flutter implementing a Navigation drawer with a TabBarView widget with dynamic Tab view. Further investigating and various print statements in various places led me to the conclusion, that the constructor of the StatefulTabState is not called after one of the drawer buttons is clicked. Here is a working example of your StatefulTab:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | class StatefulTab extends StatefulWidget { String viewName; StatefulTab({Key key, this.viewName}) : super(key: key); @override StatefulTabState createState() => new StatefulTabState(); } class StatefulTabState extends State<StatefulTab> { @override Widget build(BuildContext context) { return new Center( child: new Text('This is the Tab 1 for View ${widget.viewName}'), ); } } |
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.