lukepighetti hace 5 años
padre
commit
a6f8b9621b
Se han modificado 4 ficheros con 34 adiciones y 2 borrados
  1. 6 0
      CHANGELOG.md
  2. 26 0
      README.md
  3. 1 1
      example/pubspec.lock
  4. 1 1
      pubspec.yaml

+ 6 - 0
CHANGELOG.md

@@ -1,3 +1,9 @@
+# 1.7.3
+
+- add FluroRouter.navigateTo(.rootNavigator, .nullOk)
+- add custom transitions in define
+- add BuildContext.settings and BuildContext.arguments extensions
+
 # 1.7.2
 # 1.7.2
 
 
 - Change to MIT license
 - Change to MIT license

+ 26 - 0
README.md

@@ -63,3 +63,29 @@ You can also manually push to a route yourself. To do so:
 ```dart
 ```dart
 router.navigateTo(context, "/users/1234", transition: TransitionType.fadeIn);
 router.navigateTo(context, "/users/1234", transition: TransitionType.fadeIn);
 ```
 ```
+
+## Class arguments
+
+Don't want to use strings for params? No worries.
+
+After pushing a route with a custom `RouteSettings` you can use the `BuildContext.settings` extension to extract the settings. Typically this would be done in `Handler.handlerFunc` so you can pass `RouteSettings.arguments` to your screen widgets.
+
+```dart
+/// Push a route with custom RouteSettings if you don't want to use path params
+FluroRouter.appRouter.navigateTo(
+  context,
+  'home',
+  routeSettings: RouteSettings(
+    arguments: MyArgumentsDataClass('foo!'),
+  ),
+);
+
+/// Extract the arguments using [BuildContext.settings.arguments] or [BuildContext.arguments] for short
+var homeHandler = Handler(
+  handlerFunc: (context, params) {
+    final args = context.settings.arguments as MyArgumentsDataClass;
+
+    return HomeComponent(args);
+  },
+);
+```

+ 1 - 1
example/pubspec.lock

@@ -63,7 +63,7 @@ packages:
       path: ".."
       path: ".."
       relative: true
       relative: true
     source: path
     source: path
-    version: "1.7.2"
+    version: "1.7.3"
   flutter:
   flutter:
     dependency: "direct main"
     dependency: "direct main"
     description: flutter
     description: flutter

+ 1 - 1
pubspec.yaml

@@ -1,6 +1,6 @@
 name: fluro
 name: fluro
 description: Fluro is a Flutter routing library that adds flexible routing options like wildcards, named parameters and clear route definitions.
 description: Fluro is a Flutter routing library that adds flexible routing options like wildcards, named parameters and clear route definitions.
-version: 1.7.2
+version: 1.7.3
 homepage: https://github.com/lukepighetti/fluro
 homepage: https://github.com/lukepighetti/fluro
 
 
 environment:
 environment: