Showing
1 changed file
with
28 additions
and
4 deletions
| @@ -74,7 +74,7 @@ Notice this route type behaves the same as `MaterialPageRoute` and supports cust | @@ -74,7 +74,7 @@ Notice this route type behaves the same as `MaterialPageRoute` and supports cust | ||
| 74 | 74 | ||
| 75 | How can I change my route class? See cases: | 75 | How can I change my route class? See cases: |
| 76 | 76 | ||
| 77 | -1. Using `Navigator.of(context).push` | 77 | +<details><summary> 1. Using Navigator.of(context).push </summary> |
| 78 | 78 | ||
| 79 | ```dart | 79 | ```dart |
| 80 | Navigator.of(context).push(MaterialPageRoute(builder: (context) => Container()));` | 80 | Navigator.of(context).push(MaterialPageRoute(builder: (context) => Container()));` |
| @@ -83,7 +83,14 @@ Navigator.of(context).push(MaterialPageRoute(builder: (context) => Container())) | @@ -83,7 +83,14 @@ Navigator.of(context).push(MaterialPageRoute(builder: (context) => Container())) | ||
| 83 | ```dart | 83 | ```dart |
| 84 | Navigator.of(context).push(MaterialWithModalsPageRoute(builder: (context) => Container())); | 84 | Navigator.of(context).push(MaterialWithModalsPageRoute(builder: (context) => Container())); |
| 85 | ``` | 85 | ``` |
| 86 | -2. Using `onGenerateRoute` parameter of `MaterialApp`, `CupertinoApp` or `Navigator` | 86 | + |
| 87 | + </details> | ||
| 88 | + | ||
| 89 | +<details><summary> | ||
| 90 | + 2. | ||
| 91 | + Using `onGenerateRoute` parameter of `MaterialApp`, `CupertinoApp` or `Navigator` | ||
| 92 | + </summary> | ||
| 93 | + | ||
| 87 | ```dart | 94 | ```dart |
| 88 | onGenerateRoute: (settings) { | 95 | onGenerateRoute: (settings) { |
| 89 | ... | 96 | ... |
| @@ -97,13 +104,30 @@ Navigator.of(context).push(MaterialPageRoute(builder: (context) => Container())) | @@ -97,13 +104,30 @@ Navigator.of(context).push(MaterialPageRoute(builder: (context) => Container())) | ||
| 97 | return MaterialWithModalsPageRoute(settings: settings, builder: (context) => Container()); | 104 | return MaterialWithModalsPageRoute(settings: settings, builder: (context) => Container()); |
| 98 | }, | 105 | }, |
| 99 | ``` | 106 | ``` |
| 100 | - 3. Using `pageRouteBuilder` parameter of `WidgetApp` | 107 | + |
| 108 | + </details> | ||
| 109 | + | ||
| 110 | + <details><summary> | ||
| 111 | + 3. | ||
| 112 | + Using `pageRouteBuilder` parameter of `WidgetApp` | ||
| 113 | + </summary> | ||
| 114 | + | ||
| 101 | ```dart | 115 | ```dart |
| 102 | pageRouteBuilder: <T>(RouteSettings settings, WidgetBuilder builder) => MaterialWithModalsPageRoute<T>(settings: settings, builder: builder) | 116 | pageRouteBuilder: <T>(RouteSettings settings, WidgetBuilder builder) => MaterialWithModalsPageRoute<T>(settings: settings, builder: builder) |
| 103 | ``` | 117 | ``` |
| 104 | - 4. Using `routes` parameter from `MaterialApp` or `CupertinoApp` | 118 | + |
| 119 | + </details> | ||
| 120 | + | ||
| 121 | + <details> | ||
| 122 | + <summary> | ||
| 123 | + 4. | ||
| 124 | + Using `routes` parameter from `MaterialApp` or `CupertinoApp` | ||
| 125 | + </summary> | ||
| 126 | + | ||
| 105 | Unfortunately this routes are `MaterialPageRoute` and `CupertinoPageRoute` respectively and cannot be changes. | 127 | Unfortunately this routes are `MaterialPageRoute` and `CupertinoPageRoute` respectively and cannot be changes. |
| 106 | You can change the way you call the previous route with one of the previous methods or try option 2 | 128 | You can change the way you call the previous route with one of the previous methods or try option 2 |
| 129 | + | ||
| 130 | + </details> | ||
| 107 | 131 | ||
| 108 | 132 | ||
| 109 | ### OPTION 2. | 133 | ### OPTION 2. |
-
Please register or login to post a comment