I have a Main page with a tabbar with 5 tabs. In Main page, i load a JSON from internet and set different parts of it in each tab. It's a world cup app, showing a tab for each match fase (groups, round of 16, quarterfinals, semifinal, and final). When each tab is loaded, i get the json and build a list view.
In additional, i want to set a button to reload the information (something like a fab or action in appbar). But, when i reload the JSON, how do i setstate of the actual tab?
This is my Main page widget build:
Widget build(BuildContext context) {
return new Scaffold(
appBar: new AppBar(
leading: new IconButton(
icon: new Icon(Icons.arrow_back),
onPressed: () => Navigator.pop(context),
),
title: new Text(title),
),
body: new Center(
child: new TabBarView(
controller: _tabController,
children: <Widget>[
new GroupStageMatches(),
new RoundOfSixteen(),
new QuarterFinals(),
new SemiFinal(),
new Final(),
],
),
),
bottomNavigationBar: new Material(
color: Colors.blueAccent,
child: new TabBar(
controller: _tabController,
tabs: <Widget>[
new Tab(text: "Grupos"),
new Tab(text: "Oitavas"),
new Tab(text: "Quartas"),
new Tab(text: "Semi"),
new Tab(text:"Final"),
],
),
),
floatingActionButton: new FloatingActionButton(
onPressed: () {
setState(() {
sing.updateData();
});
}
),
);}