Skip to content

Commit df9eec4

Browse files
Update README.md
1 parent 546c5e8 commit df9eec4

File tree

1 file changed

+25
-7
lines changed

1 file changed

+25
-7
lines changed

README.md

Lines changed: 25 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,24 @@
1010
</h1>
1111
</div>
1212

13+
<details>
14+
<summary><b>Breaking Changes: v0.2.1 &rarr; 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+
1331
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.
1432

1533
---
@@ -55,7 +73,7 @@ AdvancedNavigator(
5573
'/followers/{userId}': (args) => [
5674
MaterialPage(key: ValueKey('home'), child: ViewHome()),
5775
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'])),
5977
],
6078
},
6179
),
@@ -86,7 +104,7 @@ AdvancedNavigator(
86104
],
87105
'/items/{itemId}': (args) => [
88106
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']))),
90108
],
91109
},
92110
);
@@ -147,12 +165,12 @@ AdvancedNavigator(
147165
// example: '/items/ac9f0e80'
148166
'/items/{itemId}': (args) => [
149167
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']),
151169
],
152170
// example: '/search?q=unicorn&res=50'
153171
'/search': (args) => [
154172
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']))),
156174
],
157175
}
158176
);
@@ -182,8 +200,8 @@ Example:
182200
```dart
183201
AdvancedNavigator(
184202
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'])),
187205
}
188206
);
189207
```
@@ -279,7 +297,7 @@ AdvancedNavigator(
279297
'/myArticles/{articleId}/...': (args) => [
280298
CupertinoPage(key: ValueKey('home'), child: ViewHome()),
281299
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'])),
283301
],
284302
},
285303
),

0 commit comments

Comments
 (0)