0

I have a problem, I defined a footer page then its has 3 page to open on click, I want if current page opens already then how to prevent it from reopening.

This is My UI buttons

On CLick

             InkWell(
                  onTap: () {
                    Navigator.push(
                        context,
                        MaterialPageRoute(
                            builder: (context) => const ContactUsWindow()));
                  },
Md. Yeasin Sheikh
  • 54,221
  • 7
  • 29
  • 56

1 Answers1

0

Try using ModalRoute, original post

 InkWell(
    onTap: () {
      final currentRoute  =    ModalRoute.of(context)?.settings.name;
      if(currentRoute != "ContactUsWindow"){ //here ContactUsWindow your current route
          Navigator.push(.......
Md. Yeasin Sheikh
  • 54,221
  • 7
  • 29
  • 56