Showing
11 changed files
with
39 additions
and
6 deletions
1 | +## [2.6.0] | ||
2 | +- Added bindings. | ||
3 | +You can now add bindings from your controllers to your routes, to prepare GetBuilder or GetX to create a dependency already declared in a Binding class. This feature is in an experimental phase, and will not be documented until the end of the tests. | ||
4 | + | ||
1 | ## [2.5.10] | 5 | ## [2.5.10] |
2 | - Removed remnants of previousArgs on routeObserver. | 6 | - Removed remnants of previousArgs on routeObserver. |
3 | This feature had been deprecated in previous updates, and was removed in version 2.5.8. Some remaining references on the routeObserver were causing exceptions in version 2.5.9, and were removed completely in version 2.5.10. | 7 | This feature had been deprecated in previous updates, and was removed in version 2.5.8. Some remaining references on the routeObserver were causing exceptions in version 2.5.9, and were removed completely in version 2.5.10. |
1 | + | ||
2 | + | ||
1 | # Get | 3 | # Get |
2 | 4 | ||
3 | Get is an extra-light and powerful library for Flutter that will give you superpowers and increase your productivity. Navigate without context, open dialogs, snackbars or bottomsheets from anywhere in your code, Manage states and inject dependencies in an easy and practical way! Get is secure, stable, up-to-date, and offers a huge range of APIs that are not present on default framework. | 5 | Get is an extra-light and powerful library for Flutter that will give you superpowers and increase your productivity. Navigate without context, open dialogs, snackbars or bottomsheets from anywhere in your code, Manage states and inject dependencies in an easy and practical way! Get is secure, stable, up-to-date, and offers a huge range of APIs that are not present on default framework. |
get.png
0 → 100644

