Skip to content

Commit d8c9cde

Browse files
authored
Merge pull request #52 from nubank/readme-fix
Fix Readme to be compliant with latest 0.7 changes
2 parents a09b4cb + e4c747d commit d8c9cde

3 files changed

Lines changed: 28 additions & 25 deletions

File tree

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# CHANGELOG
22

3+
## 0.7.1
4+
- Update README
5+
- Update pubspec.yaml to support analyzer up to version `0.41.0`
6+
37
## 0.7.0
48
- [BREAKING] Rename classes to avoid conflicts with Flutter 1.22 Router Widget
59
- `Router` was renamed to `NuRouter`

README.md

Lines changed: 22 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Routing and Navigation package.
88
## What
99

1010
Nuvigator provides a powerful routing abstraction over Flutter's own Navigators. Model complex navigation flows using a mostly
11-
declarative and concise approach, without needing to worry about several tricky behaviours that Nuvigator handles for you.
11+
declarative and concise approach, without needing to worry about several tricky behaviors that Nuvigator handles for you.
1212

1313
## Main Concepts
1414

@@ -27,8 +27,8 @@ class MyScreen extends StatelessWidget {
2727
2828
}
2929
30-
@NuRouter()
31-
class MainRouter extends Router {
30+
@nuRouter
31+
class MainRouter extends NuRouter {
3232
3333
@NuRoute()
3434
ScreenRoute myRoute() => ScreenRoute(
@@ -59,7 +59,7 @@ class MyApp extends StatelessWidget {
5959
6060
```
6161

62-
## Nuvigator and Router
62+
## Nuvigator and NuRouter
6363

6464
`Nuvigator` is a custom `Navigator`. It behaves just like a normal `Navigator`, but has several custom improvements and
6565
features. It is engineered specially to work under nested scenarios, where you can have several Flows one inside another.
@@ -69,8 +69,8 @@ navigation, and it can be easily fetched from the context, just like a normal `N
6969
Nuvigator includes several extra methods, like `Nuvigator.of(context).openDeepLink()` that tries to open the desired deep link.
7070
Another example is `Nuvigator.of(context).closeFlow()` that tries to close all screens of a nested Nuvigator.
7171

72-
Each `Nuvigator` should have a `Router`. The `Router` acts as a routing controller. A `Nuvigator` is responsible for
73-
visualization, widget rendering and state keeping. A Router is a Pure class that is responsible for providing elements to
72+
Each `Nuvigator` should have a `NuRouter`. The `NuRouter` acts as a routing controller. A `Nuvigator` is responsible for
73+
visualization, widget rendering and state keeping. A NuRouter is a Pure class that is responsible for providing elements to
7474
be presented and managed by the Nuvigator.
7575

7676
## ScreenRoute
@@ -91,8 +91,8 @@ A `ScreenRoute` may return another `Nuvigator`. This is useful for defining a ne
9191

9292
## Creating Routers
9393

94-
Defining a new Router is probably be the what you will do the most when working with Nuvigator, so understanding how
95-
to do it properly is important. A Router class is a class that extends a `Router` and is annotated with the `@NuRouter` annotation.
94+
Defining a new NuRouter is probably be the what you will do the most when working with Nuvigator, so understanding how
95+
to do it properly is important. A NuRouter class is a class that extends a `NuRouter` and is annotated with the `@nuRouter` annotation.
9696

9797
### Defining Routes
9898

@@ -102,8 +102,8 @@ the Arguments that can be passed to your route when navigating to it.
102102

103103
Example:
104104
```dart
105-
@NuRouter()
106-
class MyCustomRouter extends Router {
105+
@nuRouter
106+
class MyCustomRouter extends NuRouter {
107107
108108
@NuRoute()
109109
ScreenRoute firstScreen({String argumentHere}) => ScreenRoute(
@@ -132,8 +132,7 @@ types natively for parameters in a deep link:
132132
- DateTime (`?date=2020-10-01`, `?date=2020-10-01T15:32:09.123Z`)
133133
- String (`?name=Jane+Doe`)
134134

135-
Any of these **can be null** if you try to open a deep link without specifing them **or if they fail to parse** (e.g. `falseee` as
136-
a bool outputs `null`).
135+
Any of these **can be null** if you try to open a deep link without specifying them **or if they fail to parse** (e.g. `false` as a bool outputs `null`).
137136

138137
If you create a Route that takes an argument of a different type and it has a deep link, Nuvigator's code generation tool will issue
139138
a warning about it. This is because, when decoding something that is not declared as one of these types, the result **will be a String**.
@@ -164,10 +163,10 @@ annotation.
164163

165164
Example:
166165
```dart
167-
@NuRouter()
168-
class MyCustomRouter extends Router {
166+
@nuRouter
167+
class MyCustomRouter extends NuRouter {
169168
170-
@NuRouter()
169+
@nuRouter
171170
MyOtherRouter myOtherRouter = MyOtherRouter();
172171
173172
@override
@@ -179,36 +178,36 @@ class MyCustomRouter extends Router {
179178

180179
### Router Options
181180

182-
When extending from the `Router` you can override the following properties to add custom behaviors to your routes:
181+
When extending from the `NuRouter` you can override the following properties to add custom behaviors to your routes:
183182

184183
- `deepLinkPrefix`:
185184
A `Future<String>`, that is used as prefix for the deep links declared on each route, and also for the grouped routers.
186185

187186
- `screensWrapper`:
188187
A function to wrap each route presented by this router. Should return a new Widget that wraps this child Widget.
189-
The Wrapper is applied to all Screens in this Router. This function runs one time for each screen, and not one
190-
time for the entire Router.
188+
The Wrapper is applied to all Screens in this NuRouter. This function runs one time for each screen, and not one
189+
time for the entire NuRouter.
191190

192191
- `routers`
193-
Sub-Routers grouped into this Router.
192+
Sub-Routers grouped into this NuRouter.
194193

195194
## Code Generators
196195

197196
You may have noticed in the examples above that we have methods that will be created by the Nuvigator generator. So while
198197
they don't exists you can just make they return `null` or leave un-implemented.
199198

200-
Before running the generator we recommend being sure that each Router is in a separated file, and also make sure that you
199+
Before running the generator we recommend being sure that each NuRouter is in a separated file, and also make sure that you
201200
have added the `part 'my_custom_router.g.dart';` directive and the required imports (`package:nuvigator/nuvigator.dart` and `package:flutter/widgets.dart`) in your router file.
202201

203202
After running the generator (`flutter pub run build_runner build --delete-conflicting-outputs`), you should notice that
204203
each router file will have its `part-of` file created. Now you can complete the `screensMap` and `routersList` functions
205204
with the generated: `_$myScreensMap(this);` and `_$samplesRoutersList(this);`. Generated code usually follows this pattern
206-
of stripping out the `Router` part of your Router class and using the rest of the name for generated code.
205+
of stripping out the `NuRouter` part of your NuRouter class and using the rest of the name for generated code.
207206

208207
Generated code includes the following features:
209208

210209
- Routes Enum-like class
211-
- Navigation extension methods to Router
210+
- Navigation extension methods to NuRouter
212211
- Typed Arguments classes
213212
- Implementation Methods
214213

@@ -256,7 +255,7 @@ Nested flows (declared with nested Nuvigators) will also have their generated Na
256255
in the parent Navigation. The same applies for Grouped Routers. Usage eg:
257256

258257
```dart
259-
final router = Router.of<SamplesRouter>(context);
258+
final router = NuRouter.of<SamplesRouter>(context);
260259
await router.sampleOneRouter.toScreenOne(testId: 'From Home');
261260
await router.toSecond(testId: 'From Home');
262261
```

pubspec.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: nuvigator
22
description: A powerful and strongly typed routing abstraction over Flutter navigator, providing some new features and an easy way to define routers with code generation.
3-
version: 0.7.0
3+
version: 0.7.1
44

55
homepage: https://github.com/nubank/nuvigator
66

@@ -13,7 +13,7 @@ dependencies:
1313
build_config: '>=0.2.6 <0.5.0'
1414
code_builder: ^3.2.0
1515
source_gen: '>=0.9.4+4 <0.10.0'
16-
analyzer: '>=0.38.5 <0.40.0'
16+
analyzer: '>=0.38.5 <0.41.0'
1717
dart_style: '>=1.2.9 <1.4.0'
1818
flutter:
1919
sdk: flutter

0 commit comments

Comments
 (0)