Showing
1 changed file
with
23 additions
and
7 deletions
@@ -14,8 +14,10 @@ Get also makes navigation much clearer and more concise for beginners and friend | @@ -14,8 +14,10 @@ Get also makes navigation much clearer and more concise for beginners and friend | ||
14 | 14 | ||
15 | Add this to your package's pubspec.yaml file: | 15 | Add this to your package's pubspec.yaml file: |
16 | 16 | ||
17 | +``` | ||
17 | dependencies: | 18 | dependencies: |
18 | - get: | 19 | + get: ^1.3.0 |
20 | +``` | ||
19 | 21 | ||
20 | And import it: | 22 | And import it: |
21 | ```dart | 23 | ```dart |
@@ -57,9 +59,23 @@ Get.offAll(NextScreen()); | @@ -57,9 +59,23 @@ Get.offAll(NextScreen()); | ||
57 | However, for people who like more organized code who want to navigate with named routes, or for Flutter_web Developers who want the url to show exactly which route is being shown, and want the page refresh not to affect the state of the routes. On your site, we give you a much more elegant and functional solution. Yeah, the default navigation doesn't fully support Flutter_web, but Get does !!!! | 59 | However, for people who like more organized code who want to navigate with named routes, or for Flutter_web Developers who want the url to show exactly which route is being shown, and want the page refresh not to affect the state of the routes. On your site, we give you a much more elegant and functional solution. Yeah, the default navigation doesn't fully support Flutter_web, but Get does !!!! |
58 | 60 | ||
59 | ## So... Is possible used default namedRoutes from flutter? | 61 | ## So... Is possible used default namedRoutes from flutter? |
60 | -- Yes, and with no navigation bug | 62 | +- Yes, and with no navigation bug, add "named" to Get. HOWEVER, TO MAKE THIS TYPE OF NAVIGATION, USE THE ROUTE MODEL FROM REPOSITORY. |
63 | +Example of navigation with named routes: | ||
64 | + | ||
65 | +To navigate to nextScreen | ||
66 | +```dart | ||
67 | +Get.toNamed("/NextScreen"); | ||
68 | +``` | ||
69 | +To navigate and remove the previous screen from the tree. | ||
70 | +```dart | ||
71 | +Get.offNamed("/NextScreen"); | ||
72 | +``` | ||
73 | +To navigate and remove all previous screens from the tree. | ||
74 | +```dart | ||
75 | +Get.offAllNamed("/NextScreen"); | ||
76 | +``` | ||
61 | 77 | ||
62 | -## Using with Named Routes and And offering full flutter_web support: | 78 | +## Using with Named Routes and And offering full flutter_web support (REQUIRED FOR NAMED ROUTES): |
63 | 79 | ||
64 | ### Add " navigatorKey: Get.key," to MaterialApp | 80 | ### Add " navigatorKey: Get.key," to MaterialApp |
65 | 81 | ||
@@ -74,13 +90,13 @@ void main() { | @@ -74,13 +90,13 @@ void main() { | ||
74 | } | 90 | } |
75 | ``` | 91 | ``` |
76 | 92 | ||
77 | -Copy this class and put it in your app, rename routes and classes for your own, add more classes to it if necessary. | ||
78 | - | ||
79 | -### Important!!! We suggest that you copy this class for 3 reasons: | 93 | +### Important!!! COPY THE ROUTER CLASS BELOW: |
94 | +Copy this Router class below and put it in your app, rename routes and classes for your own, add more classes to it if necessary. | ||
80 | 95 | ||
96 | +We suggest that you copy this class for 3 reasons: | ||
81 | 1- You must define an escape route if you accidentally set a wrong route. This example already contains this. | 97 | 1- You must define an escape route if you accidentally set a wrong route. This example already contains this. |
82 | 98 | ||
83 | -2- Flutter_Web does not provide friendly urls or url settings (no matter how you set the route, it will always return to the main page after the page is reloaded and the route is not displayed in the url with default navigation) But Get supports it! So, when a user enters yourflutterwebsite.com/support and exactly the support route is displayed, you need to pass the settings parameter to GetRoute, and this example already contemplates it! | 99 | +2- Flutter_Web does not provide friendly urls(no matter how you set the route, it will always return to the main page after the page is reloaded and the route is not displayed in the url with default navigation), but Get supports it! So, when a user enters yourflutterwebsite.com/support and exactly the support route is displayed, you need to pass the settings parameter to GetRoute, and this example already contemplates it! |
84 | 100 | ||
85 | 3- These routes are designed to work with GetRoute, not CupertinoPageRoute or MaterialPageRoute. Never put them here. | 101 | 3- These routes are designed to work with GetRoute, not CupertinoPageRoute or MaterialPageRoute. Never put them here. |
86 | 102 |
-
Please register or login to post a comment