added check to avoid opening the same page again, but it doesn't work...
This commit is contained in:
parent
b08b900f31
commit
2504c1632b
1 changed files with 11 additions and 0 deletions
|
@ -8,6 +8,8 @@ import 'package:pizzaplanner/pages/recipes_page.dart';
|
||||||
class NavDrawer extends StatelessWidget {
|
class NavDrawer extends StatelessWidget {
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context){
|
Widget build(BuildContext context){
|
||||||
|
final modalRoute = ModalRoute.of(context);
|
||||||
|
final currentRouteName = modalRoute?.settings.name ?? "";
|
||||||
return Drawer(
|
return Drawer(
|
||||||
child: ListView(
|
child: ListView(
|
||||||
padding: EdgeInsets.zero,
|
padding: EdgeInsets.zero,
|
||||||
|
@ -30,6 +32,9 @@ class NavDrawer extends StatelessWidget {
|
||||||
title: const Text("Events"),
|
title: const Text("Events"),
|
||||||
onTap: () {
|
onTap: () {
|
||||||
Navigator.pop(context);
|
Navigator.pop(context);
|
||||||
|
if (currentRouteName == PizzaEventsPage.route){
|
||||||
|
return;
|
||||||
|
}
|
||||||
Navigator.pushNamed(context, PizzaEventsPage.route);
|
Navigator.pushNamed(context, PizzaEventsPage.route);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
|
@ -38,6 +43,9 @@ class NavDrawer extends StatelessWidget {
|
||||||
title: const Text("Recipes"),
|
title: const Text("Recipes"),
|
||||||
onTap: () {
|
onTap: () {
|
||||||
Navigator.pop(context);
|
Navigator.pop(context);
|
||||||
|
if (currentRouteName == RecipesPage.route){
|
||||||
|
return;
|
||||||
|
}
|
||||||
Navigator.pushNamed(context, RecipesPage.route);
|
Navigator.pushNamed(context, RecipesPage.route);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
|
@ -46,6 +54,9 @@ class NavDrawer extends StatelessWidget {
|
||||||
title: const Text("Archive"),
|
title: const Text("Archive"),
|
||||||
onTap: () {
|
onTap: () {
|
||||||
Navigator.pop(context);
|
Navigator.pop(context);
|
||||||
|
if (currentRouteName == ArchivedPizzaEventsPage.route){
|
||||||
|
return;
|
||||||
|
}
|
||||||
Navigator.pushNamed(context, ArchivedPizzaEventsPage.route);
|
Navigator.pushNamed(context, ArchivedPizzaEventsPage.route);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
|
|
Loading…
Add table
Reference in a new issue