Home > other >  Flutter How do you navigate to another page in search function
Flutter How do you navigate to another page in search function

Time:11-12

So,after I use SearchDelegate class and It have a buildResults Widget and I want to navigate in this Widget by using Navigator functionThis is code

@override
  Widget buildResults(BuildContext context) {
       //I want to navigate to another page
  }

CodePudding user response:

you need to handle the state of search results separately you can use any state management tool to achieve the desired result in an easy way.

please refer to this link

CodePudding user response:

You can navigate to another page with Navigator.push

Navigator.push(
      context,
      MaterialPageRoute(
        builder: (context) => YOURPAGE(),
      ),
    );

And to come back to the original page you can user Navigator.pop(context);

  • Related