Showing
9 changed files
with
88 additions
and
72 deletions
1 | +## [2.10.1] | ||
2 | +- Fix broken links on pub | ||
3 | +- Fix List empty error | ||
4 | + | ||
1 | ## [2.10.0] | 5 | ## [2.10.0] |
2 | - Added SmartManagement, your application's memory is managed intelligently like never before! | 6 | - Added SmartManagement, your application's memory is managed intelligently like never before! |
3 | - Added Obx, a widget that knows when to rebuild a child, without needing any type. | 7 | - Added Obx, a widget that knows when to rebuild a child, without needing any type. |
1 | +<a href="https://www.buymeacoffee.com/jonataslaw" target="_blank"><img src="https://www.buymeacoffee.com/assets/img/custom_images/orange_img.png" align="right" alt="Buy Me A Coffee" style="height: 41px !important;width: 174px !important; box-shadow: 0px 3px 2px 0px rgba(190, 190, 190, 0.5) !important;-webkit-box-shadow: 0px 3px 2px 0px rgba(190, 190, 190, 0.5) !important;" > </a> | ||
1 |  | 2 |  |
2 | 3 | ||
3 | *Languages: [English](README.md), [Brazilian Portuguese](README.pt-br.md).* | 4 | *Languages: [English](README.md), [Brazilian Portuguese](README.pt-br.md).* |
@@ -50,21 +51,22 @@ Flutter's conventional navigation has a lot of unnecessary boilerplate, requires | @@ -50,21 +51,22 @@ Flutter's conventional navigation has a lot of unnecessary boilerplate, requires | ||
50 | This library that will change the way you work with the Framework and save your life from boilerplate, increasing your productivity, and provide you with everything that is most modern when it comes to managing states, routes and dependencies. | 51 | This library that will change the way you work with the Framework and save your life from boilerplate, increasing your productivity, and provide you with everything that is most modern when it comes to managing states, routes and dependencies. |
51 | 52 | ||
52 | - **[How to use?](#how-to-use)** | 53 | - **[How to use?](#how-to-use)** |
53 | -- **[Navigating without named routes](#Navigating-without-named-routes)** | ||
54 | -- **[SnackBars](#SnackBars)** | ||
55 | -- **[Dialogs](#Dialogs)** | ||
56 | -- **[BottomSheets](#BottomSheets)** | ||
57 | -- **[Simple State Manager](#Simple-State-Manager)** | ||
58 | -- **[Reactive State Manager](#Reactive-State-Manager)** | ||
59 | -- **[Bindings](#Bindings)** | ||
60 | -- **[Workers](#Workers)** | ||
61 | -- **[Navigate with named routes](#Navigate-with-named-routes)** | ||
62 | -- **[Send data to named Routes](#Send-data-to-named-Routes)** | ||
63 | -- **[Dynamic urls links](#Dynamic-urls-links)** | ||
64 | -- **[Middleware](#Middleware)** | ||
65 | -- **[Optional Global Settings](#Optional-Global-Settings)** | ||
66 | -- **[Other Advanced APIs and Manual configurations](#Other-Advanced-APIs-and-Manual-configurations)** | ||
67 | -- **[Nested Navigators](#Nested-Navigators)** | 54 | +- **[Navigating without named routes](#navigating-without-named-routes)** |
55 | +- **[SnackBars](#snackBars)** | ||
56 | +- **[Dialogs](#dialogs)** | ||
57 | +- **[BottomSheets](#bottomsheets)** | ||
58 | +- **[Simple State Manager](#simple-state-manager)** | ||
59 | +- **[Reactive State Manager](#reactive-state-manager)** | ||
60 | +- **[Bindings](#bindings)** | ||
61 | +- **[Workers](#workers)** | ||
62 | +- **[Navigate with named routes](#navigate-with-named-routes)** | ||
63 | +- **[Send data to named Routes](#send-data-to-named-Routes)** | ||
64 | +- **[Dynamic urls links](#dynamic-urls-links)** | ||
65 | +- **[Middleware](#middleware)** | ||
66 | +- **[Optional Global Settings](#optional-global-settings)** | ||
67 | +- **[Nested Navigators](#nested-navigators)** | ||
68 | +- **[Other Advanced APIs and Manual configurations](#other-advanced-apis-and-manual-configurations)** | ||
69 | + | ||
68 | 70 | ||
69 | 71 | ||
70 | #### You can contribute to the project in multiple ways: | 72 | #### You can contribute to the project in multiple ways: |
@@ -1012,6 +1014,54 @@ Get.config( | @@ -1012,6 +1014,54 @@ Get.config( | ||
1012 | defaultTransition = Transitions.cupertino} | 1014 | defaultTransition = Transitions.cupertino} |
1013 | ``` | 1015 | ``` |
1014 | 1016 | ||
1017 | +### Nested Navigators | ||
1018 | + | ||
1019 | +Get made Flutter's nested navigation even easier. | ||
1020 | +You don't need the context, and you will find your navigation stack by Id. | ||
1021 | + | ||
1022 | +- NOTE: Creating parallel navigation stacks can be dangerous. The ideal is not to use NestedNavigators, or to use sparingly. If your project requires it, go ahead, but keep in mind that keeping multiple navigation stacks in memory may not be a good idea for RAM consumption. | ||
1023 | + | ||
1024 | +See how simple it is: | ||
1025 | +```dart | ||
1026 | + Navigator( | ||
1027 | + key: nestedKey(1), // create a key by index | ||
1028 | + initialRoute: '/', | ||
1029 | + onGenerateRoute: (settings) { | ||
1030 | + if (settings.name == '/') { | ||
1031 | + return GetRouteBase( | ||
1032 | + page: Scaffold( | ||
1033 | + appBar: AppBar( | ||
1034 | + title: Text("Main"), | ||
1035 | + ), | ||
1036 | + body: Center( | ||
1037 | + child: FlatButton( | ||
1038 | + color: Colors.blue, | ||
1039 | + onPressed: () { | ||
1040 | + Get.toNamed('/second', id:1); // navigate by your nested route by index | ||
1041 | + }, | ||
1042 | + child: Text("Go to second")), | ||
1043 | + ), | ||
1044 | + ), | ||
1045 | + ); | ||
1046 | + } else if (settings.name == '/second') { | ||
1047 | + return GetRouteBase( | ||
1048 | + page: Center( | ||
1049 | + child: Scaffold( | ||
1050 | + appBar: AppBar( | ||
1051 | + title: Text("Main"), | ||
1052 | + ), | ||
1053 | + body: Center( | ||
1054 | + child: Text("second") | ||
1055 | + ), | ||
1056 | + ), | ||
1057 | + ), | ||
1058 | + ); | ||
1059 | + } | ||
1060 | + }), | ||
1061 | +``` | ||
1062 | + | ||
1063 | +This library will always be updated and implementing new features. Feel free to offer PRs and contribute to them. | ||
1064 | + | ||
1015 | 1065 | ||
1016 | ### Other Advanced APIs and Manual configurations | 1066 | ### Other Advanced APIs and Manual configurations |
1017 | GetMaterialApp configures everything for you, but if you want to configure Get Manually using advanced APIs. | 1067 | GetMaterialApp configures everything for you, but if you want to configure Get Manually using advanced APIs. |
@@ -1067,53 +1117,3 @@ Get.contextOverlay // Gives the context of the snackbar/dialog/bottomsheet in th | @@ -1067,53 +1117,3 @@ Get.contextOverlay // Gives the context of the snackbar/dialog/bottomsheet in th | ||
1067 | 1117 | ||
1068 | ``` | 1118 | ``` |
1069 | 1119 | ||
1070 | -### Nested Navigators | ||
1071 | - | ||
1072 | -Get made Flutter's nested navigation even easier. | ||
1073 | -You don't need the context, and you will find your navigation stack by Id. | ||
1074 | - | ||
1075 | -- NOTE: Creating parallel navigation stacks can be dangerous. The ideal is not to use NestedNavigators, or to use sparingly. If your project requires it, go ahead, but keep in mind that keeping multiple navigation stacks in memory may not be a good idea for RAM consumption. | ||
1076 | - | ||
1077 | -See how simple it is: | ||
1078 | -```dart | ||
1079 | - Navigator( | ||
1080 | - key: nestedKey(1), // create a key by index | ||
1081 | - initialRoute: '/', | ||
1082 | - onGenerateRoute: (settings) { | ||
1083 | - if (settings.name == '/') { | ||
1084 | - return GetRouteBase( | ||
1085 | - page: Scaffold( | ||
1086 | - appBar: AppBar( | ||
1087 | - title: Text("Main"), | ||
1088 | - ), | ||
1089 | - body: Center( | ||
1090 | - child: FlatButton( | ||
1091 | - color: Colors.blue, | ||
1092 | - onPressed: () { | ||
1093 | - Get.toNamed('/second', id:1); // navigate by your nested route by index | ||
1094 | - }, | ||
1095 | - child: Text("Go to second")), | ||
1096 | - ), | ||
1097 | - ), | ||
1098 | - ); | ||
1099 | - } else if (settings.name == '/second') { | ||
1100 | - return GetRouteBase( | ||
1101 | - page: Center( | ||
1102 | - child: Scaffold( | ||
1103 | - appBar: AppBar( | ||
1104 | - title: Text("Main"), | ||
1105 | - ), | ||
1106 | - body: Center( | ||
1107 | - child: Text("second") | ||
1108 | - ), | ||
1109 | - ), | ||
1110 | - ), | ||
1111 | - ); | ||
1112 | - } | ||
1113 | - }), | ||
1114 | -``` | ||
1115 | - | ||
1116 | - | ||
1117 | -This library will always be updated and implementing new features. Feel free to offer PRs and contribute to them. | ||
1118 | - | ||
1119 | -<a href="https://www.buymeacoffee.com/jonataslaw" target="_blank"><img src="https://www.buymeacoffee.com/assets/img/custom_images/orange_img.png" alt="Buy Me A Coffee" style="height: 41px !important;width: 174px !important; box-shadow: 0px 3px 2px 0px rgba(190, 190, 190, 0.5) !important;-webkit-box-shadow: 0px 3px 2px 0px rgba(190, 190, 190, 0.5) !important;" > </a> |
@@ -31,6 +31,7 @@ class GetRouteBase<T> extends PageRoute<T> { | @@ -31,6 +31,7 @@ class GetRouteBase<T> extends PageRoute<T> { | ||
31 | this.alignment, | 31 | this.alignment, |
32 | this.parameter, | 32 | this.parameter, |
33 | this.binding, | 33 | this.binding, |
34 | + this.bindings, | ||
34 | this.opaque = true, | 35 | this.opaque = true, |
35 | this.transitionDuration = const Duration(milliseconds: 400), | 36 | this.transitionDuration = const Duration(milliseconds: 400), |
36 | this.popGesture, | 37 | this.popGesture, |
@@ -46,6 +47,9 @@ class GetRouteBase<T> extends PageRoute<T> { | @@ -46,6 +47,9 @@ class GetRouteBase<T> extends PageRoute<T> { | ||
46 | if (binding != null) { | 47 | if (binding != null) { |
47 | binding.dependencies(); | 48 | binding.dependencies(); |
48 | } | 49 | } |
50 | + if (bindings != null) { | ||
51 | + bindings.forEach((element) => element.dependencies()); | ||
52 | + } | ||
49 | } | 53 | } |
50 | 54 | ||
51 | /// Builds the primary contents of the route. | 55 | /// Builds the primary contents of the route. |
@@ -55,6 +59,8 @@ class GetRouteBase<T> extends PageRoute<T> { | @@ -55,6 +59,8 @@ class GetRouteBase<T> extends PageRoute<T> { | ||
55 | 59 | ||
56 | final Bindings binding; | 60 | final Bindings binding; |
57 | 61 | ||
62 | + final List<Bindings> bindings; | ||
63 | + | ||
58 | // final Duration duration; | 64 | // final Duration duration; |
59 | 65 | ||
60 | final Map<String, String> parameter; | 66 | final Map<String, String> parameter; |
@@ -13,6 +13,7 @@ class GetRoute { | @@ -13,6 +13,7 @@ class GetRoute { | ||
13 | final bool maintainState; | 13 | final bool maintainState; |
14 | final bool opaque; | 14 | final bool opaque; |
15 | final Bindings binding; | 15 | final Bindings binding; |
16 | + final List<Bindings> bindings; | ||
16 | final Widget customTransition; | 17 | final Widget customTransition; |
17 | final Duration transitionDuration; | 18 | final Duration transitionDuration; |
18 | final bool fullscreenDialog; | 19 | final bool fullscreenDialog; |
@@ -30,6 +31,7 @@ class GetRoute { | @@ -30,6 +31,7 @@ class GetRoute { | ||
30 | this.transitionDuration = const Duration(milliseconds: 400), | 31 | this.transitionDuration = const Duration(milliseconds: 400), |
31 | this.popGesture, | 32 | this.popGesture, |
32 | this.binding, | 33 | this.binding, |
34 | + this.bindings, | ||
33 | this.transition, | 35 | this.transition, |
34 | this.customTransition, | 36 | this.customTransition, |
35 | this.fullscreenDialog = false, | 37 | this.fullscreenDialog = false, |
@@ -78,7 +78,6 @@ class _GetXState<T extends RxController> extends State<GetX<T>> { | @@ -78,7 +78,6 @@ class _GetXState<T extends RxController> extends State<GetX<T>> { | ||
78 | 78 | ||
79 | if (isCreator || widget.assignId) { | 79 | if (isCreator || widget.assignId) { |
80 | if (widget.autoRemove && Get.isRegistred<T>()) { | 80 | if (widget.autoRemove && Get.isRegistred<T>()) { |
81 | - print("DISPOSEEER CHAMADOOO"); | ||
82 | // controller.onClose(); | 81 | // controller.onClose(); |
83 | Get.delete<T>(); | 82 | Get.delete<T>(); |
84 | } | 83 | } |
@@ -175,7 +175,7 @@ class ListX<E> extends Iterable<E> implements RxInterface<E> { | @@ -175,7 +175,7 @@ class ListX<E> extends Iterable<E> implements RxInterface<E> { | ||
175 | 175 | ||
176 | void addAll(List<E> item) { | 176 | void addAll(List<E> item) { |
177 | _list.addAll(item); | 177 | _list.addAll(item); |
178 | - subject.add(Change<E>.insert(item: _list.last, pos: _list.length - 1)); | 178 | + subject.add(Change<E>.insert(item: _list, pos: _list.length - 1)); |
179 | } | 179 | } |
180 | 180 | ||
181 | /// Adds only if [item] is not null. | 181 | /// Adds only if [item] is not null. |
@@ -183,6 +183,11 @@ class ListX<E> extends Iterable<E> implements RxInterface<E> { | @@ -183,6 +183,11 @@ class ListX<E> extends Iterable<E> implements RxInterface<E> { | ||
183 | if (item != null) add(item); | 183 | if (item != null) add(item); |
184 | } | 184 | } |
185 | 185 | ||
186 | + /// Adds only if [item] is not null. | ||
187 | + void addAllNonNull(Iterable<E> item) { | ||
188 | + if (item != null) addAll(item); | ||
189 | + } | ||
190 | + | ||
186 | void insert(int index, E item) { | 191 | void insert(int index, E item) { |
187 | _list.insert(index, item); | 192 | _list.insert(index, item); |
188 | subject.add(Change<E>.insert(item: item, pos: index)); | 193 | subject.add(Change<E>.insert(item: item, pos: index)); |
@@ -591,7 +596,7 @@ extension MapExtension on Map { | @@ -591,7 +596,7 @@ extension MapExtension on Map { | ||
591 | extension ListExtension<E> on List<E> { | 596 | extension ListExtension<E> on List<E> { |
592 | ListX<E> get obs { | 597 | ListX<E> get obs { |
593 | if (this != null) | 598 | if (this != null) |
594 | - return ListX<E>([])..assignAll(this); | 599 | + return ListX<E>([])..addAllNonNull(this); |
595 | else | 600 | else |
596 | return ListX<E>(null); | 601 | return ListX<E>(null); |
597 | } | 602 | } |
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.10.0 | 3 | +version: 2.10.1 |
4 | homepage: https://github.com/jonataslaw/get | 4 | homepage: https://github.com/jonataslaw/get |
5 | 5 | ||
6 | environment: | 6 | environment: |
@@ -44,7 +44,7 @@ void main() { | @@ -44,7 +44,7 @@ void main() { | ||
44 | expect(find.text("Double: 0.0"), findsOneWidget); | 44 | expect(find.text("Double: 0.0"), findsOneWidget); |
45 | expect(find.text("String: string"), findsOneWidget); | 45 | expect(find.text("String: string"), findsOneWidget); |
46 | expect(find.text("Bool: true"), findsOneWidget); | 46 | expect(find.text("Bool: true"), findsOneWidget); |
47 | - expect(find.text("List: 1"), findsOneWidget); | 47 | + expect(find.text("List: 0"), findsOneWidget); |
48 | expect(find.text("Map: 0"), findsOneWidget); | 48 | expect(find.text("Map: 0"), findsOneWidget); |
49 | 49 | ||
50 | Controller.to.increment(); | 50 | Controller.to.increment(); |
@@ -67,7 +67,7 @@ class Controller extends RxController { | @@ -67,7 +67,7 @@ class Controller extends RxController { | ||
67 | var counter = 0.obs; | 67 | var counter = 0.obs; |
68 | var doubleNum = 0.0.obs; | 68 | var doubleNum = 0.0.obs; |
69 | var string = "string".obs; | 69 | var string = "string".obs; |
70 | - var list = [0].obs; | 70 | + var list = [].obs; |
71 | var map = {}.obs; | 71 | var map = {}.obs; |
72 | var boolean = true.obs; | 72 | var boolean = true.obs; |
73 | 73 |
-
Please register or login to post a comment