diff --git a/lib/presentation/views/main_menu/groups_view.dart b/lib/presentation/views/main_menu/groups_view.dart index 7c5e3d5..bdb3d4a 100644 --- a/lib/presentation/views/main_menu/groups_view.dart +++ b/lib/presentation/views/main_menu/groups_view.dart @@ -19,6 +19,7 @@ class GroupsView extends StatefulWidget { class _GroupsViewState extends State { late Future> _allGroupsFuture; + late final AppDatabase db; final player = Player(id: 'p1', name: 'Sample'); late final List skeletonData = List.filled( @@ -33,7 +34,7 @@ class _GroupsViewState extends State { @override void initState() { super.initState(); - final db = Provider.of(context, listen: false); + db = Provider.of(context, listen: false); _allGroupsFuture = db.groupDao.getAllGroups(); } @@ -109,8 +110,8 @@ class _GroupsViewState extends State { infillColor: CustomTheme.primaryColor, borderColor: CustomTheme.primaryColor, sizeRelativeToWidth: 0.90, - onPressed: () { - Navigator.push( + onPressed: () async { + await Navigator.push( context, MaterialPageRoute( builder: (context) { @@ -118,6 +119,9 @@ class _GroupsViewState extends State { }, ), ); + setState(() { + _allGroupsFuture = db.groupDao.getAllGroups(); + }); }, ), ),