69.9 KB
@@ -13,6 +13,7 @@ export 'src/rx/rx_getbuilder.dart'; | @@ -13,6 +13,7 @@ export 'src/rx/rx_getbuilder.dart'; | ||
13 | export 'src/root/root_widget.dart'; | 13 | export 'src/root/root_widget.dart'; |
14 | export 'src/routes/default_route.dart'; | 14 | export 'src/routes/default_route.dart'; |
15 | export 'src/routes/get_route.dart'; | 15 | export 'src/routes/get_route.dart'; |
16 | +export 'src/routes/get_route.dart'; | ||
16 | export 'src/routes/observers/route_observer.dart'; | 17 | export 'src/routes/observers/route_observer.dart'; |
17 | export 'src/routes/transitions_type.dart'; | 18 | export 'src/routes/transitions_type.dart'; |
18 | export 'src/platform/platform.dart'; | 19 | export 'src/platform/platform.dart'; |
1 | import 'package:flutter/material.dart'; | 1 | import 'package:flutter/material.dart'; |
2 | import 'package:flutter/scheduler.dart'; | 2 | import 'package:flutter/scheduler.dart'; |
3 | +import 'package:get/src/routes/bindings_interface.dart'; | ||
3 | import 'bottomsheet/bottomsheet.dart'; | 4 | import 'bottomsheet/bottomsheet.dart'; |
4 | import 'platform/platform.dart'; | 5 | import 'platform/platform.dart'; |
5 | import 'root/root_controller.dart'; | 6 | import 'root/root_controller.dart'; |
@@ -52,6 +53,7 @@ class Get { | @@ -52,6 +53,7 @@ class Get { | ||
52 | int id, | 53 | int id, |
53 | bool fullscreenDialog = false, | 54 | bool fullscreenDialog = false, |
54 | Object arguments, | 55 | Object arguments, |
56 | + Bindings binding, | ||
55 | bool popGesture}) { | 57 | bool popGesture}) { |
56 | return _get.global(id).currentState.push(GetRouteBase( | 58 | return _get.global(id).currentState.push(GetRouteBase( |
57 | opaque: opaque ?? true, | 59 | opaque: opaque ?? true, |
@@ -61,6 +63,7 @@ class Get { | @@ -61,6 +63,7 @@ class Get { | ||
61 | popGesture: popGesture ?? _get._defaultPopGesture, | 63 | popGesture: popGesture ?? _get._defaultPopGesture, |
62 | transition: transition ?? _get._defaultTransition, | 64 | transition: transition ?? _get._defaultTransition, |
63 | fullscreenDialog: fullscreenDialog, | 65 | fullscreenDialog: fullscreenDialog, |
66 | + binding: binding, | ||
64 | transitionDuration: duration ?? _get._defaultDurationTransition)); | 67 | transitionDuration: duration ?? _get._defaultDurationTransition)); |
65 | } | 68 | } |
66 | 69 | ||
@@ -165,11 +168,13 @@ class Get { | @@ -165,11 +168,13 @@ class Get { | ||
165 | bool popGesture, | 168 | bool popGesture, |
166 | int id, | 169 | int id, |
167 | Object arguments, | 170 | Object arguments, |
171 | + Bindings binding, | ||
168 | bool fullscreenDialog = false, | 172 | bool fullscreenDialog = false, |
169 | Duration duration}) { | 173 | Duration duration}) { |
170 | return _get.global(id).currentState.pushReplacement(GetRouteBase( | 174 | return _get.global(id).currentState.pushReplacement(GetRouteBase( |
171 | opaque: opaque ?? true, | 175 | opaque: opaque ?? true, |
172 | page: page, | 176 | page: page, |
177 | + binding: binding, | ||
173 | settings: RouteSettings( | 178 | settings: RouteSettings( |
174 | name: '/' + page.toString().toLowerCase(), arguments: arguments), | 179 | name: '/' + page.toString().toLowerCase(), arguments: arguments), |
175 | fullscreenDialog: fullscreenDialog, | 180 | fullscreenDialog: fullscreenDialog, |
@@ -185,6 +190,7 @@ class Get { | @@ -185,6 +190,7 @@ class Get { | ||
185 | bool popGesture, | 190 | bool popGesture, |
186 | int id, | 191 | int id, |
187 | Object arguments, | 192 | Object arguments, |
193 | + Bindings binding, | ||
188 | bool fullscreenDialog = false, | 194 | bool fullscreenDialog = false, |
189 | Transition transition}) { | 195 | Transition transition}) { |
190 | var route = (Route<dynamic> rota) => false; | 196 | var route = (Route<dynamic> rota) => false; |
@@ -194,6 +200,7 @@ class Get { | @@ -194,6 +200,7 @@ class Get { | ||
194 | opaque: opaque ?? true, | 200 | opaque: opaque ?? true, |
195 | popGesture: popGesture ?? _get._defaultPopGesture, | 201 | popGesture: popGesture ?? _get._defaultPopGesture, |
196 | page: page, | 202 | page: page, |
203 | + binding: binding, | ||
197 | settings: RouteSettings( | 204 | settings: RouteSettings( |
198 | name: '/' + page.toString().toLowerCase(), arguments: arguments), | 205 | name: '/' + page.toString().toLowerCase(), arguments: arguments), |
199 | fullscreenDialog: fullscreenDialog, | 206 | fullscreenDialog: fullscreenDialog, |
lib/src/routes/bindings_interface.dart
0 → 100644
@@ -6,6 +6,7 @@ import 'package:flutter/foundation.dart'; | @@ -6,6 +6,7 @@ import 'package:flutter/foundation.dart'; | ||
6 | import 'package:flutter/gestures.dart'; | 6 | import 'package:flutter/gestures.dart'; |
7 | import 'package:flutter/material.dart'; | 7 | import 'package:flutter/material.dart'; |
8 | import 'package:get/src/get_main.dart'; | 8 | import 'package:get/src/get_main.dart'; |
9 | +import 'package:get/src/routes/bindings_interface.dart'; | ||
9 | 10 | ||
10 | import '../platform/platform.dart'; | 11 | import '../platform/platform.dart'; |
11 | import 'transitions_type.dart'; | 12 | import 'transitions_type.dart'; |
@@ -29,6 +30,7 @@ class GetRouteBase<T> extends PageRoute<T> { | @@ -29,6 +30,7 @@ class GetRouteBase<T> extends PageRoute<T> { | ||
29 | this.curve = Curves.linear, | 30 | this.curve = Curves.linear, |
30 | this.alignment, | 31 | this.alignment, |
31 | this.parameter, | 32 | this.parameter, |
33 | + this.binding, | ||
32 | this.opaque = true, | 34 | this.opaque = true, |
33 | this.transitionDuration = const Duration(milliseconds: 400), | 35 | this.transitionDuration = const Duration(milliseconds: 400), |
34 | this.popGesture, | 36 | this.popGesture, |
@@ -46,6 +48,8 @@ class GetRouteBase<T> extends PageRoute<T> { | @@ -46,6 +48,8 @@ class GetRouteBase<T> extends PageRoute<T> { | ||
46 | 48 | ||
47 | final bool popGesture; | 49 | final bool popGesture; |
48 | 50 | ||
51 | + final Bindings binding; | ||
52 | + | ||
49 | // final Duration duration; | 53 | // final Duration duration; |
50 | 54 | ||
51 | final Map<String, String> parameter; | 55 | final Map<String, String> parameter; |
@@ -464,6 +468,11 @@ class GetRouteBase<T> extends PageRoute<T> { | @@ -464,6 +468,11 @@ class GetRouteBase<T> extends PageRoute<T> { | ||
464 | @override | 468 | @override |
465 | Widget buildTransitions(BuildContext context, Animation<double> animation, | 469 | Widget buildTransitions(BuildContext context, Animation<double> animation, |
466 | Animation<double> secondaryAnimation, Widget child) { | 470 | Animation<double> secondaryAnimation, Widget child) { |
471 | + /// prebuild dependencies | ||
472 | + if (binding != null) { | ||
473 | + binding.dependencies(); | ||
474 | + } | ||
475 | + | ||
467 | return buildPageTransitions<T>( | 476 | return buildPageTransitions<T>( |
468 | this, | 477 | this, |
469 | context, | 478 | context, |
1 | import 'package:flutter/widgets.dart'; | 1 | import 'package:flutter/widgets.dart'; |
2 | - | 2 | +import 'package:get/src/routes/bindings_interface.dart'; |
3 | import 'transitions_type.dart'; | 3 | import 'transitions_type.dart'; |
4 | 4 | ||
5 | class GetRoute { | 5 | class GetRoute { |
@@ -12,6 +12,7 @@ class GetRoute { | @@ -12,6 +12,7 @@ class GetRoute { | ||
12 | final Alignment alignment; | 12 | final Alignment alignment; |
13 | final bool maintainState; | 13 | final bool maintainState; |
14 | final bool opaque; | 14 | final bool opaque; |
15 | + final Bindings bindings; | ||
15 | final Widget customTransition; | 16 | final Widget customTransition; |
16 | final Duration transitionDuration; | 17 | final Duration transitionDuration; |
17 | final bool fullscreenDialog; | 18 | final bool fullscreenDialog; |
@@ -28,6 +29,7 @@ class GetRoute { | @@ -28,6 +29,7 @@ class GetRoute { | ||
28 | this.opaque = true, | 29 | this.opaque = true, |
29 | this.transitionDuration = const Duration(milliseconds: 400), | 30 | this.transitionDuration = const Duration(milliseconds: 400), |
30 | this.popGesture, | 31 | this.popGesture, |
32 | + this.bindings, | ||
31 | this.transition, | 33 | this.transition, |
32 | this.customTransition, | 34 | this.customTransition, |
33 | this.fullscreenDialog = false, | 35 | this.fullscreenDialog = false, |
@@ -38,7 +38,7 @@ class GetObserver extends NavigatorObserver { | @@ -38,7 +38,7 @@ class GetObserver extends NavigatorObserver { | ||
38 | String current; | 38 | String current; |
39 | String previous; | 39 | String previous; |
40 | Object args; | 40 | Object args; |
41 | - // String previousArgs; | 41 | + // String previousArgs; |
42 | String removed; | 42 | String removed; |
43 | 43 | ||
44 | @override | 44 | @override |
@@ -59,7 +59,7 @@ class GetObserver extends NavigatorObserver { | @@ -59,7 +59,7 @@ class GetObserver extends NavigatorObserver { | ||
59 | current = '${route?.settings?.name}'; | 59 | current = '${route?.settings?.name}'; |
60 | previous = '${previousRoute?.settings?.name}'; | 60 | previous = '${previousRoute?.settings?.name}'; |
61 | args = route?.settings?.arguments; | 61 | args = route?.settings?.arguments; |
62 | - // previousArgs = previousRoute?.settings?.arguments; | 62 | + // previousArgs = previousRoute?.settings?.arguments; |
63 | 63 | ||
64 | final routeSend = Routing( | 64 | final routeSend = Routing( |
65 | removed: null, | 65 | removed: null, |
@@ -102,7 +102,7 @@ class GetObserver extends NavigatorObserver { | @@ -102,7 +102,7 @@ class GetObserver extends NavigatorObserver { | ||
102 | current = '${previousRoute?.settings?.name}'; | 102 | current = '${previousRoute?.settings?.name}'; |
103 | previous = '${route?.settings?.name}'; | 103 | previous = '${route?.settings?.name}'; |
104 | args = previousRoute?.settings?.arguments; | 104 | args = previousRoute?.settings?.arguments; |
105 | - // previousArgs = route?.settings?.arguments; | 105 | + // previousArgs = route?.settings?.arguments; |
106 | 106 | ||
107 | final routeSend = Routing( | 107 | final routeSend = Routing( |
108 | removed: null, | 108 | removed: null, |
1 | name: get | 1 | name: get |
2 | description: Open screens/snackbars/dialogs/bottomSheets without context, manage states and inject dependencies easily with Get. | 2 | description: Open screens/snackbars/dialogs/bottomSheets without context, manage states and inject dependencies easily with Get. |
3 | -version: 2.5.10 | 3 | +version: 2.6.0 |
4 | homepage: https://github.com/jonataslaw/get | 4 | homepage: https://github.com/jonataslaw/get |
5 | 5 | ||
6 | environment: | 6 | environment: |
-
Please register or login to post a comment