Flutter: How to implement named routes navigation for popup dialogs?

479 views Asked by At

How best to implement the following: I need to show a regular window on a smartphone, and show the same window on a tablet as a popup dialog. There are several such windows in different places. Which would be more correct:

  1. use Navigator.pushNamed(), catch routes in onGenerateRoute method, make a custom router class and determine which option to show from it, or
  2. leave the logic in the parent window, that is, detect the type of device in it and do either Navigator.pushNamed() or showDialog, but then the meaning of named routes is lost.
1

There are 1 answers

0
boby dhorajiya On BEST ANSWER

I think you have to try to implement show dialogue inside the stateless widget class so you can get result which you want.