|
10 | 10 | </h1> |
11 | 11 | </div> |
12 | 12 |
|
| 13 | +<details> |
| 14 | + <summary><b>Breaking Changes: v0.2.1 → v1.0.0</b></summary> |
| 15 | + |
| 16 | + The generator functions for each path now take a `PathArguments` object as input instead of a map of `String`s. This is to allow arbitrary objects to be passed as arguments. Arguments passed through the path name can now be accessed using the `PathArguments.path` property. |
| 17 | + ```diff |
| 18 | + AdvancedNavigator( |
| 19 | + paths: { |
| 20 | + '/user/{userId}': (args) => [ |
| 21 | + - CupertinoPage(key: ..., child: Profile(args['userId'])), |
| 22 | + + CupertinoPage(key: ..., child: Profile(args.path['userId'])), |
| 23 | + ], |
| 24 | + }, |
| 25 | + ), |
| 26 | + ``` |
| 27 | +</details> |
| 28 | + |
| 29 | +--- |
| 30 | + |
13 | 31 | This package aims at bringing the powerful capabilities of [Navigator 2.0](https://docs.google.com/document/d/1Q0jx0l4-xymph9O6zLaOY4d_f7YFpNWX_eGbzYxr9wY/edit#) to any Flutter app as one easy-to-use widget. The focus was to keep this package simple and familiar to people used to the standard navigator API while at the same time providing even low level customizability for very difficult and unusual navigation logic. |
14 | 32 |
|
15 | 33 | --- |
@@ -55,7 +73,7 @@ AdvancedNavigator( |
55 | 73 | '/followers/{userId}': (args) => [ |
56 | 74 | MaterialPage(key: ValueKey('home'), child: ViewHome()), |
57 | 75 | MaterialPage(key: ValueKey('followers'), child: ViewFollowers()), |
58 | | - MaterialPage(key: ValueKey('profile${args['userId']}'), child: ViewProfile(args['userId'])), |
| 76 | + MaterialPage(key: ValueKey('profile${args.path['userId']}'), child: ViewProfile(args.path['userId'])), |
59 | 77 | ], |
60 | 78 | }, |
61 | 79 | ), |
@@ -86,7 +104,7 @@ AdvancedNavigator( |
86 | 104 | ], |
87 | 105 | '/items/{itemId}': (args) => [ |
88 | 106 | CupertinoPage(key: ValueKey('home'), child: ViewHome()), |
89 | | - CupertinoPage(key: ValueKey('item${args['itemId']}'), child: ViewItem(int.parse(args['itemId']))), |
| 107 | + CupertinoPage(key: ValueKey('item${args.path['itemId']}'), child: ViewItem(int.parse(args.path['itemId']))), |
90 | 108 | ], |
91 | 109 | }, |
92 | 110 | ); |
@@ -147,12 +165,12 @@ AdvancedNavigator( |
147 | 165 | // example: '/items/ac9f0e80' |
148 | 166 | '/items/{itemId}': (args) => [ |
149 | 167 | CupertinoPage(key: ValueKey('home'), child: ViewHome()), |
150 | | - CupertinoPage(key: ValueKey('item${args['itemId']}'), child: ViewItem(args['itemId']), |
| 168 | + CupertinoPage(key: ValueKey('item${args.path['itemId']}'), child: ViewItem(args.path['itemId']), |
151 | 169 | ], |
152 | 170 | // example: '/search?q=unicorn&res=50' |
153 | 171 | '/search': (args) => [ |
154 | 172 | CupertinoPage(key: ValueKey('home'), child: ViewHome()), |
155 | | - CupertinoPage(key: ValueKey('search'), child: ViewSearch(args['q'], res: int.parse(args['res']))), |
| 173 | + CupertinoPage(key: ValueKey('search'), child: ViewSearch(args.path['q'], res: int.parse(args.path['res']))), |
156 | 174 | ], |
157 | 175 | } |
158 | 176 | ); |
@@ -182,8 +200,8 @@ Example: |
182 | 200 | ```dart |
183 | 201 | AdvancedNavigator( |
184 | 202 | pages: { |
185 | | - 'post': (args) => CupertinoPage(key: ValueKey('post${args['postId']}'), child: ViewPost(args['postId'])), |
186 | | - 'profile': (args) => CupertinoPage(key: ValueKey('profile${args['userId']}'), child: ViewProfile(args['userId'])), |
| 203 | + 'post': (args) => CupertinoPage(key: ValueKey('post${args.path['postId']}'), child: ViewPost(args.path['postId'])), |
| 204 | + 'profile': (args) => CupertinoPage(key: ValueKey('profile${args.path['userId']}'), child: ViewProfile(args.path['userId'])), |
187 | 205 | } |
188 | 206 | ); |
189 | 207 | ``` |
@@ -279,7 +297,7 @@ AdvancedNavigator( |
279 | 297 | '/myArticles/{articleId}/...': (args) => [ |
280 | 298 | CupertinoPage(key: ValueKey('home'), child: ViewHome()), |
281 | 299 | CupertinoPage(key: ValueKey('myArticles'), child: ViewMyArticles()), |
282 | | - CupertinoPage(key: ValueKey('article${args['articleId']}'), child: AppTextEditor(args['articleId'])), |
| 300 | + CupertinoPage(key: ValueKey('article${args.path['articleId']}'), child: AppTextEditor(args.path['articleId'])), |
283 | 301 | ], |
284 | 302 | }, |
285 | 303 | ), |
|
0 commit comments