refresh Homepage on return from menu item
This commit is contained in:
+9
-1
@@ -25,6 +25,12 @@ class _MyAppState extends State<MyApp> {
|
||||
super.initState();
|
||||
}
|
||||
|
||||
void refresh() {
|
||||
setState(() {
|
||||
_locations = UserPreferences.getSavedLocations();
|
||||
});
|
||||
}
|
||||
|
||||
Widget buildContent() {
|
||||
return DefaultTabController(
|
||||
length: _locations.length,
|
||||
@@ -37,7 +43,9 @@ class _MyAppState extends State<MyApp> {
|
||||
tabs: [for (String name in _locations) Tab(icon: Text(name))],
|
||||
),
|
||||
),
|
||||
drawer: const NavBar(),
|
||||
drawer: NavBar(
|
||||
refreshPageFrom: refresh,
|
||||
),
|
||||
body: (_locations.isEmpty)
|
||||
? const Text("No locations")
|
||||
: TabBarView(
|
||||
|
||||
Reference in New Issue
Block a user