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

Viewed 234

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.
0 Answers
Related