Showing
74 changed files
with
1203 additions
and
1185 deletions
Too many changes to show.
To preserve performance only 74 of 74+ files are displayed.
1 | -## [5.0.0-release-candidate-6] | 1 | +## [4.6.5] |
2 | +Fix pub dev score | ||
2 | 3 | ||
3 | --Fix Snackbar, upgrade to flutter 3.22 @Aniketkhote, improve parse route @korutx, fix popScope @wowbox, improve defaultDialog @leeyi, add support to wasm compilation @Ty, fix typos @CodeWithEmad, fix snackbar cancel @seungsuyoo update GetConnect @DaZealous and @ wheeOs, add bengali language @aratheunseen, fix lint issues: @MuhammamdArslanKhan | 4 | +## [4.6.4] |
5 | +Added backward compatibility with flutter 2. | ||
4 | 6 | ||
5 | -## [5.0.0-release-candidate-5] | 7 | +## [4.6.3] |
8 | +Fix SDK constraints | ||
6 | 9 | ||
7 | --Fix nested route issues, fixed issues in the latest flutter version | ||
8 | - | ||
9 | -## [5.0.0-release-candidate-4] | ||
10 | - | ||
11 | --Fix changeThemeMode and RxList | ||
12 | - | ||
13 | -## [5.0.0-release-candidate-3] | ||
14 | - | ||
15 | --Fix changeTheme | ||
16 | - | ||
17 | -## [5.0.0-release-candidate-2] | ||
18 | - | ||
19 | -This version adds built-in support for animation in Flutter in an easy, clear way, and without having to create a StatefulWidget with controllers and animations. All you need to do is call the name of the animation. | ||
20 | - | ||
21 | -If you want to add a "fadeIn" effect to any widget, simply add .fadeIn() to the end of it. | ||
22 | - | ||
23 | -```dart | ||
24 | - Container( | ||
25 | - color: Colors.blue, | ||
26 | - height: 100, | ||
27 | - width: 100, | ||
28 | - ).fadeIn(), | ||
29 | -``` | ||
30 | - | ||
31 | -https://user-images.githubusercontent.com/35742643/221383556-075a0b71-1617-4a31-a3c7-1acc68732f59.mp4 | ||
32 | - | ||
33 | -Maybe you want to merge two or more animations, just concatenate them at the end of the widget. | ||
34 | - | ||
35 | -```dart | ||
36 | - Container( | ||
37 | - color: Colors.blue, | ||
38 | - height: 100, | ||
39 | - width: 100, | ||
40 | - ).fadeIn().bounce(begin: -0.8, end: 0.3), | ||
41 | -``` | ||
42 | - | ||
43 | -https://user-images.githubusercontent.com/35742643/221383613-9044c92f-7c6b-48c4-aa79-0a0c20d4068a.mp4 | ||
44 | - | ||
45 | -Creating animation sequences in Flutter is one of the most painful things to do with the framework. You need to create tons of AnimationControllers. Well, using GetX 5 you just need to tell your animation that it is sequential. Just like that. | ||
46 | - | ||
47 | -```dart | ||
48 | - const FlutterLogo(size: 110) | ||
49 | - .bounce(begin: -0.8, end: 0.4) | ||
50 | - .fadeIn() | ||
51 | - .spin(isSequential: true) | ||
52 | - .wobble(isSequential: true, begin: 0, end: 8) | ||
53 | - .flip(isSequential: true) | ||
54 | - .fadeOut(isSequential: true), | ||
55 | -``` | ||
56 | - | ||
57 | -Result: | ||
58 | - | ||
59 | -https://user-images.githubusercontent.com/35742643/221393968-20cb2411-516b-44a7-8b85-45090bece532.mp4 | ||
60 | - | ||
61 | -## [5.0.0-release-candidate] | ||
62 | - | ||
63 | -Refactor StateManager, RouteManager and InstanceManager from scratch | ||
64 | -Fixed Bugs | ||
65 | -Added a Scopped DI | ||
66 | -Api now uses Navigator 2 | ||
67 | -Added new RouteOutlet | ||
68 | -Added a new futurize method to StateMixin, that tracks updates, errors, and states programatically, | 10 | +## [4.6.2] |
11 | +Added compatibility with flutter 3.0 | ||
69 | 12 | ||
70 | ## [4.6.1] | 13 | ## [4.6.1] |
71 | - | ||
72 | Fix GetConnect on Flutter web | 14 | Fix GetConnect on Flutter web |
73 | 15 | ||
74 | ## [4.6.0] | 16 | ## [4.6.0] |
75 | - | ||
76 | Add useInheritedMediaQuery to GetMaterialApp and GetCupertinoApp (@davidhole) | 17 | Add useInheritedMediaQuery to GetMaterialApp and GetCupertinoApp (@davidhole) |
77 | Add Circular reveal Transition (@parmarravi) | 18 | Add Circular reveal Transition (@parmarravi) |
78 | Add request to failed response (@heftekharm) | 19 | Add request to failed response (@heftekharm) |
@@ -84,12 +25,11 @@ Add proxy setting support to GetConnect (@jtans) | @@ -84,12 +25,11 @@ Add proxy setting support to GetConnect (@jtans) | ||
84 | Fix markAsDirty used on permanent controllers (@zenalex) | 25 | Fix markAsDirty used on permanent controllers (@zenalex) |
85 | Update Korean readme (@dumbokim) | 26 | Update Korean readme (@dumbokim) |
86 | 27 | ||
87 | -## [4.5.1] | ||
88 | 28 | ||
29 | +## [4.5.1] | ||
89 | Fix Snackbar when it have action and icon the same time | 30 | Fix Snackbar when it have action and icon the same time |
90 | 31 | ||
91 | ## [4.5.0] - Big Update | 32 | ## [4.5.0] - Big Update |
92 | - | ||
93 | To have a page-agnostic snackbar, we used OverlayRoute to display a partial route. | 33 | To have a page-agnostic snackbar, we used OverlayRoute to display a partial route. |
94 | However this had several problems: | 34 | However this had several problems: |
95 | 35 | ||
@@ -139,23 +79,23 @@ Breaking and Depreciation: | @@ -139,23 +79,23 @@ Breaking and Depreciation: | ||
139 | GetBar is now deprecated, use GetSnackbar instead. | 79 | GetBar is now deprecated, use GetSnackbar instead. |
140 | dismissDirection now gets a DismissDirection, making the Snackbar more customizable. | 80 | dismissDirection now gets a DismissDirection, making the Snackbar more customizable. |
141 | 81 | ||
142 | -## [4.3.8] | ||
143 | 82 | ||
83 | + | ||
84 | + | ||
85 | + | ||
86 | +## [4.3.8] | ||
144 | - Fix nav2 toNamed remove the route | 87 | - Fix nav2 toNamed remove the route |
145 | 88 | ||
146 | ## [4.3.7] | 89 | ## [4.3.7] |
147 | - | ||
148 | - Fix wrong currentRoute when a route is removed | 90 | - Fix wrong currentRoute when a route is removed |
149 | - Remove take that limits the router outlet depth (@steven-spiel) | 91 | - Remove take that limits the router outlet depth (@steven-spiel) |
150 | 92 | ||
151 | ## [4.3.6] | 93 | ## [4.3.6] |
152 | - | ||
153 | - Fix error with autodispose of additional dependencies beyond GetxController | 94 | - Fix error with autodispose of additional dependencies beyond GetxController |
154 | - Added ability to add your own delegate to RouterOutlet (@steven-spiel) | 95 | - Added ability to add your own delegate to RouterOutlet (@steven-spiel) |
155 | - Added listenAndPump to Rx to give Rx the same behavior as BehaviorSubject (@steven-spiel) | 96 | - Added listenAndPump to Rx to give Rx the same behavior as BehaviorSubject (@steven-spiel) |
156 | 97 | ||
157 | ## [4.3.5] | 98 | ## [4.3.5] |
158 | - | ||
159 | - Fix GetConnect timeout (@jasonlaw) | 99 | - Fix GetConnect timeout (@jasonlaw) |
160 | - Improve Vietnamese docs (@hp1909) | 100 | - Improve Vietnamese docs (@hp1909) |
161 | - Refactor placeholder name route to unnamed routes (@roipeker). | 101 | - Refactor placeholder name route to unnamed routes (@roipeker). |
@@ -164,25 +104,20 @@ dismissDirection now gets a DismissDirection, making the Snackbar more customiza | @@ -164,25 +104,20 @@ dismissDirection now gets a DismissDirection, making the Snackbar more customiza | ||
164 | - Added assert to prevent the user from starting a route name without slash. | 104 | - Added assert to prevent the user from starting a route name without slash. |
165 | 105 | ||
166 | ## [4.3.4] | 106 | ## [4.3.4] |
167 | - | ||
168 | - Improve docs | 107 | - Improve docs |
169 | 108 | ||
170 | ## [4.3.3] | 109 | ## [4.3.3] |
171 | - | ||
172 | - Fix Get.reset | 110 | - Fix Get.reset |
173 | 111 | ||
174 | ## [4.3.2] | 112 | ## [4.3.2] |
175 | - | ||
176 | - Fix nullable on internacionalization (@jmguillens) | 113 | - Fix nullable on internacionalization (@jmguillens) |
177 | - Fix nullable on Rx.stream (@steven-spiel) | 114 | - Fix nullable on Rx.stream (@steven-spiel) |
178 | 115 | ||
179 | ## [4.3.1] | 116 | ## [4.3.1] |
180 | - | ||
181 | - Fix controller is not removed when keyboard is open. | 117 | - Fix controller is not removed when keyboard is open. |
182 | - Improved: Safe removal and insertion of controllers. | 118 | - Improved: Safe removal and insertion of controllers. |
183 | 119 | ||
184 | ## [4.3.0] | 120 | ## [4.3.0] |
185 | - | ||
186 | - Added GetResponsiveWidget (@ahmednfwela) | 121 | - Added GetResponsiveWidget (@ahmednfwela) |
187 | - Added `Get.replace()` (@jwelmac) | 122 | - Added `Get.replace()` (@jwelmac) |
188 | - Added Improve korean doc (@sejun2) | 123 | - Added Improve korean doc (@sejun2) |
@@ -190,7 +125,6 @@ dismissDirection now gets a DismissDirection, making the Snackbar more customiza | @@ -190,7 +125,6 @@ dismissDirection now gets a DismissDirection, making the Snackbar more customiza | ||
190 | - Added gestureWidth and showCupertinoParallax to GetPage to customize cupertino transitions | 125 | - Added gestureWidth and showCupertinoParallax to GetPage to customize cupertino transitions |
191 | 126 | ||
192 | ## [4.2.5] | 127 | ## [4.2.5] |
193 | - | ||
194 | - Added anchorRoute and filterPages to GetRouterOutlet (@ahmednfwela) | 128 | - Added anchorRoute and filterPages to GetRouterOutlet (@ahmednfwela) |
195 | - Added scrollBehavior and scaffoldMessengerKey to GetMaterialapp(@ejabu and @alionour) | 129 | - Added scrollBehavior and scaffoldMessengerKey to GetMaterialapp(@ejabu and @alionour) |
196 | - Fix error when child on MaterialApp is null (@ahmednfwela) | 130 | - Fix error when child on MaterialApp is null (@ahmednfwela) |
@@ -198,16 +132,13 @@ dismissDirection now gets a DismissDirection, making the Snackbar more customiza | @@ -198,16 +132,13 @@ dismissDirection now gets a DismissDirection, making the Snackbar more customiza | ||
198 | - Fix error with onClose called before routeTransition on Get.offNamed | 132 | - Fix error with onClose called before routeTransition on Get.offNamed |
199 | 133 | ||
200 | ## [4.2.4] | 134 | ## [4.2.4] |
201 | - | ||
202 | - Fix Get.offAll removing GetxServices from memory | 135 | - Fix Get.offAll removing GetxServices from memory |
203 | 136 | ||
204 | ## [4.2.3] | 137 | ## [4.2.3] |
205 | - | ||
206 | - Fix back button on navigator 2 | 138 | - Fix back button on navigator 2 |
207 | - Added parameters and arguments to Get.rootDelegate | 139 | - Added parameters and arguments to Get.rootDelegate |
208 | 140 | ||
209 | ## [4.2.1] | 141 | ## [4.2.1] |
210 | - | ||
211 | - Remove [] from docs to try fix pub score | 142 | - Remove [] from docs to try fix pub score |
212 | 143 | ||
213 | ## [4.2.0] - Big update | 144 | ## [4.2.0] - Big update |
@@ -219,101 +150,100 @@ Changes in this version: | @@ -219,101 +150,100 @@ Changes in this version: | ||
219 | - Fix: Navigating to the same page with Get.offNamed does not delete the controller from that page using Get.lazyPut. | 150 | - Fix: Navigating to the same page with Get.offNamed does not delete the controller from that page using Get.lazyPut. |
220 | 151 | ||
221 | - Fix Readme GetMiddleware typos | 152 | - Fix Readme GetMiddleware typos |
222 | - by @nivisi | 153 | +by @nivisi |
223 | 154 | ||
224 | - Fix url replace error | 155 | - Fix url replace error |
225 | - by @KevinZhang19870314 | 156 | +by @KevinZhang19870314 |
226 | 157 | ||
227 | - Changed response default encoding from latin1 to utf8 | 158 | - Changed response default encoding from latin1 to utf8 |
228 | - by @heftekharm | 159 | +by @heftekharm |
229 | 160 | ||
230 | - Add Duration in ExtensionBottomSheet | 161 | - Add Duration in ExtensionBottomSheet |
231 | - by @chanonpingpong | 162 | +by @chanonpingpong |
232 | 163 | ||
233 | - Added compatibility with dart-lang/mockito | 164 | - Added compatibility with dart-lang/mockito |
234 | - by @lifez | 165 | +by @lifez |
235 | 166 | ||
236 | - Added extensions methods to convert value in percent value | 167 | - Added extensions methods to convert value in percent value |
237 | - by @kauemurakami | 168 | +by @kauemurakami |
238 | 169 | ||
239 | - Set darkTheme equal theme when darkTheme is null | 170 | - Set darkTheme equal theme when darkTheme is null |
240 | - by @eduardoFlorence | 171 | +by @eduardoFlorence |
241 | 172 | ||
242 | - Add padding to 'defaultDialog' | 173 | - Add padding to 'defaultDialog' |
243 | - by @KevinZhang19870314 | 174 | +by @KevinZhang19870314 |
244 | 175 | ||
245 | - GraphQLResponse inherit Response info | 176 | - GraphQLResponse inherit Response info |
246 | - by @jasonlaw | 177 | +by @jasonlaw |
247 | 178 | ||
248 | - Fix Redundant concatenating base url | 179 | - Fix Redundant concatenating base url |
249 | - by @jasonlaw | 180 | +by @jasonlaw |
250 | 181 | ||
251 | - Add content type and length into the headers when the content type is 'application/x-www-form-urlencoded' | 182 | - Add content type and length into the headers when the content type is 'application/x-www-form-urlencoded' |
252 | - by @calvingit | 183 | +by @calvingit |
253 | 184 | ||
254 | - Make withCredentials configurable | 185 | - Make withCredentials configurable |
255 | - by @jasonlaw | 186 | +by @jasonlaw |
256 | 187 | ||
257 | - Fix flutter 2.0 error | 188 | - Fix flutter 2.0 error |
258 | - by @yunchiri | 189 | +by @yunchiri |
259 | 190 | ||
260 | - Allow deleting all registered instances | 191 | - Allow deleting all registered instances |
261 | - by @lemps | 192 | +by @lemps |
262 | 193 | ||
263 | - Refactor/rx interface notify children | 194 | - Refactor/rx interface notify children |
264 | - @by kranfix | 195 | +@by kranfix |
265 | 196 | ||
266 | - Fixed parameter parsing and middleware sorting | 197 | - Fixed parameter parsing and middleware sorting |
267 | - by @ahmednfwela | 198 | +by @ahmednfwela |
268 | 199 | ||
269 | - Improvements to router outlet | 200 | - Improvements to router outlet |
270 | - by @ahmednfwela | 201 | +by @ahmednfwela |
271 | 202 | ||
272 | - Minor improvements and bug fixes | 203 | - Minor improvements and bug fixes |
273 | - by @ahmednfwela | 204 | +by @ahmednfwela |
274 | 205 | ||
275 | - Adding route guards and improving navigation | 206 | - Adding route guards and improving navigation |
276 | - by @ahmednfwela | 207 | +by @ahmednfwela |
277 | 208 | ||
278 | - Fix RxInterface.proxy losing its previous value on exception | 209 | - Fix RxInterface.proxy losing its previous value on exception |
279 | - by @WillowWisp | 210 | +by @WillowWisp |
280 | 211 | ||
281 | - Added dispose() for bottomSheet. | 212 | - Added dispose() for bottomSheet. |
282 | - by @furkankurt | 213 | +by @furkankurt |
283 | 214 | ||
284 | - Added Pull request template | 215 | - Added Pull request template |
285 | - by @unacorbatanegra | 216 | +by @unacorbatanegra |
286 | 217 | ||
287 | - Fix and update documentation: | 218 | - Fix and update documentation: |
288 | - @Farid566, | ||
289 | - @galaxykhh, | ||
290 | - @arslee07, | ||
291 | - @GoStaRoff, | ||
292 | - @BondarenkoArtur, | ||
293 | - @denisrudnei, | ||
294 | - @Charly6596, | ||
295 | - @nateshmbhat, | ||
296 | - @hrithikrtiwari, | ||
297 | - @Undeadlol1, | ||
298 | - @rws08, | ||
299 | - @inuyashaaa, | ||
300 | - @broccolism, | ||
301 | - @aadarshadhakalg, | ||
302 | - @ZeroMinJeon | 219 | +@Farid566, |
220 | +@galaxykhh, | ||
221 | +@arslee07, | ||
222 | +@GoStaRoff, | ||
223 | +@BondarenkoArtur, | ||
224 | +@denisrudnei, | ||
225 | +@Charly6596, | ||
226 | +@nateshmbhat, | ||
227 | +@hrithikrtiwari, | ||
228 | +@Undeadlol1, | ||
229 | +@rws08, | ||
230 | +@inuyashaaa, | ||
231 | +@broccolism, | ||
232 | +@aadarshadhakalg, | ||
233 | +@ZeroMinJeon | ||
303 | 234 | ||
304 | -## [4.1.4] | ||
305 | 235 | ||
236 | +## [4.1.4] | ||
306 | - Adjust operator + and - to RxInt (@eduardoflorence) | 237 | - Adjust operator + and - to RxInt (@eduardoflorence) |
307 | - Fix dark theme (@eduardoflorence) | 238 | - Fix dark theme (@eduardoflorence) |
308 | - Fix form-urlencoded on GetConnect (@aramayyes) | 239 | - Fix form-urlencoded on GetConnect (@aramayyes) |
309 | 240 | ||
310 | -## [4.1.3] | ||
311 | 241 | ||
242 | +## [4.1.3] | ||
312 | - Fix "Error: A value of type 'Locale?' can't be returned from a function"on flutter web (@nickwri) | 243 | - Fix "Error: A value of type 'Locale?' can't be returned from a function"on flutter web (@nickwri) |
313 | - Fix plural translations to expressions >1 (@WolfVic) | 244 | - Fix plural translations to expressions >1 (@WolfVic) |
314 | 245 | ||
315 | ## [4.1.2] | 246 | ## [4.1.2] |
316 | - | ||
317 | - Fix warning ˜can add data to a closed stream˜ when GetBuilder and Obx are nested | 247 | - Fix warning ˜can add data to a closed stream˜ when GetBuilder and Obx are nested |
318 | - Fix get_connect decoder can not be null (@Goddchen) | 248 | - Fix get_connect decoder can not be null (@Goddchen) |
319 | - Migrate example code (@3lB4rt0) | 249 | - Migrate example code (@3lB4rt0) |
@@ -324,28 +254,23 @@ Changes in this version: | @@ -324,28 +254,23 @@ Changes in this version: | ||
324 | - Fix controller is removed when navigate to same page (@eduardoflorence) | 254 | - Fix controller is removed when navigate to same page (@eduardoflorence) |
325 | - Fix missing reload() and reloadAll() to Get extensions (@lkloon123) | 255 | - Fix missing reload() and reloadAll() to Get extensions (@lkloon123) |
326 | 256 | ||
327 | -## [4.1.1] | ||
328 | 257 | ||
258 | +## [4.1.1] | ||
329 | - Remove mandatory initialValue to nullables types | 259 | - Remove mandatory initialValue to nullables types |
330 | 260 | ||
331 | ## [4.1.0] | 261 | ## [4.1.0] |
332 | - | ||
333 | - Added Rxn to non nullables reactives types | 262 | - Added Rxn to non nullables reactives types |
334 | 263 | ||
335 | ## [4.0.3] | 264 | ## [4.0.3] |
336 | - | ||
337 | - Added new linter rules to improve score | 265 | - Added new linter rules to improve score |
338 | 266 | ||
339 | ## [4.0.2] | 267 | ## [4.0.2] |
340 | - | ||
341 | - Removed "!" of if else conditions until the null-safety of the dart is consistent for using it. | 268 | - Removed "!" of if else conditions until the null-safety of the dart is consistent for using it. |
342 | 269 | ||
343 | ## [4.0.1] | 270 | ## [4.0.1] |
344 | - | ||
345 | - Fix changelog | 271 | - Fix changelog |
346 | 272 | ||
347 | ## [4.0.0] | 273 | ## [4.0.0] |
348 | - | ||
349 | - Added append function to StateMixin. Now is possible track loading, success and error handle of your application with ONE LINE OF CODE. Ex: append(()=> api.getUser); | 274 | - Added append function to StateMixin. Now is possible track loading, success and error handle of your application with ONE LINE OF CODE. Ex: append(()=> api.getUser); |
350 | - Migrate to null-safety | 275 | - Migrate to null-safety |
351 | - Added ScrollMixin to controllers | 276 | - Added ScrollMixin to controllers |
@@ -366,7 +291,6 @@ You can also use custom Rxn types with null-safety: | @@ -366,7 +291,6 @@ You can also use custom Rxn types with null-safety: | ||
366 | `RxnInt` == nullable. | 291 | `RxnInt` == nullable. |
367 | 292 | ||
368 | ## [3.25.6] | 293 | ## [3.25.6] |
369 | - | ||
370 | - Added documentation in French (@kamazoun) | 294 | - Added documentation in French (@kamazoun) |
371 | - Fix logs messages (@damphat) | 295 | - Fix logs messages (@damphat) |
372 | - Fix plural to zero on internacionalization (@RafaRuiz) | 296 | - Fix plural to zero on internacionalization (@RafaRuiz) |
@@ -375,37 +299,31 @@ You can also use custom Rxn types with null-safety: | @@ -375,37 +299,31 @@ You can also use custom Rxn types with null-safety: | ||
375 | - Fix group updates to GetBuilder | 299 | - Fix group updates to GetBuilder |
376 | 300 | ||
377 | ## [3.25.5] | 301 | ## [3.25.5] |
378 | - | ||
379 | - Fix Get.isDialogOpen when two or more open dialogs are closed | 302 | - Fix Get.isDialogOpen when two or more open dialogs are closed |
380 | 303 | ||
381 | ## [3.25.4] | 304 | ## [3.25.4] |
382 | - | ||
383 | - Added logs and tests to unknownRoute | 305 | - Added logs and tests to unknownRoute |
384 | 306 | ||
385 | ## [3.25.3] | 307 | ## [3.25.3] |
386 | - | ||
387 | - Fix bindStream error 'Object.noSuchMethod'. | 308 | - Fix bindStream error 'Object.noSuchMethod'. |
388 | 309 | ||
389 | ## [3.25.2] | 310 | ## [3.25.2] |
390 | - | ||
391 | - Improved Workers system to accept a list of works | 311 | - Improved Workers system to accept a list of works |
392 | 312 | ||
393 | ## [3.25.1] | 313 | ## [3.25.1] |
394 | - | ||
395 | - Improved the log system to display the tag used in the controller that was created. | 314 | - Improved the log system to display the tag used in the controller that was created. |
396 | 315 | ||
397 | ## [3.25.0] - Big update | 316 | ## [3.25.0] - Big update |
398 | - | ||
399 | - Added [reload] and [reloadAll] methods to reload your Controller to original values | 317 | - Added [reload] and [reloadAll] methods to reload your Controller to original values |
400 | - Added [FullLifeCycleController] - A GetxController capable of observing all the life cycles of your application. FullLifeCycleController has the life cycles: | 318 | - Added [FullLifeCycleController] - A GetxController capable of observing all the life cycles of your application. FullLifeCycleController has the life cycles: |
401 | - - onInit: called when the controller enters the application's memory | ||
402 | - - onReady: called after onInit, when build method from widget relationed to controller is done. | ||
403 | - - onClose: called when controller is deleted from memory. | ||
404 | - - onPaused: called when the application is not currently visible to the user, and running in the background. | ||
405 | - - onInactive: called when the application is in an inactive state and is not receiving user input, when the user receives a call, for example | ||
406 | - - onResumed: The application is now visible and in the foreground | ||
407 | - - onDetached: The application is still hosted on a flutter engine but is detached from any host views. | ||
408 | - - didChangeMetrics: called when the window size is changed | 319 | + * onInit: called when the controller enters the application's memory |
320 | + * onReady: called after onInit, when build method from widget relationed to controller is done. | ||
321 | + * onClose: called when controller is deleted from memory. | ||
322 | + * onPaused: called when the application is not currently visible to the user, and running in the background. | ||
323 | + * onInactive: called when the application is in an inactive state and is not receiving user input, when the user receives a call, for example | ||
324 | + * onResumed: The application is now visible and in the foreground | ||
325 | + * onDetached: The application is still hosted on a flutter engine but is detached from any host views. | ||
326 | + * didChangeMetrics: called when the window size is changed | ||
409 | - Added SuperController, a complete life circle controller with StateMixin | 327 | - Added SuperController, a complete life circle controller with StateMixin |
410 | - Improve Iterable Rx Api. Now, you can to use dart List, Map and Set as reactive, like: List<String> names = <String>['juan', 'pedro', 'maria'].obs; | 328 | - Improve Iterable Rx Api. Now, you can to use dart List, Map and Set as reactive, like: List<String> names = <String>['juan', 'pedro', 'maria'].obs; |
411 | - Added assign and assignAll extensions to default dart List | 329 | - Added assign and assignAll extensions to default dart List |
@@ -428,11 +346,11 @@ You can also use custom Rxn types with null-safety: | @@ -428,11 +346,11 @@ You can also use custom Rxn types with null-safety: | ||
428 | - Added more status codes to GetConnect (@romavic) | 346 | - Added more status codes to GetConnect (@romavic) |
429 | - Fix and improve docs: @unacorbatanegra, @lsm, @nivisi, @ThinkDigitalSoftware, @martwozniak, @UsamaElgendy, @@DominusKelvin, @jintak0401, @goondeal | 347 | - Fix and improve docs: @unacorbatanegra, @lsm, @nivisi, @ThinkDigitalSoftware, @martwozniak, @UsamaElgendy, @@DominusKelvin, @jintak0401, @goondeal |
430 | 348 | ||
431 | -## [3.24.0] | ||
432 | 349 | ||
350 | +## [3.24.0] | ||
433 | - GetWidget has been completely redesigned. | 351 | - GetWidget has been completely redesigned. |
434 | - Throughout its lifetime, GetWidget has always been mentioned in the documentation as "something you shouldn't use unless you're sure you need it", and it had a very small use case. A short time ago we realized that it could have some unexpected behaviors, when compared to GetView, so we decided to rebuild it from scratch, creating a really useful widget for the ecosystem. | ||
435 | - Objectively, GetWidget is now a Widget that caches the controller and protects children from their parents' reconstructions. This means that if you have a ListView or gridview, you can add items to it without the child (being a GetWidget) being rebuilt. The api is now more concise, as you can use Get.put / Get.lazyput for global dependencies, and Get.create with GetWidget for ephemeral dependencies, or when you need several identical controllers for the same widget, eliminating the need for tags for most cases. | 352 | +Throughout its lifetime, GetWidget has always been mentioned in the documentation as "something you shouldn't use unless you're sure you need it", and it had a very small use case. A short time ago we realized that it could have some unexpected behaviors, when compared to GetView, so we decided to rebuild it from scratch, creating a really useful widget for the ecosystem. |
353 | +Objectively, GetWidget is now a Widget that caches the controller and protects children from their parents' reconstructions. This means that if you have a ListView or gridview, you can add items to it without the child (being a GetWidget) being rebuilt. The api is now more concise, as you can use Get.put / Get.lazyput for global dependencies, and Get.create with GetWidget for ephemeral dependencies, or when you need several identical controllers for the same widget, eliminating the need for tags for most cases. | ||
436 | 354 | ||
437 | - Workers now have error handlers, so if an error occurs in your stream, you can recover it from your workers. | 355 | - Workers now have error handlers, so if an error occurs in your stream, you can recover it from your workers. |
438 | 356 | ||
@@ -441,19 +359,19 @@ You can also use custom Rxn types with null-safety: | @@ -441,19 +359,19 @@ You can also use custom Rxn types with null-safety: | ||
441 | - [Patch] method was added in GetConnect. | 359 | - [Patch] method was added in GetConnect. |
442 | 360 | ||
443 | - Native methods for RxString (trim, contains, startWith, etc.) have been added. | 361 | - Native methods for RxString (trim, contains, startWith, etc.) have been added. |
362 | + | ||
444 | - Standard constructors for RxList and RxMap have been added (RxList.generate, RxList.from, Map.of, Map.from, etc). | 363 | - Standard constructors for RxList and RxMap have been added (RxList.generate, RxList.from, Map.of, Map.from, etc). |
445 | 364 | ||
446 | - Added "onEmpty" status in StateMixin (@alizera) | 365 | - Added "onEmpty" status in StateMixin (@alizera) |
447 | 366 | ||
448 | - Added query and mutation methods of graphql for getconnect. | 367 | - Added query and mutation methods of graphql for getconnect. |
368 | + | ||
449 | - Added body string for content-type application/x-www-form-urlencoded on GetConnect (@eduardoflorence) | 369 | - Added body string for content-type application/x-www-form-urlencoded on GetConnect (@eduardoflorence) |
450 | 370 | ||
451 | ## [3.23.1] | 371 | ## [3.23.1] |
452 | - | ||
453 | - Fix allowSelfSigned on Flutter web | 372 | - Fix allowSelfSigned on Flutter web |
454 | 373 | ||
455 | ## [3.23.0] | 374 | ## [3.23.0] |
456 | - | ||
457 | - Add GetResponsive (@SchabanBo) | 375 | - Add GetResponsive (@SchabanBo) |
458 | - Update tests, fix predicate for offNamedUntil (@vbuberen) | 376 | - Update tests, fix predicate for offNamedUntil (@vbuberen) |
459 | - Added Urdu Version for Pakistani Developers (@UsamaSarwar) | 377 | - Added Urdu Version for Pakistani Developers (@UsamaSarwar) |
@@ -468,17 +386,15 @@ You can also use custom Rxn types with null-safety: | @@ -468,17 +386,15 @@ You can also use custom Rxn types with null-safety: | ||
468 | - Added Indonesian version to Indonesian Developers (@pratamatama) | 386 | - Added Indonesian version to Indonesian Developers (@pratamatama) |
469 | 387 | ||
470 | ## [3.22.2] | 388 | ## [3.22.2] |
471 | - | ||
472 | - Fix overlayEntries is null on Master/Dev branch of Flutter | 389 | - Fix overlayEntries is null on Master/Dev branch of Flutter |
473 | 390 | ||
474 | ## [3.22.1] | 391 | ## [3.22.1] |
475 | - | ||
476 | - Improve: auto jsonDecode occurs only if response.header.contentType is "application/json" | 392 | - Improve: auto jsonDecode occurs only if response.header.contentType is "application/json" |
477 | - Improve and fix requests types (@eduardoflorence) | 393 | - Improve and fix requests types (@eduardoflorence) |
478 | - Fix HeaderValue variables with same name (@haidang93) | 394 | - Fix HeaderValue variables with same name (@haidang93) |
479 | 395 | ||
480 | -## [3.22.0] | ||
481 | 396 | ||
397 | +## [3.22.0] | ||
482 | - Added: more multipart options. Now you can send as multipart: | 398 | - Added: more multipart options. Now you can send as multipart: |
483 | 399 | ||
484 | File: | 400 | File: |
@@ -493,22 +409,19 @@ Or bytes (Flutter web work only with bytes): | @@ -493,22 +409,19 @@ Or bytes (Flutter web work only with bytes): | ||
493 | - Added: Upload Progress to MultipartRequest | 409 | - Added: Upload Progress to MultipartRequest |
494 | - Added support to List<MultipartFile> (@jasonlaw) | 410 | - Added support to List<MultipartFile> (@jasonlaw) |
495 | 411 | ||
496 | -## [3.21.3] | ||
497 | 412 | ||
413 | +## [3.21.3] | ||
498 | - Improve multipart file and defaultDecoder on GetConnect | 414 | - Improve multipart file and defaultDecoder on GetConnect |
499 | 415 | ||
500 | ## [3.21.2] | 416 | ## [3.21.2] |
501 | - | ||
502 | - Fix GetConnect.request returning a PUT request | 417 | - Fix GetConnect.request returning a PUT request |
503 | 418 | ||
504 | ## [3.21.1] | 419 | ## [3.21.1] |
505 | - | ||
506 | - Allow null body to POST method on GetConnect | 420 | - Allow null body to POST method on GetConnect |
507 | 421 | ||
508 | ## [3.21.0] - Big update | 422 | ## [3.21.0] - Big update |
509 | - | ||
510 | -- This update attaches two nice features developed by (@SchabanBo): _GetPage Children_ And _GetMiddleware_ | ||
511 | - In previous versions, to create child pages, you should do something like: | 423 | +- This update attaches two nice features developed by (@SchabanBo): *GetPage Children* And *GetMiddleware* |
424 | +In previous versions, to create child pages, you should do something like: | ||
512 | 425 | ||
513 | ```dart | 426 | ```dart |
514 | GetPage( | 427 | GetPage( |
@@ -527,12 +440,10 @@ GetPage( | @@ -527,12 +440,10 @@ GetPage( | ||
527 | binding: ElectronicsBinding(), | 440 | binding: ElectronicsBinding(), |
528 | ), | 441 | ), |
529 | ``` | 442 | ``` |
530 | - | ||
531 | Although the feature works well, it could be improved in several ways: | 443 | Although the feature works well, it could be improved in several ways: |
532 | 1- If you had many pages, the page file could become huge and difficult to read. Besides, it was difficult to know which page was the daughter of which module. | 444 | 1- If you had many pages, the page file could become huge and difficult to read. Besides, it was difficult to know which page was the daughter of which module. |
533 | 2- It was not possible to delegate the function of naming routes to a subroutine file. | 445 | 2- It was not possible to delegate the function of naming routes to a subroutine file. |
534 | With this update, it is possible to create a declarative structure, very similar to the Flutter widget tree for your route, which might look like this: | 446 | With this update, it is possible to create a declarative structure, very similar to the Flutter widget tree for your route, which might look like this: |
535 | - | ||
536 | ```dart | 447 | ```dart |
537 | GetPage( | 448 | GetPage( |
538 | name: '/home', | 449 | name: '/home', |
@@ -554,11 +465,10 @@ GetPage( | @@ -554,11 +465,10 @@ GetPage( | ||
554 | ], | 465 | ], |
555 | ); | 466 | ); |
556 | ``` | 467 | ``` |
557 | - | ||
558 | Thus, when accessing the url: '/home/products/electronics' | 468 | Thus, when accessing the url: '/home/products/electronics' |
559 | Or use Get.toNamed('/home/products/electronics') it will go directly to the page [ElectronicsView], because the child pages, automatically inherit the name of the ancestral page, so _with any small change on any father in the tree all children will be updated._ If you change [/products] to [/accessories], you don't nesse update on all child links. | 469 | Or use Get.toNamed('/home/products/electronics') it will go directly to the page [ElectronicsView], because the child pages, automatically inherit the name of the ancestral page, so _with any small change on any father in the tree all children will be updated._ If you change [/products] to [/accessories], you don't nesse update on all child links. |
560 | 470 | ||
561 | -However, the most powerful feature of this version is _GetMiddlewares_. | 471 | +However, the most powerful feature of this version is *GetMiddlewares*. |
562 | The GetPage has now new property that takes a list of GetMiddleWare than can perform actions and run them in the specific order. | 472 | The GetPage has now new property that takes a list of GetMiddleWare than can perform actions and run them in the specific order. |
563 | 473 | ||
564 | ### Priority | 474 | ### Priority |
@@ -573,7 +483,6 @@ final middlewares = [ | @@ -573,7 +483,6 @@ final middlewares = [ | ||
573 | GetMiddleware(priority: -8), | 483 | GetMiddleware(priority: -8), |
574 | ]; | 484 | ]; |
575 | ``` | 485 | ``` |
576 | - | ||
577 | those middlewares will be run in this order **-8 => 2 => 4 => 5** | 486 | those middlewares will be run in this order **-8 => 2 => 4 => 5** |
578 | 487 | ||
579 | ### Redirect | 488 | ### Redirect |
@@ -635,65 +544,57 @@ This function will be called right after the GetPage.page function is called and | @@ -635,65 +544,57 @@ This function will be called right after the GetPage.page function is called and | ||
635 | This function will be called right after disposing all the related objects (Controllers, views, ...) of the page. | 544 | This function will be called right after disposing all the related objects (Controllers, views, ...) of the page. |
636 | 545 | ||
637 | ## [3.20.1] | 546 | ## [3.20.1] |
638 | - | ||
639 | -- Fix wrong reference with unnamed routes and added more tests | 547 | +* Fix wrong reference with unnamed routes and added more tests |
640 | 548 | ||
641 | ## [3.20.0] - Big update | 549 | ## [3.20.0] - Big update |
550 | +* Added GetConnect. | ||
551 | +- GetConnect is an easy way to communicate from your back to your front. With it you can: | ||
552 | +- Communicate through websockets | ||
553 | +- Send messages and events via websockets. | ||
554 | +- Listen to messages and events via websockets. | ||
555 | +- Make http requests (GET, PUT, POST, DELETE). | ||
556 | +- Add request modifiers (like attaching a token to each request made). | ||
557 | +- Add answer modifiers (how to change a value field whenever the answer arrives) | ||
558 | +- Add an authenticator, if the answer is 401, you can configure the renewal of your JWT, for example, and then it will again make the http request. | ||
559 | +- Set the number of attempts for the authenticator | ||
560 | +- Define a baseUrl for all requests | ||
561 | +- Define a standard encoder for your Model. | ||
562 | +- Note1: You will never need to use jsonEncoder. It will always be called automatically with each request. If you define an encoder for your model, it will return the instance of your model class ALREADY FILLED with server data. | ||
563 | +- Note2: all requests are safety, you do not need to insert try / catch in requests. It will always return a response. In case of an error code, Response.hasError will return true. The error code will always be returned, unless the error was a connection error, which will be returned Response.hasError, but with error code null. | ||
564 | +- These are relatively new features, and also inserted in separate containers. You don't have to use it if you don't want to. As it is relatively new, some functions, such as specific http methods, may be missing. | ||
565 | +* Translation to Korean (@rws08) | ||
566 | +* Fix Overlays state (@eduardoflorence) | ||
567 | +* Update chinese docs (@jonahzheng) | ||
568 | +* Added context.isDarkMode to context extensions | ||
642 | 569 | ||
643 | -- Added GetConnect. | ||
644 | - | ||
645 | -* GetConnect is an easy way to communicate from your back to your front. With it you can: | ||
646 | -* Communicate through websockets | ||
647 | -* Send messages and events via websockets. | ||
648 | -* Listen to messages and events via websockets. | ||
649 | -* Make http requests (GET, PUT, POST, DELETE). | ||
650 | -* Add request modifiers (like attaching a token to each request made). | ||
651 | -* Add answer modifiers (how to change a value field whenever the answer arrives) | ||
652 | -* Add an authenticator, if the answer is 401, you can configure the renewal of your JWT, for example, and then it will again make the http request. | ||
653 | -* Set the number of attempts for the authenticator | ||
654 | -* Define a baseUrl for all requests | ||
655 | -* Define a standard encoder for your Model. | ||
656 | -* Note1: You will never need to use jsonEncoder. It will always be called automatically with each request. If you define an encoder for your model, it will return the instance of your model class ALREADY FILLED with server data. | ||
657 | -* Note2: all requests are safety, you do not need to insert try / catch in requests. It will always return a response. In case of an error code, Response.hasError will return true. The error code will always be returned, unless the error was a connection error, which will be returned Response.hasError, but with error code null. | ||
658 | -* These are relatively new features, and also inserted in separate containers. You don't have to use it if you don't want to. As it is relatively new, some functions, such as specific http methods, may be missing. | ||
659 | - | ||
660 | -- Translation to Korean (@rws08) | ||
661 | -- Fix Overlays state (@eduardoflorence) | ||
662 | -- Update chinese docs (@jonahzheng) | ||
663 | -- Added context.isDarkMode to context extensions | ||
664 | 570 | ||
665 | ## [3.17.1] | 571 | ## [3.17.1] |
666 | - | ||
667 | - Allow list.assignAll, map.assignAll and set.assignAll operate with null values | 572 | - Allow list.assignAll, map.assignAll and set.assignAll operate with null values |
668 | 573 | ||
669 | ## [3.17.0] | 574 | ## [3.17.0] |
670 | - | ||
671 | - Added GetCupertinoApp | 575 | - Added GetCupertinoApp |
672 | - Added initial suport to navigator 2.0 | 576 | - Added initial suport to navigator 2.0 |
673 | 577 | ||
674 | ## [3.16.2] | 578 | ## [3.16.2] |
675 | - | ||
676 | - Clean RxList, RxMap and RxSet implementation | 579 | - Clean RxList, RxMap and RxSet implementation |
677 | - Now when declaring an `RxList()`, it will be started empty. If you want to start a null RxList, you must use `RxList(null)`. | 580 | - Now when declaring an `RxList()`, it will be started empty. If you want to start a null RxList, you must use `RxList(null)`. |
678 | - Improved GetStream to receive the same parameters as the StreamController, such as `onListen`, `onPause`, `onResume` and `onCancel`. | 581 | +Improved GetStream to receive the same parameters as the StreamController, such as `onListen`, `onPause`, `onResume` and `onCancel`. |
679 | - Improve docs | 582 | - Improve docs |
680 | 583 | ||
681 | ## [3.16.1] | 584 | ## [3.16.1] |
682 | - | ||
683 | - Fix compilation error on master | 585 | - Fix compilation error on master |
684 | 586 | ||
685 | ## [3.16.0] | 587 | ## [3.16.0] |
686 | - | ||
687 | - Documentation translated into Russian language. (@Renat Fakhrutdinov, @Doaxan and @BatttA) | 588 | - Documentation translated into Russian language. (@Renat Fakhrutdinov, @Doaxan and @BatttA) |
688 | - Added error message callback for StateMixin (@eduardoflorence) | 589 | - Added error message callback for StateMixin (@eduardoflorence) |
689 | - Fix incorrect Get.reference when pop route (@4mb1t) | 590 | - Fix incorrect Get.reference when pop route (@4mb1t) |
690 | - Added Uppercase/Capital letter on GetUtils (@AleFachini) | 591 | - Added Uppercase/Capital letter on GetUtils (@AleFachini) |
691 | - Redraw the Streams api to use GetStream instead of StreamControllers. Why this change? | 592 | - Redraw the Streams api to use GetStream instead of StreamControllers. Why this change? |
692 | - Dart provides a Streams API that is really rich. However, asynchronous streams add extra latency to ensure that events are delivered in the exact order. | ||
693 | - It is not yet known whether this latency has any performance impact in mobile applications, and probably not, however, as GetX is also a server-side framework, we need to have the lowest latency at all, since our base is shared. | ||
694 | - Dart also has a Synchronous Streams api that has very low latency, however, it is not suitable for use in state management for two reasons: | ||
695 | - 1- Synchronous Streams can only have one listen (see the issue opened by Hixie on dart lang for reference: https://github.com/dart-lang/sdk/issues/22240). | ||
696 | - This means that we cannot use this api for more than one listener, which is the basis of global state management, where we aim to change the state of more than one location. You can test this with this simple snippet: | 593 | +Dart provides a Streams API that is really rich. However, asynchronous streams add extra latency to ensure that events are delivered in the exact order. |
594 | +It is not yet known whether this latency has any performance impact in mobile applications, and probably not, however, as GetX is also a server-side framework, we need to have the lowest latency at all, since our base is shared. | ||
595 | +Dart also has a Synchronous Streams api that has very low latency, however, it is not suitable for use in state management for two reasons: | ||
596 | +1- Synchronous Streams can only have one listen (see the issue opened by Hixie on dart lang for reference: https://github.com/dart-lang/sdk/issues/22240). | ||
597 | +This means that we cannot use this api for more than one listener, which is the basis of global state management, where we aim to change the state of more than one location. You can test this with this simple snippet: | ||
697 | 598 | ||
698 | ```dart | 599 | ```dart |
699 | void main() { | 600 | void main() { |
@@ -714,7 +615,6 @@ void main() { | @@ -714,7 +615,6 @@ void main() { | ||
714 | print("test8"); | 615 | print("test8"); |
715 | } | 616 | } |
716 | ``` | 617 | ``` |
717 | - | ||
718 | 2- Even with a single listener, the dart's Synchronous Streams api cannot deliver events in the exact order. We plan to work on a PR in the future at dart-lang to address this. So if we remove the line above that causes the exception, we will have the following output in the log: | 618 | 2- Even with a single listener, the dart's Synchronous Streams api cannot deliver events in the exact order. We plan to work on a PR in the future at dart-lang to address this. So if we remove the line above that causes the exception, we will have the following output in the log: |
719 | 619 | ||
720 | ```dart | 620 | ```dart |
@@ -745,11 +645,9 @@ test8 | @@ -745,11 +645,9 @@ test8 | ||
745 | test5 | 645 | test5 |
746 | 646 | ||
747 | ``` | 647 | ``` |
748 | - | ||
749 | As we can see, test 4 skips to test 6, which skips to test 8, which skips to test 5. Note that test 7 didn't even appear in the log. | 648 | As we can see, test 4 skips to test 6, which skips to test 8, which skips to test 5. Note that test 7 didn't even appear in the log. |
750 | 649 | ||
751 | However, if we work with GetStream, everything works as expected: | 650 | However, if we work with GetStream, everything works as expected: |
752 | - | ||
753 | ```dart | 651 | ```dart |
754 | void main() { | 652 | void main() { |
755 | var controller = GetStream(); | 653 | var controller = GetStream(); |
@@ -792,15 +690,15 @@ In short: asynchronous streams from dart work perfectly, but add a latency that | @@ -792,15 +690,15 @@ In short: asynchronous streams from dart work perfectly, but add a latency that | ||
792 | Synchronous dart streams have unexpected behaviors, cannot have more than 1 listener and do not deliver events in the correct order, which completely prevents their use in mobile state managements, since you run the risk of displaying data on the wrong screen, since the last event will not always be the last event entered by the sink. | 690 | Synchronous dart streams have unexpected behaviors, cannot have more than 1 listener and do not deliver events in the correct order, which completely prevents their use in mobile state managements, since you run the risk of displaying data on the wrong screen, since the last event will not always be the last event entered by the sink. |
793 | The 9000% figures are real, however, they refer to the gross performance between Streams and GetStreams. This does not mean that this number will impact your applications, because you are unlikely to use all of that power. | 691 | The 9000% figures are real, however, they refer to the gross performance between Streams and GetStreams. This does not mean that this number will impact your applications, because you are unlikely to use all of that power. |
794 | 692 | ||
795 | -## [3.15.0] - Big update | ||
796 | 693 | ||
694 | +## [3.15.0] - Big update | ||
797 | - **Improve Performance**: We made modifications to make GetBuilder even faster. We have improved the structure behind it so that listeners are notified faster. Perhaps in version 4.0 everything will be based on this new structure, but maintaining the power and compatibility with streams. If you want to know how much Getx is faster than pure streams or ChangeNotifier (even after the last update using LinkedList), you can create run the repository tests at: (https://github.com/jonataslaw/getx/blob/master/test/benchmarks/benckmark_test.dart) | 695 | - **Improve Performance**: We made modifications to make GetBuilder even faster. We have improved the structure behind it so that listeners are notified faster. Perhaps in version 4.0 everything will be based on this new structure, but maintaining the power and compatibility with streams. If you want to know how much Getx is faster than pure streams or ChangeNotifier (even after the last update using LinkedList), you can create run the repository tests at: (https://github.com/jonataslaw/getx/blob/master/test/benchmarks/benckmark_test.dart) |
798 | - **Added StateMixin** | 696 | - **Added StateMixin** |
799 | - StateMixin allows you to change the state of the controller, and display a loading, an error message, or a widget you want with 0 boilerplate. This makes things like API/Rest communication or websocket absurdly simple, and it's a real revolution in how state management has behaved so far. | ||
800 | - You no longer need to have a ternary in your code, and you don't need a widget like FutureBuilder, StreamBuilder or even Obx/GetBuilder to encompass your Visibility. This will change with the way you manage the state of your controllers, decrease your boilerplate absurdly, and give you more security in your code. | 697 | +StateMixin allows you to change the state of the controller, and display a loading, an error message, or a widget you want with 0 boilerplate. This makes things like API/Rest communication or websocket absurdly simple, and it's a real revolution in how state management has behaved so far. |
698 | +You no longer need to have a ternary in your code, and you don't need a widget like FutureBuilder, StreamBuilder or even Obx/GetBuilder to encompass your Visibility. This will change with the way you manage the state of your controllers, decrease your boilerplate absurdly, and give you more security in your code. | ||
801 | - **Added GetNotifier** | 699 | - **Added GetNotifier** |
802 | - GetNotifier is a super and powerful ValueNotifier, which in addition to having the life cycle of the controllers, is extremely fast, and can manage a single state, as a simplified immutable state management solution. | ||
803 | - In theory, the only difference between it and GetxController is the possibility of setting an initial value in the constructor's super (exactly as ValueNotifier does). If the initial value is null, use GetxController. If you need a starting value, GetNotifier can be more useful and have less boilerplate, but both serve the same purpose: to decouple your visualization layer from your presentation logic. | 700 | +GetNotifier is a super and powerful ValueNotifier, which in addition to having the life cycle of the controllers, is extremely fast, and can manage a single state, as a simplified immutable state management solution. |
701 | +In theory, the only difference between it and GetxController is the possibility of setting an initial value in the constructor's super (exactly as ValueNotifier does). If the initial value is null, use GetxController. If you need a starting value, GetNotifier can be more useful and have less boilerplate, but both serve the same purpose: to decouple your visualization layer from your presentation logic. | ||
804 | - Other Fixes and improvements: | 702 | - Other Fixes and improvements: |
805 | - Fixed GetxController is closed twice when smartManagement.full is turn on | 703 | - Fixed GetxController is closed twice when smartManagement.full is turn on |
806 | - Fixed phone number validation | 704 | - Fixed phone number validation |
@@ -812,18 +710,14 @@ The 9000% figures are real, however, they refer to the gross performance between | @@ -812,18 +710,14 @@ The 9000% figures are real, however, they refer to the gross performance between | ||
812 | - Fix named route erroring when route does not exist (@FiercestT) | 710 | - Fix named route erroring when route does not exist (@FiercestT) |
813 | 711 | ||
814 | ## [3.13.2] | 712 | ## [3.13.2] |
815 | - | ||
816 | - Reunification of the package. | 713 | - Reunification of the package. |
817 | - During the 2 week period, we try to keep this package as a compilation of smaller packages. We were successful in separating, getx is well decoupled and it was only necessary to send the internal folders as packages to pub.dev, however, it became very complicated to contribute to the package. This is because it was necessary to clone the repository, replace all pubspec packages with local paths, and after modification, return the original paths to do the PR. With that, the frequency of updates, which was about 4 to 5 days, became almost 2 weeks, and this is not legal for a community as active as Getx, which uses this package precisely in addition to being modern and performance, be constantly improving. This led contributors to the conclusion that getx works best together. | ||
818 | - Additional packages will continue to be maintained, and will have the same base as the main package, however, development will take place in the full and main package, and as the addition of new features or bug fixes arrives, we will migrate to the individual packages . Getx reached the mark of 50 contributors today, more than 1500 likes in the pub, and will continue to make development easy. | 714 | +During the 2 week period, we try to keep this package as a compilation of smaller packages. We were successful in separating, getx is well decoupled and it was only necessary to send the internal folders as packages to pub.dev, however, it became very complicated to contribute to the package. This is because it was necessary to clone the repository, replace all pubspec packages with local paths, and after modification, return the original paths to do the PR. With that, the frequency of updates, which was about 4 to 5 days, became almost 2 weeks, and this is not legal for a community as active as Getx, which uses this package precisely in addition to being modern and performance, be constantly improving. This led contributors to the conclusion that getx works best together. |
715 | +Additional packages will continue to be maintained, and will have the same base as the main package, however, development will take place in the full and main package, and as the addition of new features or bug fixes arrives, we will migrate to the individual packages . Getx reached the mark of 50 contributors today, more than 1500 likes in the pub, and will continue to make development easy. | ||
819 | 716 | ||
820 | ## [3.13.1] | 717 | ## [3.13.1] |
821 | - | ||
822 | - Remove spaces whitespaces from dart files | 718 | - Remove spaces whitespaces from dart files |
823 | - | 719 | - |
824 | - | ||
825 | ## [3.13.0] | 720 | ## [3.13.0] |
826 | - | ||
827 | - Fix typos on code and docs (@wbemanuel and @Goddchen) | 721 | - Fix typos on code and docs (@wbemanuel and @Goddchen) |
828 | - Improve: typedef to GetBuilder and Getx widgets | 722 | - Improve: typedef to GetBuilder and Getx widgets |
829 | - Improve behaviour of null route on lastest flutter version (@FiercestT) | 723 | - Improve behaviour of null route on lastest flutter version (@FiercestT) |
@@ -835,11 +729,9 @@ The 9000% figures are real, however, they refer to the gross performance between | @@ -835,11 +729,9 @@ The 9000% figures are real, however, they refer to the gross performance between | ||
835 | - Added Get.appUpdate and improve Get.forceAppUpdate | 729 | - Added Get.appUpdate and improve Get.forceAppUpdate |
836 | 730 | ||
837 | ## [3.12.1] | 731 | ## [3.12.1] |
838 | - | ||
839 | - Remove spaces whitespaces from dart files | 732 | - Remove spaces whitespaces from dart files |
840 | 733 | ||
841 | ## [3.12.0] | 734 | ## [3.12.0] |
842 | - | ||
843 | - Added BottomSheet Duration && Export SingleGetTickerProvider (@unacorbatanegra) | 735 | - Added BottomSheet Duration && Export SingleGetTickerProvider (@unacorbatanegra) |
844 | - Improve docs from dependencies management (@ngxingyu) | 736 | - Improve docs from dependencies management (@ngxingyu) |
845 | - Fix unknownRoute with null Custom Transition (@marcosfons) | 737 | - Fix unknownRoute with null Custom Transition (@marcosfons) |
@@ -852,11 +744,9 @@ The 9000% figures are real, however, they refer to the gross performance between | @@ -852,11 +744,9 @@ The 9000% figures are real, however, they refer to the gross performance between | ||
852 | - Added GetStatelessWidget, a StatelessWidget base to GetWidget with lifecycle control of controllers. Note: It's a base class, you don't need change to use it or change your GetView, GetWidget StatelessWidget to It. | 744 | - Added GetStatelessWidget, a StatelessWidget base to GetWidget with lifecycle control of controllers. Note: It's a base class, you don't need change to use it or change your GetView, GetWidget StatelessWidget to It. |
853 | 745 | ||
854 | ## [3.11.1] | 746 | ## [3.11.1] |
855 | - | ||
856 | - Fix docs | 747 | - Fix docs |
857 | 748 | ||
858 | ## [3.11.0] | 749 | ## [3.11.0] |
859 | - | ||
860 | - Refactor structure from scratch to split GetX completely into separate packages. When using the main package (get) you will have everything working perfectly together. However, if you only want one of the resources, you can use the packages separately. | 750 | - Refactor structure from scratch to split GetX completely into separate packages. When using the main package (get) you will have everything working perfectly together. However, if you only want one of the resources, you can use the packages separately. |
861 | - Improve Rx types | 751 | - Improve Rx types |
862 | - Added RTL support | 752 | - Added RTL support |
@@ -881,17 +771,13 @@ The 9000% figures are real, however, they refer to the gross performance between | @@ -881,17 +771,13 @@ The 9000% figures are real, however, they refer to the gross performance between | ||
881 | - Improve readme example (@dafinoer) | 771 | - Improve readme example (@dafinoer) |
882 | 772 | ||
883 | ## [3.10.2] | 773 | ## [3.10.2] |
884 | - | ||
885 | - Fixed the use of tags with lazyPut and added Ability to overwrite "tag" in GetView and GetWidget. | 774 | - Fixed the use of tags with lazyPut and added Ability to overwrite "tag" in GetView and GetWidget. |
886 | 775 | ||
887 | ## [3.10.1] | 776 | ## [3.10.1] |
888 | - | ||
889 | - Fix analyzer | 777 | - Fix analyzer |
890 | 778 | ||
891 | ## [3.10.0] | 779 | ## [3.10.0] |
892 | - | ||
893 | Getx 3.10 released with CLI and Get Server. | 780 | Getx 3.10 released with CLI and Get Server. |
894 | - | ||
895 | - Added: analyser + effective dart (@Grohden) | 781 | - Added: analyser + effective dart (@Grohden) |
896 | - Added TextStyle to generalDialog title and message (@roipeker) | 782 | - Added TextStyle to generalDialog title and message (@roipeker) |
897 | - renamed and added defaults transition duration and types in "GetInterface" (@roipeker) | 783 | - renamed and added defaults transition duration and types in "GetInterface" (@roipeker) |
@@ -902,7 +788,7 @@ Getx 3.10 released with CLI and Get Server. | @@ -902,7 +788,7 @@ Getx 3.10 released with CLI and Get Server. | ||
902 | - Added Curve property to routes (@roipeker) | 788 | - Added Curve property to routes (@roipeker) |
903 | - Improve docs, code cleanup, new GetStateUpdaterMixin and GetStateUpdate in favour of StateSetter on GetxController, GetBuilder, SimpleBuilder. (@roipeker) | 789 | - Improve docs, code cleanup, new GetStateUpdaterMixin and GetStateUpdate in favour of StateSetter on GetxController, GetBuilder, SimpleBuilder. (@roipeker) |
904 | - Added RxBool.toggle() as an easy shortcut for switching true/false values. (@roipeker) | 790 | - Added RxBool.toggle() as an easy shortcut for switching true/false values. (@roipeker) |
905 | -- Added \_RxImp.nil() to easily set the value to null (@roipeker) | 791 | +- Added _RxImp.nil() to easily set the value to null (@roipeker) |
906 | - Added missing docs to Rx classes. (@roipeker) | 792 | - Added missing docs to Rx classes. (@roipeker) |
907 | - Added Get.delete(force:false) to Get extensions (@roipeker) | 793 | - Added Get.delete(force:false) to Get extensions (@roipeker) |
908 | - Added Docs and comments (@nipodemos) | 794 | - Added Docs and comments (@nipodemos) |
@@ -914,10 +800,8 @@ Getx 3.10 released with CLI and Get Server. | @@ -914,10 +800,8 @@ Getx 3.10 released with CLI and Get Server. | ||
914 | - Improve code separation of RouteManagement and Internacionalization | 800 | - Improve code separation of RouteManagement and Internacionalization |
915 | 801 | ||
916 | ## [3.8.0] | 802 | ## [3.8.0] |
917 | - | ||
918 | - Added: Snackbar Status: Open, Opening, Closing and Closed | 803 | - Added: Snackbar Status: Open, Opening, Closing and Closed |
919 | - example: | ||
920 | - | 804 | +example: |
921 | ```dart | 805 | ```dart |
922 | Get.snackbar('title', 'message', snackbarStatus: (status) { | 806 | Get.snackbar('title', 'message', snackbarStatus: (status) { |
923 | if (status == SnackbarStatus.CLOSED) { | 807 | if (status == SnackbarStatus.CLOSED) { |
@@ -927,24 +811,23 @@ Getx 3.10 released with CLI and Get Server. | @@ -927,24 +811,23 @@ Getx 3.10 released with CLI and Get Server. | ||
927 | ``` | 811 | ``` |
928 | 812 | ||
929 | ## [3.7.0] | 813 | ## [3.7.0] |
930 | - | ||
931 | - Added: RxSet. Sets can now also be reactive. | 814 | - Added: RxSet. Sets can now also be reactive. |
932 | - Added isDesktop/isMobile (@roipeker) | 815 | - Added isDesktop/isMobile (@roipeker) |
933 | - Improve GetPlatform: It is now possible to know which device the user is using if GetPlatform.isWeb is true. | 816 | - Improve GetPlatform: It is now possible to know which device the user is using if GetPlatform.isWeb is true. |
934 | - context.responsiveValue used device orientation based on web and non-web applications. Now it checks if it is a desktop application (web or desktop application) to do the responsiveness calculation. (@roipeker) | 817 | +context.responsiveValue used device orientation based on web and non-web applications. Now it checks if it is a desktop application (web or desktop application) to do the responsiveness calculation. (@roipeker) |
935 | - Change: The documentation previously stated that Iterables should not access the ".value" property. | 818 | - Change: The documentation previously stated that Iterables should not access the ".value" property. |
936 | - However, many users did not pay attention to this fact, and ended up generating unnecessary issues and bugs in their application. | ||
937 | - In this version, we focus on code security. Now ".value" is protected, so it cannot be accessed externally by Lists, Maps or Sets. | 819 | +However, many users did not pay attention to this fact, and ended up generating unnecessary issues and bugs in their application. |
820 | +In this version, we focus on code security. Now ".value" is protected, so it cannot be accessed externally by Lists, Maps or Sets. | ||
938 | - Change: Observable lists are now Dart Lists. | 821 | - Change: Observable lists are now Dart Lists. |
939 | - There is no difference in your use: | ||
940 | - `RxList list = [].obs;` | ||
941 | - And you use | ||
942 | - `List list = [].obs;` | 822 | +There is no difference in your use: |
823 | +`RxList list = [].obs;` | ||
824 | +And you use | ||
825 | +`List list = [].obs;` | ||
943 | - Change: You do not need to access the ".value" property of primitives. | 826 | - Change: You do not need to access the ".value" property of primitives. |
944 | - For Strings you need interpolation. | ||
945 | - For num, int, double, you will have the normal operators, and use it as dart types. | ||
946 | - This way, `.value` can be used exclusively in ModelClasses. | ||
947 | - Example: | 827 | +For Strings you need interpolation. |
828 | +For num, int, double, you will have the normal operators, and use it as dart types. | ||
829 | +This way, `.value` can be used exclusively in ModelClasses. | ||
830 | +Example: | ||
948 | 831 | ||
949 | ```dart | 832 | ```dart |
950 | var name = "Jonny" .obs; | 833 | var name = "Jonny" .obs; |
@@ -964,15 +847,12 @@ The changes were not break changes, however, you may have missed the details of | @@ -964,15 +847,12 @@ The changes were not break changes, however, you may have missed the details of | ||
964 | The same goes for Maps and Sets. | 847 | The same goes for Maps and Sets. |
965 | 848 | ||
966 | ## [3.6.2] | 849 | ## [3.6.2] |
967 | - | ||
968 | - Fix more formatting issues | 850 | - Fix more formatting issues |
969 | 851 | ||
970 | ## [3.6.1] | 852 | ## [3.6.1] |
971 | - | ||
972 | - Fix formatting issues | 853 | - Fix formatting issues |
973 | 854 | ||
974 | ## [3.6.0] | 855 | ## [3.6.0] |
975 | - | ||
976 | - Added RxSet | 856 | - Added RxSet |
977 | - Change default logger to developer.log (@jorgegaticav) | 857 | - Change default logger to developer.log (@jorgegaticav) |
978 | - Added BindingsBuilder, ValueBuilder, and ObxValue (@roipeker) | 858 | - Added BindingsBuilder, ValueBuilder, and ObxValue (@roipeker) |
@@ -980,72 +860,58 @@ The same goes for Maps and Sets. | @@ -980,72 +860,58 @@ The same goes for Maps and Sets. | ||
980 | - Fix validation of email ".com.br" | 860 | - Fix validation of email ".com.br" |
981 | 861 | ||
982 | ## [3.5.1] | 862 | ## [3.5.1] |
983 | - | ||
984 | - Remove unnecessary whitespaces | 863 | - Remove unnecessary whitespaces |
985 | 864 | ||
986 | ## [3.5.0] | 865 | ## [3.5.0] |
987 | - | ||
988 | - Added logwritter (@stefandevo) | 866 | - Added logwritter (@stefandevo) |
989 | - Added responsiveValue (@juanjoseleca) | 867 | - Added responsiveValue (@juanjoseleca) |
990 | - Fixed ghost url for snackbar, bottomsheets, and dialogs and unnamed navigation. | 868 | - Fixed ghost url for snackbar, bottomsheets, and dialogs and unnamed navigation. |
991 | 869 | ||
992 | ## [3.4.6] | 870 | ## [3.4.6] |
993 | - | ||
994 | - Fix TextField dispose throw on last Flutter hotfix | 871 | - Fix TextField dispose throw on last Flutter hotfix |
995 | 872 | ||
996 | ## [3.4.5] | 873 | ## [3.4.5] |
997 | - | ||
998 | - Fix typo on RxList.remove that could cause type errors. | 874 | - Fix typo on RxList.remove that could cause type errors. |
999 | - Remove initialization console print | 875 | - Remove initialization console print |
1000 | 876 | ||
1001 | ## [3.4.4] | 877 | ## [3.4.4] |
1002 | - | ||
1003 | - Fix exception 'isInit called null' when tags are used in conjunction with dependencies. (@djade007) | 878 | - Fix exception 'isInit called null' when tags are used in conjunction with dependencies. (@djade007) |
1004 | - Fix typos (@tiagocpeixoto) | 879 | - Fix typos (@tiagocpeixoto) |
1005 | 880 | ||
1006 | ## [3.4.3] | 881 | ## [3.4.3] |
1007 | - | ||
1008 | - Fix onInit fired only first time | 882 | - Fix onInit fired only first time |
1009 | - Fix language callback(@lundin) | 883 | - Fix language callback(@lundin) |
1010 | - Fix docs (@nipodemos) | 884 | - Fix docs (@nipodemos) |
1011 | 885 | ||
1012 | ## [3.4.2] | 886 | ## [3.4.2] |
1013 | - | ||
1014 | - Fix individual imports | 887 | - Fix individual imports |
1015 | 888 | ||
1016 | ## [3.4.1] | 889 | ## [3.4.1] |
1017 | - | ||
1018 | - Structure organization, and improvements. | 890 | - Structure organization, and improvements. |
1019 | 891 | ||
1020 | ## [3.4.0] | 892 | ## [3.4.0] |
1021 | - | ||
1022 | - Added '[everAll]' Worker: Listen a List of '.obx' | 893 | - Added '[everAll]' Worker: Listen a List of '.obx' |
1023 | - Added Workers dispose | 894 | - Added Workers dispose |
1024 | - Fix transition.noTransition | 895 | - Fix transition.noTransition |
1025 | - Fix TextField and VideoPlayController dispose before transition animation | 896 | - Fix TextField and VideoPlayController dispose before transition animation |
1026 | 897 | ||
1027 | ## [3.3.0] | 898 | ## [3.3.0] |
1028 | - | ||
1029 | - Fix extensions (@stefandevo) | 899 | - Fix extensions (@stefandevo) |
1030 | - Added CPF to utils options (@kauemurakami) | 900 | - Added CPF to utils options (@kauemurakami) |
1031 | - Added fenix mode to Get.lazyPut. | 901 | - Added fenix mode to Get.lazyPut. |
1032 | - Use `Get.lazyPut<Controller>(()=> Controller(), fenix:true)` to have a controller that after being destroyed, has the ability to be recreated in case someone needs it. This is a function that already exists in smartManagement.keepFactory which is now also possible in full mode. | 902 | +Use `Get.lazyPut<Controller>(()=> Controller(), fenix:true)` to have a controller that after being destroyed, has the ability to be recreated in case someone needs it. This is a function that already exists in smartManagement.keepFactory which is now also possible in full mode. |
1033 | - Fix native transition on android | 903 | - Fix native transition on android |
1034 | 904 | ||
1035 | ## [3.2.2] | 905 | ## [3.2.2] |
1036 | - | ||
1037 | - Improve transitions and refactor route system | 906 | - Improve transitions and refactor route system |
1038 | 907 | ||
1039 | ## [3.2.1] | 908 | ## [3.2.1] |
1040 | - | ||
1041 | - Prevent black blackground on cupertino fullscreenDialog | 909 | - Prevent black blackground on cupertino fullscreenDialog |
1042 | 910 | ||
1043 | ## [3.2.0] | 911 | ## [3.2.0] |
1044 | - | ||
1045 | - Improve GetBuilder ram usage | 912 | - Improve GetBuilder ram usage |
1046 | - Added method update to Rx | 913 | - Added method update to Rx |
1047 | - Now you no longer need to make an entire class reactive to get an element update from it, you can simply call the update method of its instance, like this: | ||
1048 | - | 914 | +Now you no longer need to make an entire class reactive to get an element update from it, you can simply call the update method of its instance, like this: |
1049 | ```dart | 915 | ```dart |
1050 | class User{ | 916 | class User{ |
1051 | User(this.name = '', this.age = 0); | 917 | User(this.name = '', this.age = 0); |
@@ -1066,43 +932,34 @@ user.age = 18; | @@ -1066,43 +932,34 @@ user.age = 18; | ||
1066 | 932 | ||
1067 | Now is also possible to access a value without using the ".value". Just open and close parentheses. | 933 | Now is also possible to access a value without using the ".value". Just open and close parentheses. |
1068 | In the previous example, you could do: | 934 | In the previous example, you could do: |
1069 | - | ||
1070 | ```dart | 935 | ```dart |
1071 | user().name; // before: user.value.name | 936 | user().name; // before: user.value.name |
1072 | ``` | 937 | ``` |
1073 | - | ||
1074 | And it is also possible to set a value without using the value, inserting the value directly into the variable. | 938 | And it is also possible to set a value without using the value, inserting the value directly into the variable. |
1075 | - | ||
1076 | ```dart | 939 | ```dart |
1077 | user(User('João', 35)); // before: user.value = User('João', 35) | 940 | user(User('João', 35)); // before: user.value = User('João', 35) |
1078 | ``` | 941 | ``` |
1079 | - | ||
1080 | Added fenix mode to Get.lazyPut. | 942 | Added fenix mode to Get.lazyPut. |
1081 | 943 | ||
1082 | -## [3.1.4] | ||
1083 | 944 | ||
945 | +## [3.1.4] | ||
1084 | - Update readme banner | 946 | - Update readme banner |
1085 | 947 | ||
1086 | ## [3.1.3] | 948 | ## [3.1.3] |
1087 | - | ||
1088 | - Activate unknownRoute on version 3 | 949 | - Activate unknownRoute on version 3 |
1089 | - Go back transitions.size and transitions.cupertino | 950 | - Go back transitions.size and transitions.cupertino |
1090 | 951 | ||
1091 | ## [3.1.2] | 952 | ## [3.1.2] |
1092 | - | ||
1093 | - Expose GetInstance | 953 | - Expose GetInstance |
1094 | 954 | ||
1095 | ## [3.1.1] | 955 | ## [3.1.1] |
1096 | - | ||
1097 | - Improvement .obs methods | 956 | - Improvement .obs methods |
1098 | 957 | ||
1099 | ## [3.1.0] | 958 | ## [3.1.0] |
1100 | - | ||
1101 | - Added extensions to GetUtils and fix typo on GetUtils.isEmail (@stefandevo) | 959 | - Added extensions to GetUtils and fix typo on GetUtils.isEmail (@stefandevo) |
1102 | - Added .gitignore file (@hdeyana) | 960 | - Added .gitignore file (@hdeyana) |
1103 | 961 | ||
1104 | ## [3.0.1] | 962 | ## [3.0.1] |
1105 | - | ||
1106 | - Breaking changes on Rx api and GetController and RxController were merged, and now you only have the 'GetxController' | 963 | - Breaking changes on Rx api and GetController and RxController were merged, and now you only have the 'GetxController' |
1107 | - Refactor routing system. Now you can add custom transitions and more | 964 | - Refactor routing system. Now you can add custom transitions and more |
1108 | - Improved the use of dynamic routes, you can now define two different pages according to your arguments. | 965 | - Improved the use of dynamic routes, you can now define two different pages according to your arguments. |
@@ -1113,93 +970,77 @@ Added fenix mode to Get.lazyPut. | @@ -1113,93 +970,77 @@ Added fenix mode to Get.lazyPut. | ||
1113 | - Added GetStorage (with separated package) | 970 | - Added GetStorage (with separated package) |
1114 | - Minor bug fixes. | 971 | - Minor bug fixes. |
1115 | 972 | ||
1116 | -## [2.14.0] | ||
1117 | 973 | ||
974 | +## [2.14.0] | ||
1118 | - Added getPages API. | 975 | - Added getPages API. |
1119 | - Deprecated namedPages | 976 | - Deprecated namedPages |
1120 | - Fix default transition | 977 | - Fix default transition |
1121 | - Added Duration on Get.offAll(@kluverua) | 978 | - Added Duration on Get.offAll(@kluverua) |
1122 | 979 | ||
1123 | ## [2.13.1] | 980 | ## [2.13.1] |
1124 | - | ||
1125 | - Added sort to ListX | 981 | - Added sort to ListX |
1126 | - Prepared the framework for version 3 | 982 | - Prepared the framework for version 3 |
1127 | 983 | ||
1128 | ## [2.13.0] | 984 | ## [2.13.0] |
1129 | - | ||
1130 | - Added Get.focusScope | 985 | - Added Get.focusScope |
1131 | 986 | ||
1132 | ## [2.13.0] | 987 | ## [2.13.0] |
1133 | - | ||
1134 | - Update docs | 988 | - Update docs |
1135 | - Fix Bindings list on GetPageRoute | 989 | - Fix Bindings list on GetPageRoute |
1136 | 990 | ||
1137 | ## [2.12.5] | 991 | ## [2.12.5] |
1138 | - | ||
1139 | - Update readme | 992 | - Update readme |
1140 | 993 | ||
1141 | ## [2.12.4] | 994 | ## [2.12.4] |
1142 | - | ||
1143 | - Prevent exceptions on onReady with nullables | 995 | - Prevent exceptions on onReady with nullables |
1144 | 996 | ||
1145 | ## [2.12.3] | 997 | ## [2.12.3] |
1146 | - | ||
1147 | - Fix List lenght == null | 998 | - Fix List lenght == null |
1148 | 999 | ||
1149 | ## [2.12.2] | 1000 | ## [2.12.2] |
1150 | - | ||
1151 | - Fix Workers | 1001 | - Fix Workers |
1152 | 1002 | ||
1153 | ## [2.12.1] | 1003 | ## [2.12.1] |
1154 | - | ||
1155 | - Added: onReady on Controllers LifeCycle | 1004 | - Added: onReady on Controllers LifeCycle |
1156 | - Added: Observable maps | 1005 | - Added: Observable maps |
1157 | - Refactor: observable variables that now consume even less RAM. | 1006 | - Refactor: observable variables that now consume even less RAM. |
1158 | 1007 | ||
1159 | ## [2.11.3] | 1008 | ## [2.11.3] |
1160 | - | ||
1161 | - Type parameters and added docs | 1009 | - Type parameters and added docs |
1162 | 1010 | ||
1163 | ## [2.11.2] | 1011 | ## [2.11.2] |
1164 | - | ||
1165 | - Added docs | 1012 | - Added docs |
1166 | - Improvement performance of Obx | 1013 | - Improvement performance of Obx |
1167 | 1014 | ||
1168 | ## [2.11.1] | 1015 | ## [2.11.1] |
1169 | - | ||
1170 | - Fixed: oninit calling only once. | 1016 | - Fixed: oninit calling only once. |
1171 | 1017 | ||
1172 | ## [2.11.0] | 1018 | ## [2.11.0] |
1173 | - | ||
1174 | - Added Permissions: | 1019 | - Added Permissions: |
1175 | - You can now revoke permissions to SmartManagement so that it cannot delete a particular controller. | ||
1176 | - Add to Get.put (Controller(), permanent: true); to make it indelible. | ||
1177 | - Get.lazyPut() will not receive this resource. Initially he had it, but we saw in internal tests that it could cause problems with the bindings API. Bindings were created to initialize and delete an instance, if it were allowed to make a controller started with lazyPut permanent, copies of that Controller would be created every time Binding was called. For the safety of users, especially new users who could easily do this, it was decided that this feature will only be present in Get.put. | 1020 | +You can now revoke permissions to SmartManagement so that it cannot delete a particular controller. |
1021 | +Add to Get.put (Controller(), permanent: true); to make it indelible. | ||
1022 | +Get.lazyPut() will not receive this resource. Initially he had it, but we saw in internal tests that it could cause problems with the bindings API. Bindings were created to initialize and delete an instance, if it were allowed to make a controller started with lazyPut permanent, copies of that Controller would be created every time Binding was called. For the safety of users, especially new users who could easily do this, it was decided that this feature will only be present in Get.put. | ||
1178 | - Improve: Now a controller's life cycle has no connection with the View life cycle. It is no longer called internally in an "initState", it is now called when the Controller enters memory. This means that now onInit will always be called, regardless of where you started your dependency. | 1023 | - Improve: Now a controller's life cycle has no connection with the View life cycle. It is no longer called internally in an "initState", it is now called when the Controller enters memory. This means that now onInit will always be called, regardless of where you started your dependency. |
1179 | - removed: this property of the update() method has been permanently removed. | 1024 | - removed: this property of the update() method has been permanently removed. |
1180 | 1025 | ||
1181 | ## [2.10.3] | 1026 | ## [2.10.3] |
1182 | - | ||
1183 | - GetBuilder refactor. 11% reduction in RAM consumption and 2% in CPU consumption for the sample application. (using as base Flutter for linux desktop). | 1027 | - GetBuilder refactor. 11% reduction in RAM consumption and 2% in CPU consumption for the sample application. (using as base Flutter for linux desktop). |
1184 | 1028 | ||
1185 | - The "this" property of the "update" method has been deprecated and will be removed in the next update. Please don't use it anymore. Just use "update()" now. | 1029 | - The "this" property of the "update" method has been deprecated and will be removed in the next update. Please don't use it anymore. Just use "update()" now. |
1186 | 1030 | ||
1187 | ## [2.10.2] | 1031 | ## [2.10.2] |
1188 | - | ||
1189 | - Fix Get.generalDialog default options | 1032 | - Fix Get.generalDialog default options |
1190 | 1033 | ||
1191 | ## [2.10.1] | 1034 | ## [2.10.1] |
1192 | - | ||
1193 | - Fix broken links on pub | 1035 | - Fix broken links on pub |
1194 | - Fix List empty error | 1036 | - Fix List empty error |
1195 | 1037 | ||
1196 | ## [2.10.0] | 1038 | ## [2.10.0] |
1197 | - | ||
1198 | - Added SmartManagement, your application's memory is managed intelligently like never before! | 1039 | - Added SmartManagement, your application's memory is managed intelligently like never before! |
1199 | - Added Obx, a widget that knows when to rebuild a child, without needing any type. | 1040 | - Added Obx, a widget that knows when to rebuild a child, without needing any type. |
1200 | - Added MixinBuilder - If you need to use GetBuilder in conjunction with GetX, use GetxController with this widget, and the changes will occur either using update (this) or changing some reactive variable. Use only if necessary, for better RAM consumption, prefer widgets in that order: | 1041 | - Added MixinBuilder - If you need to use GetBuilder in conjunction with GetX, use GetxController with this widget, and the changes will occur either using update (this) or changing some reactive variable. Use only if necessary, for better RAM consumption, prefer widgets in that order: |
1201 | - Obx => GetX => GetBuilder => MixinBuilder. | ||
1202 | - Obx is the lightest of all, and MixinBuilder is a mix of the other 3, whenever possible, use the specific widget. | 1042 | +Obx => GetX => GetBuilder => MixinBuilder. |
1043 | +Obx is the lightest of all, and MixinBuilder is a mix of the other 3, whenever possible, use the specific widget. | ||
1203 | - Refactor: StateManager of Get. | 1044 | - Refactor: StateManager of Get. |
1204 | - Changed: full List API refactor, now value is no longer needed. | 1045 | - Changed: full List API refactor, now value is no longer needed. |
1205 | - Added Workers: You can hear changes to a variable and trigger custom callbacks. | 1046 | - Added Workers: You can hear changes to a variable and trigger custom callbacks. |
@@ -1207,140 +1048,111 @@ Added fenix mode to Get.lazyPut. | @@ -1207,140 +1048,111 @@ Added fenix mode to Get.lazyPut. | ||
1207 | - Added Portuguese language to readme(@Nipodemos) | 1048 | - Added Portuguese language to readme(@Nipodemos) |
1208 | 1049 | ||
1209 | # [2.7.1] | 1050 | # [2.7.1] |
1210 | - | ||
1211 | - Improve list to set and get methods | 1051 | - Improve list to set and get methods |
1212 | 1052 | ||
1213 | ## [2.7.0] | 1053 | ## [2.7.0] |
1214 | - | ||
1215 | - Added obx, a simple state interceptor. | 1054 | - Added obx, a simple state interceptor. |
1216 | - Improve Bindings, ListX, and | 1055 | - Improve Bindings, ListX, and |
1217 | - fix docs typos e broken code (@ghprod) | 1056 | - fix docs typos e broken code (@ghprod) |
1218 | 1057 | ||
1219 | -## [2.6.3] | ||
1220 | 1058 | ||
1059 | +## [2.6.3] | ||
1221 | - Flutter currently has a problem on some devices where using showModalBottomSheet() can cause TextFields to be hidden behind the keyboard (https://github.com/flutter/flutter/issues/18564) this issue is closed, even users reporting that the problem still occurs. | 1060 | - Flutter currently has a problem on some devices where using showModalBottomSheet() can cause TextFields to be hidden behind the keyboard (https://github.com/flutter/flutter/issues/18564) this issue is closed, even users reporting that the problem still occurs. |
1222 | - The problem happens casually, as well as the problem of the snackbar on the iPhone SE 2, and checking the code, I realized that a padding with MediaQuery.of(context).viewInsets.bottom is missing inside the bottomSheet to make it work correctly, since it does not have any constraint with the keyboard. | ||
1223 | - For stability, I decided not to use the standard Flutter bottomSheet, which contains many bugs, mainly related to keyboard padding, and the lack of respect for topBar's safeArea, and to use a proprietary bottomSheet implementation that is more stable. The Flutter dialog has no problem, so it will be used as the basis for Get.dialog. The bottomSheet will be based on the Flutter bottomSheet Raw API (\_ModalBottomSheetRoute), applying bug fixes. | 1061 | +The problem happens casually, as well as the problem of the snackbar on the iPhone SE 2, and checking the code, I realized that a padding with MediaQuery.of(context).viewInsets.bottom is missing inside the bottomSheet to make it work correctly, since it does not have any constraint with the keyboard. |
1062 | +For stability, I decided not to use the standard Flutter bottomSheet, which contains many bugs, mainly related to keyboard padding, and the lack of respect for topBar's safeArea, and to use a proprietary bottomSheet implementation that is more stable. The Flutter dialog has no problem, so it will be used as the basis for Get.dialog. The bottomSheet will be based on the Flutter bottomSheet Raw API (_ModalBottomSheetRoute), applying bug fixes. | ||
1224 | - Added Get.isSnackbarOpen tests | 1063 | - Added Get.isSnackbarOpen tests |
1225 | 1064 | ||
1226 | ## [2.6.2] | 1065 | ## [2.6.2] |
1227 | - | ||
1228 | - Refactor Bindings API | 1066 | - Refactor Bindings API |
1229 | 1067 | ||
1230 | ## [2.6.1] | 1068 | ## [2.6.1] |
1231 | - | ||
1232 | - Expose Bindings API | 1069 | - Expose Bindings API |
1233 | 1070 | ||
1234 | ## [2.6.0] | 1071 | ## [2.6.0] |
1235 | - | ||
1236 | - Added bindings. | 1072 | - Added bindings. |
1237 | - 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. | 1073 | +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. |
1238 | 1074 | ||
1239 | ## [2.5.10] | 1075 | ## [2.5.10] |
1240 | - | ||
1241 | - Removed remnants of previousArgs on routeObserver. | 1076 | - Removed remnants of previousArgs on routeObserver. |
1242 | - 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. | 1077 | +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. |
1243 | 1078 | ||
1244 | ## [2.5.9] | 1079 | ## [2.5.9] |
1245 | - | ||
1246 | - Fix Get.find with named instance | 1080 | - Fix Get.find with named instance |
1247 | 1081 | ||
1248 | ## [2.5.8] | 1082 | ## [2.5.8] |
1249 | - | ||
1250 | - Added docs | 1083 | - Added docs |
1251 | - Added tests(@chimon2000) | 1084 | - Added tests(@chimon2000) |
1252 | 1085 | ||
1253 | ## [2.5.7] | 1086 | ## [2.5.7] |
1254 | - | ||
1255 | - Fix Get.generalDialog optionals | 1087 | - Fix Get.generalDialog optionals |
1256 | - Added GetX onInit support | 1088 | - Added GetX onInit support |
1257 | 1089 | ||
1258 | ## [2.5.6] | 1090 | ## [2.5.6] |
1259 | - | ||
1260 | - GetBuilder refactor to work with lazyPut. | 1091 | - GetBuilder refactor to work with lazyPut. |
1261 | - Now you can list your controllers in advance with Get.lazyPut, and only when it is called for the first time will it be relocated in memory. | 1092 | +Now you can list your controllers in advance with Get.lazyPut, and only when it is called for the first time will it be relocated in memory. |
1262 | - Fix english typos(@gumbarros) | 1093 | - Fix english typos(@gumbarros) |
1263 | 1094 | ||
1264 | ## [2.5.5] | 1095 | ## [2.5.5] |
1265 | - | ||
1266 | - Fix arguments broken by new methods | 1096 | - Fix arguments broken by new methods |
1267 | 1097 | ||
1268 | ## [2.5.4] | 1098 | ## [2.5.4] |
1269 | - | ||
1270 | - Refactor methods | 1099 | - Refactor methods |
1271 | 1100 | ||
1272 | ## [2.5.3] | 1101 | ## [2.5.3] |
1273 | - | ||
1274 | - Fix snackbar padding on iPhone SE 2. | 1102 | - Fix snackbar padding on iPhone SE 2. |
1275 | - Added themes docs | 1103 | - Added themes docs |
1276 | - Added ThemeMode (@RodBr) | 1104 | - Added ThemeMode (@RodBr) |
1277 | 1105 | ||
1278 | ## [2.5.2] | 1106 | ## [2.5.2] |
1279 | - | ||
1280 | - Fix: key not found when Get.key is used with no MaterialApp | 1107 | - Fix: key not found when Get.key is used with no MaterialApp |
1281 | 1108 | ||
1282 | ## [2.5.1] | 1109 | ## [2.5.1] |
1283 | - | ||
1284 | - Improve - GetBuilder uses 18% less ram on more of 20 controllers. | 1110 | - Improve - GetBuilder uses 18% less ram on more of 20 controllers. |
1285 | 1111 | ||
1286 | ## [2.5.0] | 1112 | ## [2.5.0] |
1287 | - | ||
1288 | - Added List.obs | 1113 | - Added List.obs |
1289 | - Now you can transform any class on obs | 1114 | - Now you can transform any class on obs |
1290 | 1115 | ||
1291 | ## [2.4.0] | 1116 | ## [2.4.0] |
1292 | - | ||
1293 | - Added GetX, state manager rxDart based. | 1117 | - Added GetX, state manager rxDart based. |
1294 | - Fix error on add for non global controllers | 1118 | - Fix error on add for non global controllers |
1295 | 1119 | ||
1296 | ## [2.3.2] | 1120 | ## [2.3.2] |
1297 | - | ||
1298 | - Fix close method called on not root GetBuilder | 1121 | - Fix close method called on not root GetBuilder |
1299 | 1122 | ||
1300 | ## [2.3.1] | 1123 | ## [2.3.1] |
1301 | - | ||
1302 | - Auto close stream inside close method | 1124 | - Auto close stream inside close method |
1303 | - Added docs | 1125 | - Added docs |
1304 | 1126 | ||
1305 | ## [2.3.0] | 1127 | ## [2.3.0] |
1306 | - | ||
1307 | - Added interface to GetX support | 1128 | - Added interface to GetX support |
1308 | 1129 | ||
1309 | ## [2.2.8] | 1130 | ## [2.2.8] |
1310 | - | ||
1311 | - Added api to platform brightness | 1131 | - Added api to platform brightness |
1312 | 1132 | ||
1313 | ## [2.2.7] | 1133 | ## [2.2.7] |
1314 | - | ||
1315 | - Fix typos | 1134 | - Fix typos |
1316 | 1135 | ||
1317 | ## [2.2.6] | 1136 | ## [2.2.6] |
1318 | - | ||
1319 | - Fix cancel button on defaultDialog don't appear when widget implementation usage | 1137 | - Fix cancel button on defaultDialog don't appear when widget implementation usage |
1320 | 1138 | ||
1321 | ## [2.2.5] | 1139 | ## [2.2.5] |
1322 | - | ||
1323 | - Refator defaultDialog | 1140 | - Refator defaultDialog |
1324 | 1141 | ||
1325 | ## [2.2.4] | 1142 | ## [2.2.4] |
1326 | - | ||
1327 | - Clean code | 1143 | - Clean code |
1328 | - Fix Get.LazyPut | 1144 | - Fix Get.LazyPut |
1329 | 1145 | ||
1330 | ## [2.2.3] | 1146 | ## [2.2.3] |
1331 | - | ||
1332 | - Remove defaultDialog type | 1147 | - Remove defaultDialog type |
1333 | 1148 | ||
1334 | ## [2.2.2] | 1149 | ## [2.2.2] |
1335 | - | ||
1336 | - Fix GetRoute not found | 1150 | - Fix GetRoute not found |
1337 | 1151 | ||
1338 | ## [2.2.1] | 1152 | ## [2.2.1] |
1339 | - | ||
1340 | - Improve lazyPut and fix tag to lazyput(@rochadaniel) | 1153 | - Improve lazyPut and fix tag to lazyput(@rochadaniel) |
1341 | 1154 | ||
1342 | ## [2.2.0] | 1155 | ## [2.2.0] |
1343 | - | ||
1344 | - Added: Ability to choose or delay a widget's state change according to its ID. | 1156 | - Added: Ability to choose or delay a widget's state change according to its ID. |
1345 | - Added: Ability to fire triggers when loading materialApp. | 1157 | - Added: Ability to fire triggers when loading materialApp. |
1346 | - Added: Ability to change theme dynamically. | 1158 | - Added: Ability to change theme dynamically. |
@@ -1351,15 +1163,12 @@ Added fenix mode to Get.lazyPut. | @@ -1351,15 +1163,12 @@ Added fenix mode to Get.lazyPut. | ||
1351 | - Added: Capability of define abstract class on dependencies. | 1163 | - Added: Capability of define abstract class on dependencies. |
1352 | 1164 | ||
1353 | ## [2.1.2] | 1165 | ## [2.1.2] |
1354 | - | ||
1355 | - Get.defaultDialog refactor | 1166 | - Get.defaultDialog refactor |
1356 | 1167 | ||
1357 | ## [2.1.1] | 1168 | ## [2.1.1] |
1358 | - | ||
1359 | - fix typo | 1169 | - fix typo |
1360 | 1170 | ||
1361 | ## [2.1.0] | 1171 | ## [2.1.0] |
1362 | - | ||
1363 | - Added Get.rawSnackbar | 1172 | - Added Get.rawSnackbar |
1364 | - Added instantInit config to snackbars | 1173 | - Added instantInit config to snackbars |
1365 | - Refactor Get Instance Manager | 1174 | - Refactor Get Instance Manager |
@@ -1368,36 +1177,28 @@ Added fenix mode to Get.lazyPut. | @@ -1368,36 +1177,28 @@ Added fenix mode to Get.lazyPut. | ||
1368 | - Hotfix on namedRoutes | 1177 | - Hotfix on namedRoutes |
1369 | 1178 | ||
1370 | ## [2.0.10] | 1179 | ## [2.0.10] |
1371 | - | ||
1372 | - Bump new Flutter version | 1180 | - Bump new Flutter version |
1373 | - Added Get.generalDialog | 1181 | - Added Get.generalDialog |
1374 | 1182 | ||
1375 | ## [2.0.6] | 1183 | ## [2.0.6] |
1376 | - | ||
1377 | - Fix typo on readme | 1184 | - Fix typo on readme |
1378 | 1185 | ||
1379 | ## [2.0.5] | 1186 | ## [2.0.5] |
1380 | - | ||
1381 | - Changing the bottomsheet API to comply with the documentation. | 1187 | - Changing the bottomsheet API to comply with the documentation. |
1382 | 1188 | ||
1383 | ## [2.0.4] | 1189 | ## [2.0.4] |
1384 | - | ||
1385 | - Fix type not found in some versions of Flutter stable | 1190 | - Fix type not found in some versions of Flutter stable |
1386 | 1191 | ||
1387 | ## [2.0.3] | 1192 | ## [2.0.3] |
1388 | - | ||
1389 | - Update Docs | 1193 | - Update Docs |
1390 | 1194 | ||
1391 | ## [2.0.2] | 1195 | ## [2.0.2] |
1392 | - | ||
1393 | - Update GetObserver | 1196 | - Update GetObserver |
1394 | 1197 | ||
1395 | ## [2.0.1] | 1198 | ## [2.0.1] |
1396 | - | ||
1397 | - Fix docs and typos | 1199 | - Fix docs and typos |
1398 | 1200 | ||
1399 | ## [2.0.0] | 1201 | ## [2.0.0] |
1400 | - | ||
1401 | - Added easy state manager | 1202 | - Added easy state manager |
1402 | - Change dialog API | 1203 | - Change dialog API |
1403 | - Added GetMaterialApp | 1204 | - Added GetMaterialApp |
@@ -1415,37 +1216,30 @@ Added fenix mode to Get.lazyPut. | @@ -1415,37 +1216,30 @@ Added fenix mode to Get.lazyPut. | ||
1415 | - Many others minor APIs added | 1216 | - Many others minor APIs added |
1416 | 1217 | ||
1417 | ## [1.20.1] | 1218 | ## [1.20.1] |
1418 | - | ||
1419 | - Improve: Get.finds | 1219 | - Improve: Get.finds |
1420 | 1220 | ||
1421 | ## [1.20.0] | 1221 | ## [1.20.0] |
1422 | - | ||
1423 | - Added Get Instance Manager | 1222 | - Added Get Instance Manager |
1424 | Get.put / Get.find / Get.delete | 1223 | Get.put / Get.find / Get.delete |
1425 | 1224 | ||
1426 | ## [1.19.1] | 1225 | ## [1.19.1] |
1427 | - | ||
1428 | - Fix default transitions for namedRoutes | 1226 | - Fix default transitions for namedRoutes |
1429 | 1227 | ||
1430 | ## [1.19.0] | 1228 | ## [1.19.0] |
1431 | - | ||
1432 | - Added nested navigators | 1229 | - Added nested navigators |
1433 | 1230 | ||
1434 | ## [1.18.0] | 1231 | ## [1.18.0] |
1435 | - | ||
1436 | - Added SafeArea to bottomsheets | 1232 | - Added SafeArea to bottomsheets |
1437 | - Added docs | 1233 | - Added docs |
1438 | 1234 | ||
1439 | ## [1.17.0] | 1235 | ## [1.17.0] |
1440 | - | ||
1441 | - Added experimental APIs | 1236 | - Added experimental APIs |
1442 | 1237 | ||
1443 | -## [1.16.1] | ||
1444 | 1238 | ||
1239 | +## [1.16.1] | ||
1445 | - Improve: GetObserver | 1240 | - Improve: GetObserver |
1446 | 1241 | ||
1447 | ## [1.16.0-dev] | 1242 | ## [1.16.0-dev] |
1448 | - | ||
1449 | - Added Get config | 1243 | - Added Get config |
1450 | - Added logEnable | 1244 | - Added logEnable |
1451 | - Added Default transition | 1245 | - Added Default transition |
@@ -1454,153 +1248,129 @@ Added fenix mode to Get.lazyPut. | @@ -1454,153 +1248,129 @@ Added fenix mode to Get.lazyPut. | ||
1454 | - Fix Duration transition | 1248 | - Fix Duration transition |
1455 | 1249 | ||
1456 | ## [1.14.1-dev] | 1250 | ## [1.14.1-dev] |
1457 | - | ||
1458 | - Fix ternary on new dart version | 1251 | - Fix ternary on new dart version |
1459 | 1252 | ||
1460 | ## [1.14.0-dev] | 1253 | ## [1.14.0-dev] |
1461 | - | ||
1462 | - Added compatibility with Flutter 1.17.1 | 1254 | - Added compatibility with Flutter 1.17.1 |
1463 | - Added back popGesture to iOS (default) and Android (optional) | 1255 | - Added back popGesture to iOS (default) and Android (optional) |
1464 | - Improve performance | 1256 | - Improve performance |
1465 | - Decrease lib size to 94.9kb (25.4k after compiled on release) | 1257 | - Decrease lib size to 94.9kb (25.4k after compiled on release) |
1466 | 1258 | ||
1467 | ## [1.13.1-dev] | 1259 | ## [1.13.1-dev] |
1468 | - | ||
1469 | - Fix back function | 1260 | - Fix back function |
1470 | 1261 | ||
1471 | ## [1.13.0-dev] | 1262 | ## [1.13.0-dev] |
1472 | - | ||
1473 | - Plugin refactor | 1263 | - Plugin refactor |
1474 | - Added GetPlatform | 1264 | - Added GetPlatform |
1475 | 1265 | ||
1476 | ## [1.12.0-dev] | 1266 | ## [1.12.0-dev] |
1477 | - | ||
1478 | -Compatibility with Dev branch | 1267 | -Compatibility with Dev branch |
1479 | 1268 | ||
1480 | ## [1.11.4] | 1269 | ## [1.11.4] |
1481 | - | ||
1482 | - Refactor code of library | 1270 | - Refactor code of library |
1483 | 1271 | ||
1484 | ## [1.11.3] | 1272 | ## [1.11.3] |
1485 | - | ||
1486 | -Added docs | 1273 | -Added docs |
1487 | 1274 | ||
1488 | -## [1.11.2] | ||
1489 | 1275 | ||
1490 | --Fix flutter web platform and added GetPlatform | 1276 | +## [1.11.2] |
1277 | + -Fix flutter web platform and added GetPlatform | ||
1491 | 1278 | ||
1492 | ## [1.11.1] | 1279 | ## [1.11.1] |
1280 | + -Improve swipe to back on iOS devices | ||
1493 | 1281 | ||
1494 | --Improve swipe to back on iOS devices | ||
1495 | - | ||
1496 | -## [1.11.0] | ||
1497 | - | ||
1498 | --Added experimental GetCupertino | 1282 | + ## [1.11.0] |
1283 | + -Added experimental GetCupertino | ||
1499 | 1284 | ||
1500 | ## [1.10.5] | 1285 | ## [1.10.5] |
1501 | - | ||
1502 | --Added setKey to improve modular compatibility | ||
1503 | --Added ability to define transition duration directly when calling the new route. | 1286 | + -Added setKey to improve modular compatibility |
1287 | + -Added ability to define transition duration directly when calling the new route. | ||
1504 | 1288 | ||
1505 | ## [1.10.4] | 1289 | ## [1.10.4] |
1506 | - | ||
1507 | --Improve Get.offAll() - predicate now is optional | 1290 | + -Improve Get.offAll() - predicate now is optional |
1508 | 1291 | ||
1509 | ## [1.10.3] | 1292 | ## [1.10.3] |
1293 | + -Improve default color from dialogs | ||
1510 | 1294 | ||
1511 | --Improve default color from dialogs | 1295 | + ## [1.10.2] |
1296 | + -Improve snackbar text color | ||
1297 | + -Added background color to snackbar (@claudneysessa) | ||
1512 | 1298 | ||
1513 | -## [1.10.2] | ||
1514 | - | ||
1515 | --Improve snackbar text color | ||
1516 | --Added background color to snackbar (@claudneysessa) | ||
1517 | - | ||
1518 | -## [1.10.1] | ||
1519 | - | ||
1520 | --Backdrop improvement | 1299 | + ## [1.10.1] |
1300 | + -Backdrop improvement | ||
1521 | 1301 | ||
1522 | ## [1.10.0] | 1302 | ## [1.10.0] |
1523 | - | ||
1524 | --Added backdrop | 1303 | + -Added backdrop |
1525 | 1304 | ||
1526 | ## [1.9.2] | 1305 | ## [1.9.2] |
1306 | + -Added docs to GetObserver | ||
1527 | 1307 | ||
1528 | --Added docs to GetObserver | ||
1529 | - | ||
1530 | -## [1.9.1] | ||
1531 | - | ||
1532 | --Fix typo on snackbar route | 1308 | + ## [1.9.1] |
1309 | + -Fix typo on snackbar route | ||
1533 | 1310 | ||
1534 | ## [1.9.0] | 1311 | ## [1.9.0] |
1535 | - | ||
1536 | --Added: Navigator observer | ||
1537 | --Added: Get.args to named routes | ||
1538 | --Improve snackbar performance | 1312 | + -Added: Navigator observer |
1313 | + -Added: Get.args to named routes | ||
1314 | + -Improve snackbar performance | ||
1539 | 1315 | ||
1540 | ## [1.8.1] | 1316 | ## [1.8.1] |
1541 | - | ||
1542 | --Fix new snackbar features | 1317 | + -Fix new snackbar features |
1543 | 1318 | ||
1544 | ## [1.8.0] | 1319 | ## [1.8.0] |
1545 | - | ||
1546 | --Add Get.close method. | ||
1547 | --Add many Snackbars features | 1320 | + -Add Get.close method. |
1321 | + -Add many Snackbars features | ||
1548 | 1322 | ||
1549 | ## [1.7.4] | 1323 | ## [1.7.4] |
1550 | - | ||
1551 | --Fix dialog child error | 1324 | + -Fix dialog child error |
1552 | 1325 | ||
1553 | ## [1.7.3] | 1326 | ## [1.7.3] |
1554 | - | ||
1555 | --Added transitions docs | 1327 | + -Added transitions docs |
1556 | 1328 | ||
1557 | ## [1.7.2] | 1329 | ## [1.7.2] |
1558 | - | ||
1559 | --Fix bottomsheet on macos | 1330 | + -Fix bottomsheet on macos |
1560 | 1331 | ||
1561 | ## [1.7.1] | 1332 | ## [1.7.1] |
1562 | - | ||
1563 | --Fix docs | 1333 | + -Fix docs |
1564 | 1334 | ||
1565 | ## [1.7.0] | 1335 | ## [1.7.0] |
1566 | 1336 | ||
1567 | -- Improve geral performance. Get.to Wrap now consumes even less RAM and CPU. In an application with 20 screens, it obtained 82% less RAM usage compared to the traditional method Navigator.push and had a CPU normalization of 23% in a Moto z2, against 64% CPU usage in Navigator.push with MaterialPageRoute. Test it for yourself! | ||
1568 | -- Added BottomSheet with no context | ||
1569 | -- Added modern Blur Snackbar | ||
1570 | -- Added customs transitions | ||
1571 | -- Improve dialogs performance | 1337 | + - Improve geral performance. Get.to Wrap now consumes even less RAM and CPU. In an application with 20 screens, it obtained 82% less RAM usage compared to the traditional method Navigator.push and had a CPU normalization of 23% in a Moto z2, against 64% CPU usage in Navigator.push with MaterialPageRoute. Test it for yourself! |
1338 | + - Added BottomSheet with no context | ||
1339 | + - Added modern Blur Snackbar | ||
1340 | + - Added customs transitions | ||
1341 | + - Improve dialogs performance | ||
1572 | 1342 | ||
1573 | ## [1.6.4] | 1343 | ## [1.6.4] |
1574 | 1344 | ||
1575 | -- Improve performance. | 1345 | + - Improve performance. |
1576 | 1346 | ||
1577 | ## [1.6.3] | 1347 | ## [1.6.3] |
1578 | 1348 | ||
1579 | -- Clean code. | 1349 | + - Clean code. |
1580 | 1350 | ||
1581 | ## [1.6.2] | 1351 | ## [1.6.2] |
1582 | 1352 | ||
1583 | -- Fix bugs on blurred Snackbars | 1353 | + - Fix bugs on blurred Snackbars |
1584 | 1354 | ||
1585 | ## [1.6.1] | 1355 | ## [1.6.1] |
1586 | 1356 | ||
1587 | -- Add docs and improve performance | 1357 | + - Add docs and improve performance |
1588 | 1358 | ||
1589 | ## [1.6.0] | 1359 | ## [1.6.0] |
1590 | 1360 | ||
1591 | -- Add support to snackbars | 1361 | + - Add support to snackbars |
1592 | 1362 | ||
1593 | ## [1.5.0+1] | 1363 | ## [1.5.0+1] |
1594 | 1364 | ||
1595 | -- Add color and opacity to dialogs | 1365 | + - Add color and opacity to dialogs |
1596 | 1366 | ||
1597 | ## [1.5.0] | 1367 | ## [1.5.0] |
1598 | 1368 | ||
1599 | -- Add support to dialogs | 1369 | + - Add support to dialogs |
1600 | 1370 | ||
1601 | ## [1.4.0+7] | 1371 | ## [1.4.0+7] |
1602 | 1372 | ||
1603 | -- Add more documentation | 1373 | + - Add more documentation |
1604 | 1374 | ||
1605 | ## [1.4.0+6] | 1375 | ## [1.4.0+6] |
1606 | 1376 | ||
@@ -1637,6 +1407,7 @@ Added fenix mode to Get.lazyPut. | @@ -1637,6 +1407,7 @@ Added fenix mode to Get.lazyPut. | ||
1637 | 1407 | ||
1638 | - Fix bug currentState = null | 1408 | - Fix bug currentState = null |
1639 | 1409 | ||
1410 | + | ||
1640 | ## [1.2.0] | 1411 | ## [1.2.0] |
1641 | 1412 | ||
1642 | - Add routes navigation with no context | 1413 | - Add routes navigation with no context |
@@ -543,6 +543,7 @@ class HomeProvider extends GetConnect { | @@ -543,6 +543,7 @@ class HomeProvider extends GetConnect { | ||
543 | //HttpStatus.unauthorized | 543 | //HttpStatus.unauthorized |
544 | httpClient.maxAuthRetries = 3; | 544 | httpClient.maxAuthRetries = 3; |
545 | } | 545 | } |
546 | + } | ||
546 | 547 | ||
547 | @override | 548 | @override |
548 | Future<Response<CasesModel>> getCases(String path) => get(path); | 549 | Future<Response<CasesModel>> getCases(String path) => get(path); |
@@ -498,6 +498,7 @@ class HomeProvider extends GetConnect { | @@ -498,6 +498,7 @@ class HomeProvider extends GetConnect { | ||
498 | //HttpStatus.unauthorized | 498 | //HttpStatus.unauthorized |
499 | httpClient.maxAuthRetries = 3; | 499 | httpClient.maxAuthRetries = 3; |
500 | } | 500 | } |
501 | + } | ||
501 | 502 | ||
502 | @override | 503 | @override |
503 | Future<Response<CasesModel>> getCases(String path) => get(path); | 504 | Future<Response<CasesModel>> getCases(String path) => get(path); |
@@ -98,7 +98,7 @@ | @@ -98,7 +98,7 @@ | ||
98 | 98 | ||
99 | - **조직화:** GetX는 화면, 프레젠테이션 로직, 비즈니스 로직, 종속성 주입 및 네비게이션을 완전히 분리 할 수 있습니다. 라우트간 전환을 하는데에 컨텍스트가 필요하지 않아 위젯 트리(시각객체)에 독립적입니다. inheritedWidget을 통해 컨트롤러/블록에 접근하는 데 컨텍스트가 필요하지 않아 시각화 계층에서 프레젠테이션 로직과 비즈니스 로직을 완전히 분리됩니다. 이 GetX는 자체 종속성 주입 기능을 사용하여 DI를 뷰에서 완전히 분리하기 때문에 다중 Provider를 통해 위젯 트리에서 컨트롤러/모델/블록으로 주입 할 필요가 없습니다. | 99 | - **조직화:** GetX는 화면, 프레젠테이션 로직, 비즈니스 로직, 종속성 주입 및 네비게이션을 완전히 분리 할 수 있습니다. 라우트간 전환을 하는데에 컨텍스트가 필요하지 않아 위젯 트리(시각객체)에 독립적입니다. inheritedWidget을 통해 컨트롤러/블록에 접근하는 데 컨텍스트가 필요하지 않아 시각화 계층에서 프레젠테이션 로직과 비즈니스 로직을 완전히 분리됩니다. 이 GetX는 자체 종속성 주입 기능을 사용하여 DI를 뷰에서 완전히 분리하기 때문에 다중 Provider를 통해 위젯 트리에서 컨트롤러/모델/블록으로 주입 할 필요가 없습니다. |
100 | 100 | ||
101 | - GetX를 사용하면 기본적으로 클린 코드를 가지게 되어 애플리케이션의 각 기능을 쉽게 찾을 수 있습니다. 이것은 유지 보수를 용이하게 하며 모듈의 공유가 가능하고 Flutter에서는 생각할 수 없었던 것들도 전부 가능합니다. | 101 | + GetX를 사용하면 기본적으로 클린 코드를 가지게 되어 애플리케이션의 각 기능을 쉽게 찾을 수있습니다. 이것은 유지 보수를 용이하게 하며 모듈의 공유가 가능하고 Flutter에서는 생각할 수 없었던 것들도 전부 가능합니다. |
102 | BLoC은 Flutter에서 코드를 구성하기 위한 시작점으로 비즈니스 로직과 시각객체를 분리합니다. Getx는 비즈니스 로직 뿐만 아니라 프레젠테이션 로직을 분리하는 자연스러운 진화입니다. 추가로 종속성 주입과 라우트 또한 분리되고 데이터 계층이 모두로부터 분리됩니다. Hello World를 구현하는 것보다 더 쉽게 모든 것이 어디 있는지 알수 있습니다. | 102 | BLoC은 Flutter에서 코드를 구성하기 위한 시작점으로 비즈니스 로직과 시각객체를 분리합니다. Getx는 비즈니스 로직 뿐만 아니라 프레젠테이션 로직을 분리하는 자연스러운 진화입니다. 추가로 종속성 주입과 라우트 또한 분리되고 데이터 계층이 모두로부터 분리됩니다. Hello World를 구현하는 것보다 더 쉽게 모든 것이 어디 있는지 알수 있습니다. |
103 | Flutter SDK와 함께 GetX를 사용하면 가장 쉽고 실용적이며 확장 가능한 고성능 어플리케이션을 만들수 있습니다. 초보자에게는 쉬우며 전문가에게는 정확하고 완벽하게 동작하는 대규모 생태계가 함께합니다. 안전하고 안정적이며 업데이트되고 기본 Flutter SDK에 없는 광범위한 API 빌드를 제공합니다. | 103 | Flutter SDK와 함께 GetX를 사용하면 가장 쉽고 실용적이며 확장 가능한 고성능 어플리케이션을 만들수 있습니다. 초보자에게는 쉬우며 전문가에게는 정확하고 완벽하게 동작하는 대규모 생태계가 함께합니다. 안전하고 안정적이며 업데이트되고 기본 Flutter SDK에 없는 광범위한 API 빌드를 제공합니다. |
104 | 104 | ||
@@ -129,7 +129,7 @@ import 'package:get/get.dart'; | @@ -129,7 +129,7 @@ import 'package:get/get.dart'; | ||
129 | 129 | ||
130 | # GetX를 사용한 Counter 앱 | 130 | # GetX를 사용한 Counter 앱 |
131 | 131 | ||
132 | -Flutter의 새 프로젝트에서 기본적으로 생성 되는 "counter" 프로젝트는 100줄이 넘습니다 (코멘트 포함). Get의 강력함을 보여주기 위해 클릭 할 때마다 상태를 변경하고, 페이지 사이를 전환하고, 화면 사이의 상태를 공유하는 "counter"를 만드는 방법을 주석이 포함된 26줄의 코드로 보여줄 것입니다. | 132 | +Flutter의 새 프로젝트에서 기본적으로 생성 되는 "counter" 프로젝트는 100줄이 넘습니다 (코멘트 포함). Get의 힘을 보여주기 위해 클릭 할 때마다 상태를 변경하고, 페이지 사이를 전환하고, 화면 사이의 상태를 공유하는 "counter"를 만드는 방법을 주석이 포함된 26줄의 코드로 보여줄 것입니다. |
133 | 133 | ||
134 | - 1 단계: | 134 | - 1 단계: |
135 | MaterialApp 에 "Get"을 추가하여 GetMaterialApp 으로 변경합니다. | 135 | MaterialApp 에 "Get"을 추가하여 GetMaterialApp 으로 변경합니다. |
1 |  | 1 |  |
2 | 2 | ||
3 | [](https://pub.dev/packages/get) | 3 | [](https://pub.dev/packages/get) |
4 | -[](https://pub.dev/packages/get/score) | ||
5 | -[](https://pub.dev/packages/get/score) | ||
6 | -[](https://pub.dev/packages/get/score) | 4 | +[](https://pub.dev/packages/sentry/score) |
5 | +[](https://pub.dev/packages/get/score) | ||
6 | +[](https://pub.dev/packages/get/score) | ||
7 |  | 7 |  |
8 | [](https://pub.dev/packages/effective_dart) | 8 | [](https://pub.dev/packages/effective_dart) |
9 | [](https://discord.com/invite/9Hpt99N) | 9 | [](https://discord.com/invite/9Hpt99N) |
@@ -34,8 +34,6 @@ | @@ -34,8 +34,6 @@ | ||
34 | [](README.ko-kr.md) | 34 | [](README.ko-kr.md) |
35 | [](README-fr.md) | 35 | [](README-fr.md) |
36 | [](README.ja-JP.md) | 36 | [](README.ja-JP.md) |
37 | -[](README-hi.md) | ||
38 | -[](README-bn.md) | ||
39 | 37 | ||
40 | 38 | ||
41 | </div> | 39 | </div> |
@@ -518,6 +516,7 @@ class HomeProvider extends GetConnect { | @@ -518,6 +516,7 @@ class HomeProvider extends GetConnect { | ||
518 | //HttpStatus.unauthorized | 516 | //HttpStatus.unauthorized |
519 | httpClient.maxAuthRetries = 3; | 517 | httpClient.maxAuthRetries = 3; |
520 | } | 518 | } |
519 | + } | ||
521 | 520 | ||
522 | @override | 521 | @override |
523 | Future<Response<CasesModel>> getCases(String path) => get(path); | 522 | Future<Response<CasesModel>> getCases(String path) => get(path); |
@@ -681,19 +680,19 @@ context.height | @@ -681,19 +680,19 @@ context.height | ||
681 | context.heightTransformer() | 680 | context.heightTransformer() |
682 | context.widthTransformer() | 681 | context.widthTransformer() |
683 | 682 | ||
684 | -/// Similar to MediaQuery.sizeOf(context); | 683 | +/// Similar to MediaQuery.of(context).size |
685 | context.mediaQuerySize() | 684 | context.mediaQuerySize() |
686 | 685 | ||
687 | -/// Similar to MediaQuery.paddingOf(context); | 686 | +/// Similar to MediaQuery.of(context).padding |
688 | context.mediaQueryPadding() | 687 | context.mediaQueryPadding() |
689 | 688 | ||
690 | -/// Similar to MediaQuery.viewPaddingOf(context); | 689 | +/// Similar to MediaQuery.of(context).viewPadding |
691 | context.mediaQueryViewPadding() | 690 | context.mediaQueryViewPadding() |
692 | 691 | ||
693 | -/// Similar to MediaQuery.viewInsetsOf(context); | 692 | +/// Similar to MediaQuery.of(context).viewInsets; |
694 | context.mediaQueryViewInsets() | 693 | context.mediaQueryViewInsets() |
695 | 694 | ||
696 | -/// Similar to MediaQuery.orientationOf(context); | 695 | +/// Similar to MediaQuery.of(context).orientation; |
697 | context.orientation() | 696 | context.orientation() |
698 | 697 | ||
699 | /// Check if device is on landscape mode | 698 | /// Check if device is on landscape mode |
@@ -702,10 +701,10 @@ context.isLandscape() | @@ -702,10 +701,10 @@ context.isLandscape() | ||
702 | /// Check if device is on portrait mode | 701 | /// Check if device is on portrait mode |
703 | context.isPortrait() | 702 | context.isPortrait() |
704 | 703 | ||
705 | -/// Similar to MediaQuery.devicePixelRatioOf(context); | 704 | +/// Similar to MediaQuery.of(context).devicePixelRatio; |
706 | context.devicePixelRatio() | 705 | context.devicePixelRatio() |
707 | 706 | ||
708 | -/// Similar to MediaQuery.textScaleFactorOf(context); | 707 | +/// Similar to MediaQuery.of(context).textScaleFactor; |
709 | context.textScaleFactor() | 708 | context.textScaleFactor() |
710 | 709 | ||
711 | /// Get the shortestSide from screen | 710 | /// Get the shortestSide from screen |
@@ -1275,5 +1274,3 @@ Any contribution is welcome! | @@ -1275,5 +1274,3 @@ Any contribution is welcome! | ||
1275 | - [Flutter State Management with GetX – Complete App](https://www.appwithflutter.com/flutter-state-management-with-getx/) - by App With Flutter. | 1274 | - [Flutter State Management with GetX – Complete App](https://www.appwithflutter.com/flutter-state-management-with-getx/) - by App With Flutter. |
1276 | - [Flutter Routing with Animation using Get Package](https://www.appwithflutter.com/flutter-routing-using-get-package/) - by App With Flutter. | 1275 | - [Flutter Routing with Animation using Get Package](https://www.appwithflutter.com/flutter-routing-using-get-package/) - by App With Flutter. |
1277 | - [A minimal example on dartpad](https://dartpad.dev/2b3d0d6f9d4e312c5fdbefc414c1727e?) - by [Roi Peker](https://github.com/roipeker) | 1276 | - [A minimal example on dartpad](https://dartpad.dev/2b3d0d6f9d4e312c5fdbefc414c1727e?) - by [Roi Peker](https://github.com/roipeker) |
1278 | -- [GetConnect: The best way to perform API operations in Flutter with Get.](https://absyz.com/getconnect-the-best-way-to-perform-api-operations-in-flutter-with-getx/) - by [MD Sarfaraj](https://github.com/socialmad) | ||
1279 | -- [How To Create an App with GetX Architect in Flutter with Get CLI](https://www.youtube.com/watch?v=7mb4qBA7kTk&t=1380s) - by [MD Sarfaraj](https://github.com/socialmad) |
@@ -440,6 +440,7 @@ class HomeProvider extends GetConnect { | @@ -440,6 +440,7 @@ class HomeProvider extends GetConnect { | ||
440 | //HttpStatus.unauthorized | 440 | //HttpStatus.unauthorized |
441 | httpClient.maxAuthRetries = 3; | 441 | httpClient.maxAuthRetries = 3; |
442 | } | 442 | } |
443 | + } | ||
443 | 444 | ||
444 | @override | 445 | @override |
445 | Future<Response<CasesModel>> getCases(String path) => get(path); | 446 | Future<Response<CasesModel>> getCases(String path) => get(path); |
@@ -37,17 +37,6 @@ _语言: 中文, [英文](README.md), [越南文](README-vi.md), [印度尼西 | @@ -37,17 +37,6 @@ _语言: 中文, [英文](README.md), [越南文](README-vi.md), [印度尼西 | ||
37 | - [改变语言](#改变语言) | 37 | - [改变语言](#改变语言) |
38 | - [系统语言](#系统语言) | 38 | - [系统语言](#系统语言) |
39 | - [改变主题](#改变主题) | 39 | - [改变主题](#改变主题) |
40 | - - [GetConnect](#getconnect) | ||
41 | - - [默认配置](#默认配置) | ||
42 | - - [自定义配置](#自定义配置) | ||
43 | - - [GetPage 中间件](#getpage-中间件) | ||
44 | - - [优先级](#优先级) | ||
45 | - - [Redirect](#redirect) | ||
46 | - - [onPageCalled](#onpagecalled) | ||
47 | - - [OnBindingsStart](#onbindingsstart) | ||
48 | - - [OnPageBuildStart](#onpagebuildstart) | ||
49 | - - [OnPageBuilt](#onpagebuilt) | ||
50 | - - [OnPageDispose](#onpagedispose) | ||
51 | - [其他高级API](#其他高级api) | 40 | - [其他高级API](#其他高级api) |
52 | - [可选的全局设置和手动配置](#可选的全局设置和手动配置) | 41 | - [可选的全局设置和手动配置](#可选的全局设置和手动配置) |
53 | - [局部状态组件](#局部状态组件) | 42 | - [局部状态组件](#局部状态组件) |
@@ -405,162 +394,6 @@ Get.changeTheme(Get.isDarkMode? ThemeData.light(): ThemeData.dark()); | @@ -405,162 +394,6 @@ Get.changeTheme(Get.isDarkMode? ThemeData.light(): ThemeData.dark()); | ||
405 | 394 | ||
406 | 当`.darkmode`被激活时,它将切换到light主题,当light主题被激活时,它将切换到dark主题。 | 395 | 当`.darkmode`被激活时,它将切换到light主题,当light主题被激活时,它将切换到dark主题。 |
407 | 396 | ||
408 | -## GetConnect | ||
409 | - | ||
410 | -GetConnect可以便捷的通过http或websockets进行前后台通信。 | ||
411 | - | ||
412 | -### 默认配置 | ||
413 | - | ||
414 | -你能轻松的通过extend GetConnect就能使用GET/POST/PUT/DELETE/SOCKET方法与你的Rest API或websockets通信。 | ||
415 | - | ||
416 | -```dart | ||
417 | -class UserProvider extends GetConnect { | ||
418 | - // Get request | ||
419 | - Future<Response> getUser(int id) => get('http://youapi/users/$id'); | ||
420 | - // Post request | ||
421 | - Future<Response> postUser(Map data) => post('http://youapi/users', body: data); | ||
422 | - // Post request with File | ||
423 | - Future<Response<CasesModel>> postCases(List<int> image) { | ||
424 | - final form = FormData({ | ||
425 | - 'file': MultipartFile(image, filename: 'avatar.png'), | ||
426 | - 'otherFile': MultipartFile(image, filename: 'cover.png'), | ||
427 | - }); | ||
428 | - return post('http://youapi/users/upload', form); | ||
429 | - } | ||
430 | - | ||
431 | - GetSocket userMessages() { | ||
432 | - return socket('https://yourapi/users/socket'); | ||
433 | - } | ||
434 | -} | ||
435 | -``` | ||
436 | - | ||
437 | -### 自定义配置 | ||
438 | - | ||
439 | -GetConnect具有多种自定义配置。你可以配置base Url,配置响应,配置请求,添加权限验证,甚至是尝试认证的次数,除此之外,还可以定义一个标准的解码器,该解码器将把您的所有请求转换为您的模型,而不需要任何额外的配置。 | ||
440 | - | ||
441 | -```dart | ||
442 | -class HomeProvider extends GetConnect { | ||
443 | - @override | ||
444 | - void onInit() { | ||
445 | - // All request will pass to jsonEncode so CasesModel.fromJson() | ||
446 | - httpClient.defaultDecoder = CasesModel.fromJson; | ||
447 | - httpClient.baseUrl = 'https://api.covid19api.com'; | ||
448 | - // baseUrl = 'https://api.covid19api.com'; // It define baseUrl to | ||
449 | - // Http and websockets if used with no [httpClient] instance | ||
450 | - | ||
451 | - // It's will attach 'apikey' property on header from all requests | ||
452 | - httpClient.addRequestModifier((request) { | ||
453 | - request.headers['apikey'] = '12345678'; | ||
454 | - return request; | ||
455 | - }); | ||
456 | - | ||
457 | - // Even if the server sends data from the country "Brazil", | ||
458 | - // it will never be displayed to users, because you remove | ||
459 | - // that data from the response, even before the response is delivered | ||
460 | - httpClient.addResponseModifier<CasesModel>((request, response) { | ||
461 | - CasesModel model = response.body; | ||
462 | - if (model.countries.contains('Brazil')) { | ||
463 | - model.countries.remove('Brazilll'); | ||
464 | - } | ||
465 | - }); | ||
466 | - | ||
467 | - httpClient.addAuthenticator((request) async { | ||
468 | - final response = await get("http://yourapi/token"); | ||
469 | - final token = response.body['token']; | ||
470 | - // Set the header | ||
471 | - request.headers['Authorization'] = "$token"; | ||
472 | - return request; | ||
473 | - }); | ||
474 | - | ||
475 | - //Autenticator will be called 3 times if HttpStatus is | ||
476 | - //HttpStatus.unauthorized | ||
477 | - httpClient.maxAuthRetries = 3; | ||
478 | - } | ||
479 | - | ||
480 | - @override | ||
481 | - Future<Response<CasesModel>> getCases(String path) => get(path); | ||
482 | -} | ||
483 | -``` | ||
484 | - | ||
485 | -## GetPage 中间件 | ||
486 | - | ||
487 | -GetPage现在有个新的参数可以把列表中的Get中间件按指定顺序执行。 | ||
488 | - | ||
489 | -**注意**: 当GetPage有中间件时,所有的子page会自动有相同的中间件。 | ||
490 | - | ||
491 | -### 优先级 | ||
492 | - | ||
493 | -设置中间件的优先级定义Get中间件的执行顺序。 | ||
494 | - | ||
495 | -```dart | ||
496 | -final middlewares = [ | ||
497 | - GetMiddleware(priority: 2), | ||
498 | - GetMiddleware(priority: 5), | ||
499 | - GetMiddleware(priority: 4), | ||
500 | - GetMiddleware(priority: -8), | ||
501 | -]; | ||
502 | -``` | ||
503 | - | ||
504 | -这些中间件会按这个顺序执行 **-8 => 2 => 4 => 5** | ||
505 | - | ||
506 | -### Redirect | ||
507 | - | ||
508 | -当被调用路由的页面被搜索时,这个函数将被调用。它将RouteSettings作为重定向的结果。或者给它null,就没有重定向了。 | ||
509 | - | ||
510 | -```dart | ||
511 | -RouteSettings redirect(String route) { | ||
512 | - final authService = Get.find<AuthService>(); | ||
513 | - return authService.authed.value ? null : RouteSettings(name: '/login') | ||
514 | -} | ||
515 | -``` | ||
516 | - | ||
517 | -### onPageCalled | ||
518 | - | ||
519 | -在调用页面时,创建任何东西之前,这个函数会先被调用。 | ||
520 | -您可以使用它来更改页面的某些内容或给它一个新页面。 | ||
521 | - | ||
522 | -```dart | ||
523 | -GetPage onPageCalled(GetPage page) { | ||
524 | - final authService = Get.find<AuthService>(); | ||
525 | - return page.copyWith(title: 'Welcome ${authService.UserName}'); | ||
526 | -} | ||
527 | -``` | ||
528 | - | ||
529 | -### OnBindingsStart | ||
530 | - | ||
531 | -这个函数将在绑定初始化之前被调用。 | ||
532 | -在这里,您可以更改此页面的绑定。 | ||
533 | - | ||
534 | -```dart | ||
535 | -List<Bindings> onBindingsStart(List<Bindings> bindings) { | ||
536 | - final authService = Get.find<AuthService>(); | ||
537 | - if (authService.isAdmin) { | ||
538 | - bindings.add(AdminBinding()); | ||
539 | - } | ||
540 | - return bindings; | ||
541 | -} | ||
542 | -``` | ||
543 | - | ||
544 | -### OnPageBuildStart | ||
545 | - | ||
546 | -这个函数将在绑定初始化之后被调用。 | ||
547 | -在这里,您可以在创建绑定之后和创建页面widget之前执行一些操作。 | ||
548 | - | ||
549 | -```dart | ||
550 | -GetPageBuilder onPageBuildStart(GetPageBuilder page) { | ||
551 | - print('bindings are ready'); | ||
552 | - return page; | ||
553 | -} | ||
554 | -``` | ||
555 | - | ||
556 | -### OnPageBuilt | ||
557 | - | ||
558 | -这个函数将在GetPage.page调用后被调用,并给出函数的结果,并获取将要显示的widget。 | ||
559 | - | ||
560 | -### OnPageDispose | ||
561 | - | ||
562 | -这个函数将在处理完页面的所有相关对象(Controllers, views, ...)之后被调用。 | ||
563 | - | ||
564 | ## 其他高级API | 397 | ## 其他高级API |
565 | 398 | ||
566 | ```dart | 399 | ```dart |
1 | # Include option is buggy: | 1 | # Include option is buggy: |
2 | -include: package:flutter_lints/flutter.yaml | 2 | +# https://github.com/flutter/flutter/issues/62591 |
3 | # In case the include issue gets fixed, lines below INCLUDE_FIX | 3 | # In case the include issue gets fixed, lines below INCLUDE_FIX |
4 | # can be removed | 4 | # can be removed |
5 | +# include: package:flutter_lints/flutter.yaml | ||
6 | + | ||
7 | +# include: package:effective_dart/analysis_options.1.2.0.yaml | ||
8 | +analyzer: | ||
9 | + strong-mode: | ||
10 | + implicit-casts: false | ||
11 | +linter: | ||
12 | + rules: | ||
13 | + await_only_futures: true | ||
14 | + # This one is desirable, but that's a lot of work for now | ||
15 | + public_member_api_docs: false | ||
16 | + # Desirable, but would be breaking changes: | ||
17 | + avoid_positional_boolean_parameters: false | ||
18 | + constant_identifier_names: false | ||
19 | + include_file_not_found: false | ||
20 | + | ||
21 | + # INCLUDE_FIX (copy of effective dart 1.2.0) | ||
22 | + # STYLE | ||
23 | + camel_case_types: true | ||
24 | + close_sinks: true | ||
25 | + unnecessary_statements: true | ||
26 | + camel_case_extensions: true | ||
27 | + library_names: true | ||
28 | + file_names: true | ||
29 | + library_prefixes: true | ||
30 | + non_constant_identifier_names: true | ||
31 | + directives_ordering: true | ||
32 | + lines_longer_than_80_chars: true # avoid | ||
33 | + curly_braces_in_flow_control_structures: true | ||
34 | + | ||
35 | + # DOCUMENTATION | ||
36 | + slash_for_doc_comments: true | ||
37 | + package_api_docs: true # prefer | ||
38 | + #- comment_references # Unused because https://github.com/dart-lang/sdk/issues/36974 | ||
39 | + | ||
40 | + # USAGE | ||
41 | + implementation_imports: true | ||
42 | + avoid_relative_lib_imports: true # prefer | ||
43 | + prefer_relative_imports: true # prefer | ||
44 | + prefer_adjacent_string_concatenation: true | ||
45 | + prefer_interpolation_to_compose_strings: true # prefer | ||
46 | + unnecessary_brace_in_string_interps: true # avoid | ||
47 | + prefer_collection_literals: true | ||
48 | + avoid_function_literals_in_foreach_calls: true # avoid | ||
49 | + prefer_iterable_whereType: true | ||
50 | + prefer_function_declarations_over_variables: true | ||
51 | + unnecessary_lambdas: true | ||
52 | + prefer_equal_for_default_values: true | ||
53 | + avoid_init_to_null: true | ||
54 | + unnecessary_getters_setters: true | ||
55 | + annotate_overrides: true | ||
56 | + #- unnecessary_getters # prefer # Disabled pending fix: https://github.com/dart-lang/linter/issues/23 | ||
57 | + #- prefer_expression_function_bodies # consider | ||
58 | + unnecessary_this: true | ||
59 | + prefer_initializing_formals: true | ||
60 | + type_init_formals: true | ||
61 | + empty_constructor_bodies: true | ||
62 | + unnecessary_new: true | ||
63 | + unnecessary_const: true | ||
64 | + avoid_catches_without_on_clauses: true # avoid | ||
65 | + avoid_catching_errors: true | ||
66 | + use_rethrow_when_possible: true | ||
67 | + unrelated_type_equality_checks: true | ||
68 | + | ||
69 | + # DESIGN | ||
70 | + use_to_and_as_if_applicable: true # prefer | ||
71 | + one_member_abstracts: true # avoid | ||
72 | + avoid_classes_with_only_static_members: true # avoid | ||
73 | + prefer_mixin: true | ||
74 | + prefer_final_fields: true # prefer | ||
75 | + use_setters_to_change_properties: true | ||
76 | + avoid_setters_without_getters: true | ||
77 | + avoid_returning_null: true # avoid | ||
78 | + avoid_returning_this: true # avoid | ||
79 | + type_annotate_public_apis: true # prefer | ||
80 | + #- prefer_typing_uninitialized_variables # consider | ||
81 | + omit_local_variable_types: true # avoid | ||
82 | + avoid_types_on_closure_parameters: true # avoid | ||
83 | + avoid_return_types_on_setters: true # avoid | ||
84 | + prefer_generic_function_type_aliases: true | ||
85 | + avoid_private_typedef_functions: true # prefer | ||
86 | + #- use_function_type_syntax_for_parameters # consider | ||
87 | + hash_and_equals: true | ||
88 | + avoid_equals_and_hash_code_on_mutable_classes: true # avoid | ||
89 | + avoid_null_checks_in_equality_operators: true | ||
90 | + |
@@ -507,7 +507,7 @@ GetBuilder<Controller>( | @@ -507,7 +507,7 @@ GetBuilder<Controller>( | ||
507 | 507 | ||
508 | * You have already learned how to manage states with Get. | 508 | * You have already learned how to manage states with Get. |
509 | 509 | ||
510 | -* Note: You may want a larger organization, and not use the init property. For that, you can create a class and extends Binding class, and within it mention the controllers that will be created within that route. Controllers will not be created at that time, on the contrary, this is just a statement, so that the first time you use a Controller, Get will know where to look. Get will remain lazyLoad, and will continue to dispose Controllers when they are no longer needed. See the pub.dev example to see how it works. | 510 | +* Note: You may want a larger organization, and not use the init property. For that, you can create a class and extends Bindings class, and within it mention the controllers that will be created within that route. Controllers will not be created at that time, on the contrary, this is just a statement, so that the first time you use a Controller, Get will know where to look. Get will remain lazyLoad, and will continue to dispose Controllers when they are no longer needed. See the pub.dev example to see how it works. |
511 | 511 | ||
512 | If you navigate many routes and need data that was in your previously used controller, you just need to use GetBuilder Again (with no init): | 512 | If you navigate many routes and need data that was in your previously used controller, you just need to use GetBuilder Again (with no init): |
513 | 513 |
@@ -24,7 +24,7 @@ | @@ -24,7 +24,7 @@ | ||
24 | 24 | ||
25 | # State Management | 25 | # State Management |
26 | 26 | ||
27 | -GetX does not use Streams or ChangeNotifier like other state managers. Why? In addition to building applications for android, iOS, web, windows, macos and linux, with GetX you can build server applications with the same syntax as Flutter/GetX. In order to improve response time and reduce RAM consumption, we created GetValue and GetStream, which are low latency solutions that deliver a lot of performance, at a low operating cost. We use this base to build all of our resources, including state management. | 27 | +GetX does not use Streams or ChangeNotifier like other state managers. Why? In addition to building applications for android, iOS, web, linux, macos and linux, with GetX you can build server applications with the same syntax as Flutter/GetX. In order to improve response time and reduce RAM consumption, we created GetValue and GetStream, which are low latency solutions that deliver a lot of performance, at a low operating cost. We use this base to build all of our resources, including state management. |
28 | 28 | ||
29 | * _Complexity_: Some state managers are complex and have a lot of boilerplate. With GetX you don't have to define a class for each event, the code is highly clean and clear, and you do a lot more by writing less. Many people have given up on Flutter because of this topic, and they now finally have a stupidly simple solution for managing states. | 29 | * _Complexity_: Some state managers are complex and have a lot of boilerplate. With GetX you don't have to define a class for each event, the code is highly clean and clear, and you do a lot more by writing less. Many people have given up on Flutter because of this topic, and they now finally have a stupidly simple solution for managing states. |
30 | * _No code generators_: You spend half your development time writing your application logic. Some state managers rely on code generators to have minimally readable code. Changing a variable and having to run build_runner can be unproductive, and often the waiting time after a flutter clean will be long, and you will have to drink a lot of coffee. | 30 | * _No code generators_: You spend half your development time writing your application logic. Some state managers rely on code generators to have minimally readable code. Changing a variable and having to run build_runner can be unproductive, and often the waiting time after a flutter clean will be long, and you will have to drink a lot of coffee. |
@@ -450,7 +450,7 @@ All workers returns a `Worker` instance, that you can use to cancel ( via `dispo | @@ -450,7 +450,7 @@ All workers returns a `Worker` instance, that you can use to cancel ( via `dispo | ||
450 | 450 | ||
451 | * **`interval`** | 451 | * **`interval`** |
452 | 452 | ||
453 | -'interval' is different from the debouce. debouce if the user makes 1000 changes to a variable within 1 second, he will send only the last one after the stipulated timer (the default is 800 milliseconds). Interval will instead ignore all user actions for the stipulated period. If you send events for 1 minute, 1000 per second, debounce will only send you the last one, when the user stops strafing events. interval will deliver events every second, and if set to 3 seconds, it will deliver 20 events that minute. This is recommended to avoid abuse, in functions where the user can quickly click on something and get some advantage (imagine that the user can earn coins by clicking on something, if he clicked 300 times in the same minute, he would have 300 coins, using interval, you can set a time frame for 3 seconds, and even then clicking 300 or a thousand times, the maximum he would get in 1 minute would be 20 coins, clicking 300 or 1 million times). The debounce is suitable for anti-DDos, for functions like search where each change to onChange would cause a query to your api. Debounce will wait for the user to stop typing the name, to make the request. If it were used in the coin scenario mentioned above, the user would only win 1 coin, because it is only executed, when the user "pauses" for the established time. | 453 | +'interval' is different from the debouce. debouce if the user makes 1000 changes to a variable within 1 second, he will send only the last one after the stipulated timer (the default is 800 milliseconds). Interval will instead ignore all user actions for the stipulated period. If you send events for 1 minute, 1000 per second, debounce will only send you the last one, when the user stops strafing events. interval will deliver events every second, and if set to 3 seconds, it will deliver 20 events that minute. This is recommended to avoid abuse, in functions where the user can quickly click on something and get some advantage (imagine that the user can earn coins by clicking on something, if he clicked 300 times in the same minute, he would have 300 coins, using interval, you you can set a time frame for 3 seconds, and even then clicking 300 or a thousand times, the maximum he would get in 1 minute would be 20 coins, clicking 300 or 1 million times). The debounce is suitable for anti-DDos, for functions like search where each change to onChange would cause a query to your api. Debounce will wait for the user to stop typing the name, to make the request. If it were used in the coin scenario mentioned above, the user would only win 1 coin, because it is only executed, when the user "pauses" for the established time. |
454 | 454 | ||
455 | * NOTE: Workers should always be used when starting a Controller or Class, so it should always be on onInit (recommended), Class constructor, or the initState of a StatefulWidget (this practice is not recommended in most cases, but it shouldn't have any side effects). | 455 | * NOTE: Workers should always be used when starting a Controller or Class, so it should always be on onInit (recommended), Class constructor, or the initState of a StatefulWidget (this practice is not recommended in most cases, but it shouldn't have any side effects). |
456 | 456 | ||
@@ -507,7 +507,7 @@ GetBuilder<Controller>( | @@ -507,7 +507,7 @@ GetBuilder<Controller>( | ||
507 | 507 | ||
508 | * You have already learned how to manage states with Get. | 508 | * You have already learned how to manage states with Get. |
509 | 509 | ||
510 | -* Note: You may want a larger organization, and not use the init property. For that, you can create a class and extends Binding class, and within it mention the controllers that will be created within that route. Controllers will not be created at that time, on the contrary, this is just a statement, so that the first time you use a Controller, Get will know where to look. Get will remain lazyLoad, and will continue to dispose Controllers when they are no longer needed. See the pub.dev example to see how it works. | 510 | +* Note: You may want a larger organization, and not use the init property. For that, you can create a class and extends Bindings class, and within it mention the controllers that will be created within that route. Controllers will not be created at that time, on the contrary, this is just a statement, so that the first time you use a Controller, Get will know where to look. Get will remain lazyLoad, and will continue to dispose Controllers when they are no longer needed. See the pub.dev example to see how it works. |
511 | 511 | ||
512 | If you navigate many routes and need data that was in your previously used controller, you just need to use GetBuilder Again (with no init): | 512 | If you navigate many routes and need data that was in your previously used controller, you just need to use GetBuilder Again (with no init): |
513 | 513 |
@@ -73,7 +73,7 @@ Get.put<S>( | @@ -73,7 +73,7 @@ Get.put<S>( | ||
73 | ``` | 73 | ``` |
74 | 74 | ||
75 | ### Get.lazyPut | 75 | ### Get.lazyPut |
76 | -인스턴스를 사용하는 경우에만 의존성을 lazyLoad 할 수 있습니다. 계산 비용이 많이 드는 클래스나 한곳에서 다양한 클래스를 당장 사용하지 않으면서 인스턴스화 하기를 원한다면(Bindings 클래스처럼) 매우 유용합니다. | 76 | +인스턴스하게 사용하는 경우에만 의존성을 lazyLoad 할 수 있습니다. 계산 비용이 많이 드는 클래스나 한곳에서 다양한 클래스를 당장 사용하지 않으면서 인스턴스화 하기를 원한다면(Bindings 클래스처럼) 매우 유용합니다. |
77 | 77 | ||
78 | ```dart | 78 | ```dart |
79 | /// ApiMock은 처음으로 Get.find<ApiMock>을 사용하는 경우에만 호출됩니다. | 79 | /// ApiMock은 처음으로 Get.find<ApiMock>을 사용하는 경우에만 호출됩니다. |
@@ -94,7 +94,7 @@ Get.lazyPut<Controller>( () => Controller() ) | @@ -94,7 +94,7 @@ Get.lazyPut<Controller>( () => Controller() ) | ||
94 | lazyPut을 사용시 설정 가능한 모든 사항: | 94 | lazyPut을 사용시 설정 가능한 모든 사항: |
95 | ```dart | 95 | ```dart |
96 | Get.lazyPut<S>( | 96 | Get.lazyPut<S>( |
97 | - // 필수: 이 메서드는 처음으로 클래스가 호출할 때 실행될 것입니다. | 97 | + // 필수: 이 메서드는 처음으로 클래스가 호출할 때 실행될 것입니다 |
98 | InstanceBuilderCallback builder, | 98 | InstanceBuilderCallback builder, |
99 | 99 | ||
100 | // 선택: Get.put()과 같이 같은 클래스를 다중으로 인스턴스할 경우 사용합니다. | 100 | // 선택: Get.put()과 같이 같은 클래스를 다중으로 인스턴스할 경우 사용합니다. |
@@ -148,7 +148,7 @@ Get.Create<SomeClass>(() => SomeClass()); | @@ -148,7 +148,7 @@ Get.Create<SomeClass>(() => SomeClass()); | ||
148 | Get.Create<LoginController>(() => LoginController()); | 148 | Get.Create<LoginController>(() => LoginController()); |
149 | ``` | 149 | ``` |
150 | 150 | ||
151 | -create 사용 시 설정 가능한 모든 사항: | 151 | +create 사용시 설정 가능한 모든 사항: |
152 | 152 | ||
153 | ```dart | 153 | ```dart |
154 | Get.create<S>( | 154 | Get.create<S>( |
@@ -177,7 +177,7 @@ final controller = Get.find<Controller>(); | @@ -177,7 +177,7 @@ final controller = Get.find<Controller>(); | ||
177 | // OR | 177 | // OR |
178 | Controller controller = Get.find(); | 178 | Controller controller = Get.find(); |
179 | 179 | ||
180 | -// 그렇습니다. 마법 같아요. Get은 controller를 찾아 가져다 줍니다. | 180 | +// 그렇습니다. 마법 같아요. Get은 controller를 찾고 배달해 줍니다. |
181 | // Get은 백만개의 contrller를 인스턴스화해서 가질수 있고 항상 올바르게 전달해 줍니다. | 181 | // Get은 백만개의 contrller를 인스턴스화해서 가질수 있고 항상 올바르게 전달해 줍니다. |
182 | ``` | 182 | ``` |
183 | 183 | ||
@@ -200,35 +200,6 @@ Get의 인스턴스에서 삭제합니다: | @@ -200,35 +200,6 @@ Get의 인스턴스에서 삭제합니다: | ||
200 | Get.delete<Controller>(); // 보통 GetX는 미사용 controller를 삭제하기 때문에 수행할 필요가 없습니다 | 200 | Get.delete<Controller>(); // 보통 GetX는 미사용 controller를 삭제하기 때문에 수행할 필요가 없습니다 |
201 | ``` | 201 | ``` |
202 | 202 | ||
203 | -## 대체 인스턴스 지정 | ||
204 | - | ||
205 | -현재 추가된 인스턴스는 `replace` 또는 `lazyReplace` 메소드를 사용하여 유사하거나 확장된 클래스 인스턴스로 교체할 수 있습니다. 이후 원본 클래스를 사용하여 찾을 수 있습니다. | ||
206 | -```dart | ||
207 | -abstract class BaseClass {} | ||
208 | -class ParentClass extends BaseClass {} | ||
209 | - | ||
210 | -class ChildClass extends ParentClass { | ||
211 | - bool isChild = true; | ||
212 | -} | ||
213 | - | ||
214 | - | ||
215 | -Get.put<BaseClass>(ParentClass()); | ||
216 | - | ||
217 | -Get.replace<BaseClass>(ChildClass()); | ||
218 | - | ||
219 | -final instance = Get.find<BaseClass>(); | ||
220 | -print(instance is ChildClass); //true | ||
221 | - | ||
222 | - | ||
223 | -class OtherClass extends BaseClass {} | ||
224 | -Get.lazyReplace<BaseClass>(() => OtherClass()); | ||
225 | - | ||
226 | -final instance = Get.find<BaseClass>(); | ||
227 | -print(instance is ChildClass); // false | ||
228 | -print(instance is OtherClass); //true | ||
229 | -``` | ||
230 | - | ||
231 | - | ||
232 | ## 메서드간의 차이점 | 203 | ## 메서드간의 차이점 |
233 | 204 | ||
234 | 첫째, Get.lazyPut의 `fenix`와 다른 메서드들의 `permanent`을 살펴보겠습니다. | 205 | 첫째, Get.lazyPut의 `fenix`와 다른 메서드들의 `permanent`을 살펴보겠습니다. |
@@ -30,7 +30,7 @@ GetX는 다른 상태 관리자처럼 Streams나 ChangeNotifier를 사용하지 | @@ -30,7 +30,7 @@ GetX는 다른 상태 관리자처럼 Streams나 ChangeNotifier를 사용하지 | ||
30 | - _code generators에 의존하지 않음_: 당신은 어플리케이션 개발을 위한 로직을 작성하는데 개발시간의 절반을 할애했을 것입니다. 어떤 상태관리자들은 code generator에 의존하여 읽기 쉬운 코드를 작성했을 것입니다. 변수를 바꾸고 build_runner를 실행해야 하는 것은 비생산적일 수 있으며, 심지어 Flutter가 이를 반영되기를 기다리면서 커피 한 잔을 즐겨야 할 정도로 오래 기다릴 수 있습니다. GetX는 모든것을 즉각적으로 반응합니다. code generator에 의존하지 않고, 모든 면에서 당신의 생산성을 높여줍니다. | 30 | - _code generators에 의존하지 않음_: 당신은 어플리케이션 개발을 위한 로직을 작성하는데 개발시간의 절반을 할애했을 것입니다. 어떤 상태관리자들은 code generator에 의존하여 읽기 쉬운 코드를 작성했을 것입니다. 변수를 바꾸고 build_runner를 실행해야 하는 것은 비생산적일 수 있으며, 심지어 Flutter가 이를 반영되기를 기다리면서 커피 한 잔을 즐겨야 할 정도로 오래 기다릴 수 있습니다. GetX는 모든것을 즉각적으로 반응합니다. code generator에 의존하지 않고, 모든 면에서 당신의 생산성을 높여줍니다. |
31 | - _필요없는 context_: 아마 당신은 비즈니스 로직을 UI에 반영하기 위해, 여러 위젯 컨트롤러에 context를 넘겨주었을 것입니다. context를 이용한 위젯을 사용하기 위해, context를 다양한 클래스와 함수들을 이용하여 전달하였을 것입니다. GetX를 이용하면 그럴 필요가 없습니다. context없이 controller만으로 접근하여 사용할 수 있습니다. 말 그대로 아무 의미 없이 context를 파라미터로 넘겨줄 필요가 없습니다. | 31 | - _필요없는 context_: 아마 당신은 비즈니스 로직을 UI에 반영하기 위해, 여러 위젯 컨트롤러에 context를 넘겨주었을 것입니다. context를 이용한 위젯을 사용하기 위해, context를 다양한 클래스와 함수들을 이용하여 전달하였을 것입니다. GetX를 이용하면 그럴 필요가 없습니다. context없이 controller만으로 접근하여 사용할 수 있습니다. 말 그대로 아무 의미 없이 context를 파라미터로 넘겨줄 필요가 없습니다. |
32 | - _세분화된 컨트롤_: 대부분의 상태관리자들은 ChangeNotifier을 기반으로 동작합니다. ChangeNotifier는 notifyListeners가 호출되면 모든 위젯들에게 알릴 것입니다. 만약 당신 스크린에 수많은 ChangeNotifier 클래스를 갖는 40개의 위젯이 있다면, 한 번 업데이트 할 때마다 모든 위젯들이 다시 빌드될 것입니다. GetX를 이용하면 위젯이 중첩되더라도, 변경된 위젯만 다시 빌드됩니다. 한 Obx가 ListView를 보고있고, 다른 Obx가 ListView 안의 checkbox를 보고있을 때, checkBox 값이 변경되면, checkBox만 업데이트 되고, ListView 값이 변경되면 ListView만 업데이트 됩니다. | 32 | - _세분화된 컨트롤_: 대부분의 상태관리자들은 ChangeNotifier을 기반으로 동작합니다. ChangeNotifier는 notifyListeners가 호출되면 모든 위젯들에게 알릴 것입니다. 만약 당신 스크린에 수많은 ChangeNotifier 클래스를 갖는 40개의 위젯이 있다면, 한 번 업데이트 할 때마다 모든 위젯들이 다시 빌드될 것입니다. GetX를 이용하면 위젯이 중첩되더라도, 변경된 위젯만 다시 빌드됩니다. 한 Obx가 ListView를 보고있고, 다른 Obx가 ListView 안의 checkbox를 보고있을 때, checkBox 값이 변경되면, checkBox만 업데이트 되고, ListView 값이 변경되면 ListView만 업데이트 됩니다. |
33 | -- _**정말** 바뀌었을 때만 재구성_: GetX는 흐름제어를 합니다. '진탁'이라는 Text를 화면에 보여준다고 해봅시다. 만약 당신이 observable 변수인 '진탁'을 다시 한 번 '진탁'으로 변경한다면, 그 위젯은 재구성되지 않습니다. 왜냐하면 GetX는 '진탁'이 이미 Text로 보여주고 있다는 것을 알고 있기 때문에, 불필요한 재구성을 하지 않습니다. 대부분(모두일 수도 있는) 지금까지의 대부분의 상태관리자들은 스크린에 다시 빌드하여 보여줍니다. | 33 | +- _**정말** 바뀌었을 때만 재구성_: GetX는 흐름제어를 합니다. '진탁'이라는 Text를 화면에 보여준다고 해봅시다. 만약 당신이 obserable 변수인 '진탁'을 다시 한 번 '진탁'으로 변경한다면, 그 위젯은 재구성되지 않습니다. 왜냐하면 GetX는 '진탁'이 이미 Text로 보여주고 있다는 것을 알고 있기 때문에, 불필요한 재구성을 하지 않습니다. 대부분(모두일 수도 있는) 지금까지의 대부분의 상태관리자들은 스크린에 다시 빌드하여 보여줍니다. |
34 | 34 | ||
35 | ## 반응형 상태 관리자 | 35 | ## 반응형 상태 관리자 |
36 | 36 |
@@ -59,11 +59,11 @@ var name = 'Jonatas Borges'.obs; | @@ -59,11 +59,11 @@ var name = 'Jonatas Borges'.obs; | ||
59 | 59 | ||
60 | 就这么简单! | 60 | 就这么简单! |
61 | 61 | ||
62 | -我们把这个reactive-".obs"(ervables)变量称为 _Rx_ 。 | 62 | +我们把这个reactive-".obs"(ervables)变量称为_Rx_。 |
63 | 63 | ||
64 | 我们做了什么?我们创建了一个 "Stream "的 "String",分配了初始值 "Jonatas Borges",我们通知所有使用 "Jonatas Borges "的widgets,它们现在 "属于 "这个变量,当_Rx_的值发生变化时,它们也要随之改变。 | 64 | 我们做了什么?我们创建了一个 "Stream "的 "String",分配了初始值 "Jonatas Borges",我们通知所有使用 "Jonatas Borges "的widgets,它们现在 "属于 "这个变量,当_Rx_的值发生变化时,它们也要随之改变。 |
65 | 65 | ||
66 | -这就是GetX **的** 魔力,这要归功于Dart的能力。 | 66 | +这就是GetX**的**魔力,这要归功于Dart的能力。 |
67 | 67 | ||
68 | 但是,我们知道,一个`Widget`只有在函数里面才能改变,因为静态类没有 "自动改变 "的能力。 | 68 | 但是,我们知道,一个`Widget`只有在函数里面才能改变,因为静态类没有 "自动改变 "的能力。 |
69 | 69 | ||
@@ -80,15 +80,15 @@ var name = 'Jonatas Borges'.obs; | @@ -80,15 +80,15 @@ var name = 'Jonatas Borges'.obs; | ||
80 | Obx (() => Text (controller.name)); | 80 | Obx (() => Text (controller.name)); |
81 | ``` | 81 | ``` |
82 | 82 | ||
83 | -你只需记住 `Obx(()=>` | 83 | +_你只需记住 `Obx(()=>` |
84 | 84 | ||
85 | -你只需将Widget通过一个箭头函数传递给 `Obx()`( _Rx_ 的 "观察者")。 | 85 | +你只需将Widget通过一个箭头函数传递给 `Obx()`(_Rx_的 "观察者")。 |
86 | 86 | ||
87 | `Obx`是相当聪明的,只有当`controller.name`的值发生变化时才会改变。 | 87 | `Obx`是相当聪明的,只有当`controller.name`的值发生变化时才会改变。 |
88 | 88 | ||
89 | 如果`name`是`"John"`,你把它改成了`"John"`(`name.value="John"`),因为它和之前的`value`是一样的,所以界面上不会有任何变化,而`Obx`为了节省资源,会直接忽略新的值,不重建Widget。**这是不是很神奇**? | 89 | 如果`name`是`"John"`,你把它改成了`"John"`(`name.value="John"`),因为它和之前的`value`是一样的,所以界面上不会有任何变化,而`Obx`为了节省资源,会直接忽略新的值,不重建Widget。**这是不是很神奇**? |
90 | 90 | ||
91 | -> 那么,如果我在一个`Obx`里有5个 _Rx_ (可观察的)变量呢? | 91 | +> 那么,如果我在一个`Obx`里有5个_Rx_(可观察的)变量呢? |
92 | 92 | ||
93 | 当其中**任何**一个变量发生变化时,它就会更新。 | 93 | 当其中**任何**一个变量发生变化时,它就会更新。 |
94 | 94 | ||
@@ -96,7 +96,7 @@ Obx (() => Text (controller.name)); | @@ -96,7 +96,7 @@ Obx (() => Text (controller.name)); | ||
96 | 96 | ||
97 | 不会,只会更新使用那个 _Rx_ 变量的**特定 Widget**。 | 97 | 不会,只会更新使用那个 _Rx_ 变量的**特定 Widget**。 |
98 | 98 | ||
99 | -所以,只有当 _Rx_ 变量的值发生变化时,**GetX**才会更新界面。 | 99 | +所以,只有当_Rx_变量的值发生变化时,**GetX**才会更新界面。 |
100 | 100 | ||
101 | ``` | 101 | ``` |
102 | final isOpen = false.obs; | 102 | final isOpen = false.obs; |
@@ -114,13 +114,13 @@ void onButtonTap() => isOpen.value=false; | @@ -114,13 +114,13 @@ void onButtonTap() => isOpen.value=false; | ||
114 | 114 | ||
115 | 如果你需要一个**强大的**状态管理器,用**GetX**是不会错的。 | 115 | 如果你需要一个**强大的**状态管理器,用**GetX**是不会错的。 |
116 | 116 | ||
117 | -它不能和变量一起工作,除了 __flows__ ,它里面的东西本质都是`Streams`。 | ||
118 | -你可以将 _rxDart_ 与它结合使用,因为所有的东西都是`Streams`。 | ||
119 | -你可以监听每个" _Rx_ 变量 "的 "事件"。 | 117 | +它不能和变量一起工作,除了__flows__,它里面的东西本质都是`Streams`。 |
118 | +你可以将_rxDart_与它结合使用,因为所有的东西都是`Streams`。 | ||
119 | +你可以监听每个"_Rx_变量 "的 "事件"。 | ||
120 | 因为里面的所有东西都是 "Streams"。 | 120 | 因为里面的所有东西都是 "Streams"。 |
121 | 121 | ||
122 | -这实际上是一种 _BLoC_ 方法,比 _MobX_ 更容易,而且没有代码生成器或装饰。 | ||
123 | -你可以把**任何东西**变成一个 _"Observable"_ ,只需要在它末尾加上`.obs`。 | 122 | +这实际上是一种_BLoC_方法,比_MobX_更容易,而且没有代码生成器或装饰。 |
123 | +你可以把**任何东西**变成一个_"Observable"_,只需要在它末尾加上`.obs`。 | ||
124 | 124 | ||
125 | ### 最高性能 | 125 | ### 最高性能 |
126 | 126 | ||
@@ -129,8 +129,8 @@ void onButtonTap() => isOpen.value=false; | @@ -129,8 +129,8 @@ void onButtonTap() => isOpen.value=false; | ||
129 | 如果你的应用程序中遇到错误,并发送重复的状态变更,**GetX**将确保它不会崩溃。 | 129 | 如果你的应用程序中遇到错误,并发送重复的状态变更,**GetX**将确保它不会崩溃。 |
130 | 130 | ||
131 | 使用**GetX**,只有当`value`改变时,状态才会改变。 | 131 | 使用**GetX**,只有当`value`改变时,状态才会改变。 |
132 | -这就是**GetX**,和使用MobX _的_ `computed`的主要区别。 | ||
133 | -当加入两个 __observable__ ,其中一个发生变化时,该 _observable_ 的监听器也会发生变化。 | 132 | +这就是**GetX**,和使用MobX_的_`computed`的主要区别。 |
133 | +当加入两个__observable__,其中一个发生变化时,该_observable_的监听器也会发生变化。 | ||
134 | 134 | ||
135 | 使用**GetX**,如果你连接了两个变量,`GetX()`(类似于`Observer()`)只有在它的状态真正变化时才会重建。 | 135 | 使用**GetX**,如果你连接了两个变量,`GetX()`(类似于`Observer()`)只有在它的状态真正变化时才会重建。 |
136 | 136 | ||
@@ -183,13 +183,13 @@ final user = User().obs; | @@ -183,13 +183,13 @@ final user = User().obs; | ||
183 | 183 | ||
184 | ##### 有一个反应的状态,很容易。 | 184 | ##### 有一个反应的状态,很容易。 |
185 | 185 | ||
186 | -我们知道, _Dart_ 现在正朝着 _null safety_ 的方向发展。 | ||
187 | -为了做好准备,从现在开始,你应该总是用一个**初始值**来开始你的 _Rx_ 变量。 | 186 | +我们知道,_Dart_现在正朝着_null safety_的方向发展。 |
187 | +为了做好准备,从现在开始,你应该总是用一个**初始值**来开始你的_Rx_变量。 | ||
188 | 188 | ||
189 | -> 用**GetX**将一个变量转化为一个 _observable_ + _initial value_ 是最简单,也是最实用的方法。 | 189 | +> 用**GetX**将一个变量转化为一个_observable_ + _initial value_是最简单,也是最实用的方法。 |
190 | 190 | ||
191 | 你只需在变量的末尾添加一个"`.obs`",即可把它变成可观察的变量, | 191 | 你只需在变量的末尾添加一个"`.obs`",即可把它变成可观察的变量, |
192 | -然后它的`.value`就是 _初始值_ )。 | 192 | +然后它的`.value`就是_初始值_)。 |
193 | 193 | ||
194 | 194 | ||
195 | ### 使用视图中的值 | 195 | ### 使用视图中的值 |
@@ -411,17 +411,17 @@ interval(count1, (_) => print("interval $_"), time: Duration(seconds: 1)); | @@ -411,17 +411,17 @@ interval(count1, (_) => print("interval $_"), time: Duration(seconds: 1)); | ||
411 | 所有worker都会返回一个`Worker`实例,你可以用它来取消(通过`dispose()`)worker。 | 411 | 所有worker都会返回一个`Worker`实例,你可以用它来取消(通过`dispose()`)worker。 |
412 | 412 | ||
413 | - **`ever`** | 413 | - **`ever`** |
414 | - 每当 _Rx_ 变量发出一个新的值时,就会被调用。 | 414 | + 每当_Rx_变量发出一个新的值时,就会被调用。 |
415 | 415 | ||
416 | - **`everAll`** | 416 | - **`everAll`** |
417 | - 和 "ever "很像,但它需要一个 _Rx_ 值的 "List",每次它的变量被改变时都会被调用。就是这样。 | 417 | + 和 "ever "很像,但它需要一个_Rx_值的 "List",每次它的变量被改变时都会被调用。就是这样。 |
418 | 418 | ||
419 | 419 | ||
420 | - **`once`** | 420 | - **`once`** |
421 | 'once'只在变量第一次被改变时被调用。 | 421 | 'once'只在变量第一次被改变时被调用。 |
422 | 422 | ||
423 | - **`debounce`** | 423 | - **`debounce`** |
424 | -'debounce'在搜索函数中非常有用,你只希望API在用户完成输入时被调用。如果用户输入 "Jonny",你将在API中进行5次搜索,分别是字母J、o、n、n和y。使用Get不会发生这种情况,因为你将有一个 "debounce "Worker,它只会在输入结束时触发。 | 424 | +debounce'在搜索函数中非常有用,你只希望API在用户完成输入时被调用。如果用户输入 "Jonny",你将在API中进行5次搜索,分别是字母J、o、n、n和y。使用Get不会发生这种情况,因为你将有一个 "debounce "Worker,它只会在输入结束时触发。 |
425 | 425 | ||
426 | - **`interval`** | 426 | - **`interval`** |
427 | 'interval'与debouce不同,debouce如果用户在1秒内对一个变量进行了1000次修改,他将在规定的计时器(默认为800毫秒)后只发送最后一次修改。Interval则会忽略规定时间内的所有用户操作。如果你发送事件1分钟,每秒1000个,那么当用户停止DDOS事件时,debounce将只发送最后一个事件。建议这样做是为了避免滥用,在用户可以快速点击某样东西并获得一些好处的功能中(想象一下,用户点击某样东西可以赚取硬币,如果他在同一分钟内点击300次,他就会有300个硬币,使用间隔,你可以设置时间范围为3秒,无论是点击300次或100万次,1分钟内他最多获得20个硬币)。debounce适用于防DDOS,适用于搜索等功能,每次改变onChange都会调用你的api进行查询。Debounce会等待用户停止输入名称,进行请求。如果在上面提到的投币场景中使用它,用户只会赢得1个硬币,因为只有当用户 "暂停 "到既定时间时,它才会被执行。 | 427 | 'interval'与debouce不同,debouce如果用户在1秒内对一个变量进行了1000次修改,他将在规定的计时器(默认为800毫秒)后只发送最后一次修改。Interval则会忽略规定时间内的所有用户操作。如果你发送事件1分钟,每秒1000个,那么当用户停止DDOS事件时,debounce将只发送最后一个事件。建议这样做是为了避免滥用,在用户可以快速点击某样东西并获得一些好处的功能中(想象一下,用户点击某样东西可以赚取硬币,如果他在同一分钟内点击300次,他就会有300个硬币,使用间隔,你可以设置时间范围为3秒,无论是点击300次或100万次,1分钟内他最多获得20个硬币)。debounce适用于防DDOS,适用于搜索等功能,每次改变onChange都会调用你的api进行查询。Debounce会等待用户停止输入名称,进行请求。如果在上面提到的投币场景中使用它,用户只会赢得1个硬币,因为只有当用户 "暂停 "到既定时间时,它才会被执行。 |
@@ -200,14 +200,12 @@ Bindings is the first step towards having a scalable application, you can visual | @@ -200,14 +200,12 @@ Bindings is the first step towards having a scalable application, you can visual | ||
200 | To create a Binding, simply create a class and implement Bindings | 200 | To create a Binding, simply create a class and implement Bindings |
201 | 201 | ||
202 | ```dart | 202 | ```dart |
203 | -class SampleBind extends Binding { | 203 | +class SampleBind extends Bindings { |
204 | @override | 204 | @override |
205 | - List<Bind> dependencies() { | ||
206 | - return [ | ||
207 | - Bind.lazyPut<Controller>(() => Controller()), | ||
208 | - Bind.lazyPut<Controller2>(() => Controller2()), | ||
209 | - Bind.lazyPut<Controller3>(() => Controller3()), | ||
210 | - ]; | 205 | + void dependencies() { |
206 | + Get.lazyPut<Controller>(() => Controller()); | ||
207 | + Get.lazyPut<Controller2>(() => Controller2()); | ||
208 | + Get.lazyPut<Controller3>(() => Controller3()); | ||
211 | } | 209 | } |
212 | } | 210 | } |
213 | ``` | 211 | ``` |
@@ -489,7 +487,7 @@ class Third extends GetView<ControllerX> { | @@ -489,7 +487,7 @@ class Third extends GetView<ControllerX> { | ||
489 | } | 487 | } |
490 | } | 488 | } |
491 | 489 | ||
492 | -class SampleBind extends Binding { | 490 | +class SampleBind extends Bindings { |
493 | @override | 491 | @override |
494 | void dependencies() { | 492 | void dependencies() { |
495 | Get.lazyPut<ControllerX>(() => ControllerX()); | 493 | Get.lazyPut<ControllerX>(() => ControllerX()); |
1 | import 'package:flutter/material.dart'; | 1 | import 'package:flutter/material.dart'; |
2 | import 'package:get/get.dart'; | 2 | import 'package:get/get.dart'; |
3 | 3 | ||
4 | -import 'en_US.dart'; | ||
5 | -import 'pt_BR.dart'; | 4 | +import 'en_us.dart'; |
5 | +import 'pt_br.dart'; | ||
6 | 6 | ||
7 | class TranslationService extends Translations { | 7 | class TranslationService extends Translations { |
8 | static Locale? get locale => Get.deviceLocale; | 8 | static Locale? get locale => Get.deviceLocale; |
9 | - static const fallbackLocale = Locale('en', 'US'); | 9 | + static final fallbackLocale = Locale('en', 'US'); |
10 | @override | 10 | @override |
11 | Map<String, Map<String, String>> get keys => { | 11 | Map<String, Map<String, String>> get keys => { |
12 | 'en_US': en_US, | 12 | 'en_US': en_US, |
1 | import 'package:flutter/material.dart'; | 1 | import 'package:flutter/material.dart'; |
2 | import 'package:get/get.dart'; | 2 | import 'package:get/get.dart'; |
3 | 3 | ||
4 | -// void main() { | ||
5 | -// runApp(const MyApp()); | ||
6 | -// } | ||
7 | - | ||
8 | -// class MyApp extends StatelessWidget { | ||
9 | -// const MyApp({Key? key}) : super(key: key); | ||
10 | - | ||
11 | -// @override | ||
12 | -// Widget build(BuildContext context) { | ||
13 | -// return GetMaterialApp( | ||
14 | -// theme: ThemeData(useMaterial3: true), | ||
15 | -// debugShowCheckedModeBanner: false, | ||
16 | -// enableLog: true, | ||
17 | -// logWriterCallback: Logger.write, | ||
18 | -// initialRoute: AppPages.INITIAL, | ||
19 | -// getPages: AppPages.routes, | ||
20 | -// locale: TranslationService.locale, | ||
21 | -// fallbackLocale: TranslationService.fallbackLocale, | ||
22 | -// translations: TranslationService(), | ||
23 | -// ); | ||
24 | -// } | ||
25 | -// } | 4 | +import 'lang/translation_service.dart'; |
5 | +import 'routes/app_pages.dart'; | ||
6 | +import 'shared/logger/logger_utils.dart'; | ||
26 | 7 | ||
27 | -/// Nav 2 snippet | ||
28 | void main() { | 8 | void main() { |
29 | - runApp(const MyApp()); | 9 | + runApp(MyApp()); |
30 | } | 10 | } |
31 | 11 | ||
32 | class MyApp extends StatelessWidget { | 12 | class MyApp extends StatelessWidget { |
@@ -34,142 +14,116 @@ class MyApp extends StatelessWidget { | @@ -34,142 +14,116 @@ class MyApp extends StatelessWidget { | ||
34 | 14 | ||
35 | @override | 15 | @override |
36 | Widget build(BuildContext context) { | 16 | Widget build(BuildContext context) { |
37 | - return GetMaterialApp( | ||
38 | - getPages: [ | ||
39 | - GetPage( | ||
40 | - participatesInRootNavigator: true, | ||
41 | - name: '/first', | ||
42 | - page: () => const First()), | ||
43 | - GetPage( | ||
44 | - name: '/second', | ||
45 | - page: () => const Second(), | ||
46 | - transition: Transition.downToUp, | ||
47 | - ), | ||
48 | - GetPage( | ||
49 | - name: '/third', | ||
50 | - page: () => const Third(), | ||
51 | - ), | ||
52 | - ], | 17 | + return GetMaterialApp.router( |
53 | debugShowCheckedModeBanner: false, | 18 | debugShowCheckedModeBanner: false, |
19 | + enableLog: true, | ||
20 | + logWriterCallback: Logger.write, | ||
21 | + // initialRoute: AppPages.INITIAL, | ||
22 | + getPages: AppPages.routes, | ||
23 | + locale: TranslationService.locale, | ||
24 | + fallbackLocale: TranslationService.fallbackLocale, | ||
25 | + translations: TranslationService(), | ||
54 | ); | 26 | ); |
55 | } | 27 | } |
56 | } | 28 | } |
57 | 29 | ||
58 | -class FirstController extends GetxController { | ||
59 | - @override | ||
60 | - void onClose() { | ||
61 | - print('on close first'); | ||
62 | - super.onClose(); | ||
63 | - } | ||
64 | -} | ||
65 | - | ||
66 | -class First extends StatelessWidget { | ||
67 | - const First({Key? key}) : super(key: key); | ||
68 | - | ||
69 | - @override | ||
70 | - Widget build(BuildContext context) { | ||
71 | - print('First rebuild'); | ||
72 | - Get.put(FirstController()); | ||
73 | - return Scaffold( | ||
74 | - appBar: AppBar( | ||
75 | - title: const Text('page one'), | ||
76 | - leading: IconButton( | ||
77 | - icon: const Icon(Icons.more), | ||
78 | - onPressed: () { | ||
79 | - Get.snackbar( | ||
80 | - 'title', | ||
81 | - "message", | ||
82 | - mainButton: | ||
83 | - TextButton(onPressed: () {}, child: const Text('button')), | ||
84 | - isDismissible: true, | ||
85 | - duration: Duration(seconds: 5), | ||
86 | - snackbarStatus: (status) => print(status), | ||
87 | - ); | ||
88 | - // print('THEME CHANGED'); | ||
89 | - // Get.changeTheme( | ||
90 | - // Get.isDarkMode ? ThemeData.light() : ThemeData.dark()); | ||
91 | - }, | ||
92 | - ), | ||
93 | - ), | ||
94 | - body: Center( | ||
95 | - child: SizedBox( | ||
96 | - height: 300, | ||
97 | - width: 300, | ||
98 | - child: ElevatedButton( | ||
99 | - onPressed: () { | ||
100 | - Get.toNamed('/second?id=123'); | ||
101 | - }, | ||
102 | - child: const Text('next screen'), | ||
103 | - ), | ||
104 | - ), | ||
105 | - ), | ||
106 | - ); | ||
107 | - } | ||
108 | -} | 30 | +/// Nav 2 snippet |
31 | +// void main() { | ||
32 | +// runApp(MyApp()); | ||
33 | +// } | ||
109 | 34 | ||
110 | -class SecondController extends GetxController { | ||
111 | - final textEdit = TextEditingController(); | ||
112 | - @override | ||
113 | - void onClose() { | ||
114 | - print('on close second'); | ||
115 | - textEdit.dispose(); | ||
116 | - super.onClose(); | ||
117 | - } | ||
118 | -} | 35 | +// class MyApp extends StatelessWidget { |
36 | +// MyApp({Key? key}) : super(key: key); | ||
119 | 37 | ||
120 | -class Second extends StatelessWidget { | ||
121 | - const Second({Key? key}) : super(key: key); | 38 | +// @override |
39 | +// Widget build(BuildContext context) { | ||
40 | +// return GetMaterialApp.router( | ||
41 | +// getPages: [ | ||
42 | +// GetPage( | ||
43 | +// participatesInRootNavigator: true, | ||
44 | +// name: '/first', | ||
45 | +// page: () => First()), | ||
46 | +// GetPage( | ||
47 | +// name: '/second', | ||
48 | +// page: () => Second(), | ||
49 | +// ), | ||
50 | +// GetPage( | ||
51 | +// name: '/third', | ||
52 | +// page: () => Third(), | ||
53 | +// ), | ||
54 | +// ], | ||
55 | +// debugShowCheckedModeBanner: false, | ||
56 | +// ); | ||
57 | +// } | ||
58 | +// } | ||
122 | 59 | ||
123 | - @override | ||
124 | - Widget build(BuildContext context) { | ||
125 | - final controller = Get.put(SecondController()); | ||
126 | - print('second rebuild'); | ||
127 | - return Scaffold( | ||
128 | - appBar: AppBar( | ||
129 | - title: Text('page two ${Get.parameters["id"]}'), | ||
130 | - ), | ||
131 | - body: Center( | ||
132 | - child: Column( | ||
133 | - children: [ | ||
134 | - Expanded( | ||
135 | - child: TextField( | ||
136 | - controller: controller.textEdit, | ||
137 | - )), | ||
138 | - SizedBox( | ||
139 | - height: 300, | ||
140 | - width: 300, | ||
141 | - child: ElevatedButton( | ||
142 | - onPressed: () {}, | ||
143 | - child: const Text('next screen'), | ||
144 | - ), | ||
145 | - ), | ||
146 | - ], | ||
147 | - ), | ||
148 | - ), | ||
149 | - ); | ||
150 | - } | ||
151 | -} | 60 | +// class First extends StatelessWidget { |
61 | +// @override | ||
62 | +// Widget build(BuildContext context) { | ||
63 | +// return Scaffold( | ||
64 | +// appBar: AppBar( | ||
65 | +// title: Text('page one'), | ||
66 | +// leading: IconButton( | ||
67 | +// icon: Icon(Icons.more), | ||
68 | +// onPressed: () { | ||
69 | +// Get.changeTheme( | ||
70 | +// context.isDarkMode ? ThemeData.light() : ThemeData.dark()); | ||
71 | +// }, | ||
72 | +// ), | ||
73 | +// ), | ||
74 | +// body: Center( | ||
75 | +// child: Container( | ||
76 | +// height: 300, | ||
77 | +// width: 300, | ||
78 | +// child: ElevatedButton( | ||
79 | +// onPressed: () {}, | ||
80 | +// child: Text('next screen'), | ||
81 | +// ), | ||
82 | +// ), | ||
83 | +// ), | ||
84 | +// ); | ||
85 | +// } | ||
86 | +// } | ||
152 | 87 | ||
153 | -class Third extends StatelessWidget { | ||
154 | - const Third({Key? key}) : super(key: key); | 88 | +// class Second extends StatelessWidget { |
89 | +// @override | ||
90 | +// Widget build(BuildContext context) { | ||
91 | +// return Scaffold( | ||
92 | +// appBar: AppBar( | ||
93 | +// title: Text('page two ${Get.parameters["id"]}'), | ||
94 | +// ), | ||
95 | +// body: Center( | ||
96 | +// child: Container( | ||
97 | +// height: 300, | ||
98 | +// width: 300, | ||
99 | +// child: ElevatedButton( | ||
100 | +// onPressed: () {}, | ||
101 | +// child: Text('next screen'), | ||
102 | +// ), | ||
103 | +// ), | ||
104 | +// ), | ||
105 | +// ); | ||
106 | +// } | ||
107 | +// } | ||
155 | 108 | ||
156 | - @override | ||
157 | - Widget build(BuildContext context) { | ||
158 | - return Scaffold( | ||
159 | - backgroundColor: Colors.red, | ||
160 | - appBar: AppBar( | ||
161 | - title: const Text('page three'), | ||
162 | - ), | ||
163 | - body: Center( | ||
164 | - child: SizedBox( | ||
165 | - height: 300, | ||
166 | - width: 300, | ||
167 | - child: ElevatedButton( | ||
168 | - onPressed: () {}, | ||
169 | - child: const Text('go to first screen'), | ||
170 | - ), | ||
171 | - ), | ||
172 | - ), | ||
173 | - ); | ||
174 | - } | ||
175 | -} | 109 | +// class Third extends StatelessWidget { |
110 | +// @override | ||
111 | +// Widget build(BuildContext context) { | ||
112 | +// return Scaffold( | ||
113 | +// backgroundColor: Colors.red, | ||
114 | +// appBar: AppBar( | ||
115 | +// title: Text('page three'), | ||
116 | +// ), | ||
117 | +// body: Center( | ||
118 | +// child: Container( | ||
119 | +// height: 300, | ||
120 | +// width: 300, | ||
121 | +// child: ElevatedButton( | ||
122 | +// onPressed: () {}, | ||
123 | +// child: Text('go to first screen'), | ||
124 | +// ), | ||
125 | +// ), | ||
126 | +// ), | ||
127 | +// ); | ||
128 | +// } | ||
129 | +// } |
1 | import 'package:get/get.dart'; | 1 | import 'package:get/get.dart'; |
2 | - | ||
3 | import '../data/home_api_provider.dart'; | 2 | import '../data/home_api_provider.dart'; |
3 | + | ||
4 | import '../data/home_repository.dart'; | 4 | import '../data/home_repository.dart'; |
5 | import '../domain/adapters/repository_adapter.dart'; | 5 | import '../domain/adapters/repository_adapter.dart'; |
6 | import '../presentation/controllers/home_controller.dart'; | 6 | import '../presentation/controllers/home_controller.dart'; |
7 | 7 | ||
8 | -class HomeBinding extends Binding { | 8 | +class HomeBinding extends Bindings { |
9 | @override | 9 | @override |
10 | - List<Bind> dependencies() { | ||
11 | - return [ | ||
12 | - Bind.lazyPut<IHomeProvider>(() => HomeProvider()), | ||
13 | - Bind.lazyPut<IHomeRepository>(() => HomeRepository(provider: Get.find())), | ||
14 | - Bind.lazyPut(() => HomeController(homeRepository: Get.find())), | ||
15 | - ]; | 10 | + void dependencies() { |
11 | + Get.lazyPut<IHomeProvider>(() => HomeProvider()); | ||
12 | + Get.lazyPut<IHomeRepository>(() => HomeRepository(provider: Get.find())); | ||
13 | + Get.lazyPut(() => HomeController(homeRepository: Get.find())); | ||
16 | } | 14 | } |
17 | } | 15 | } |
1 | import 'package:get/get.dart'; | 1 | import 'package:get/get.dart'; |
2 | - | ||
3 | import '../domain/entity/cases_model.dart'; | 2 | import '../domain/entity/cases_model.dart'; |
4 | 3 | ||
5 | // ignore: one_member_abstracts | 4 | // ignore: one_member_abstracts |
@@ -13,7 +12,6 @@ class HomeProvider extends GetConnect implements IHomeProvider { | @@ -13,7 +12,6 @@ class HomeProvider extends GetConnect implements IHomeProvider { | ||
13 | httpClient.defaultDecoder = | 12 | httpClient.defaultDecoder = |
14 | (val) => CasesModel.fromJson(val as Map<String, dynamic>); | 13 | (val) => CasesModel.fromJson(val as Map<String, dynamic>); |
15 | httpClient.baseUrl = 'https://api.covid19api.com'; | 14 | httpClient.baseUrl = 'https://api.covid19api.com'; |
16 | - super.onInit(); | ||
17 | } | 15 | } |
18 | 16 | ||
19 | @override | 17 | @override |
@@ -6,12 +6,14 @@ import 'dart:convert'; | @@ -6,12 +6,14 @@ import 'dart:convert'; | ||
6 | 6 | ||
7 | class CasesModel { | 7 | class CasesModel { |
8 | CasesModel({ | 8 | CasesModel({ |
9 | + required this.id, | ||
9 | required this.message, | 10 | required this.message, |
10 | required this.global, | 11 | required this.global, |
11 | required this.countries, | 12 | required this.countries, |
12 | required this.date, | 13 | required this.date, |
13 | }); | 14 | }); |
14 | 15 | ||
16 | + final String id; | ||
15 | final String message; | 17 | final String message; |
16 | final Global global; | 18 | final Global global; |
17 | final List<Country> countries; | 19 | final List<Country> countries; |
@@ -23,17 +25,17 @@ class CasesModel { | @@ -23,17 +25,17 @@ class CasesModel { | ||
23 | String toRawJson() => json.encode(toJson()); | 25 | String toRawJson() => json.encode(toJson()); |
24 | 26 | ||
25 | factory CasesModel.fromJson(Map<String, dynamic> json) => CasesModel( | 27 | factory CasesModel.fromJson(Map<String, dynamic> json) => CasesModel( |
28 | + id: json["ID"] as String, | ||
26 | message: json["Message"] as String, | 29 | message: json["Message"] as String, |
27 | global: Global.fromJson(json["Global"] as Map<String, dynamic>), | 30 | global: Global.fromJson(json["Global"] as Map<String, dynamic>), |
28 | - countries: json["Countries"] == null | ||
29 | - ? [] | ||
30 | - : List<Country>.from((json["Countries"] as Iterable).map( | 31 | + countries: List<Country>.from((json["Countries"] as Iterable).map( |
31 | (x) => Country.fromJson(x as Map<String, dynamic>), | 32 | (x) => Country.fromJson(x as Map<String, dynamic>), |
32 | )), | 33 | )), |
33 | date: DateTime.parse(json["Date"] as String), | 34 | date: DateTime.parse(json["Date"] as String), |
34 | ); | 35 | ); |
35 | 36 | ||
36 | Map<String, dynamic> toJson() => { | 37 | Map<String, dynamic> toJson() => { |
38 | + "ID": id, | ||
37 | "Message": message, | 39 | "Message": message, |
38 | "Global": global.toJson(), | 40 | "Global": global.toJson(), |
39 | "Countries": List<dynamic>.from(countries.map((x) => x.toJson())), | 41 | "Countries": List<dynamic>.from(countries.map((x) => x.toJson())), |
@@ -3,7 +3,7 @@ import 'package:get/get.dart'; | @@ -3,7 +3,7 @@ import 'package:get/get.dart'; | ||
3 | import '../../domain/adapters/repository_adapter.dart'; | 3 | import '../../domain/adapters/repository_adapter.dart'; |
4 | import '../../domain/entity/cases_model.dart'; | 4 | import '../../domain/entity/cases_model.dart'; |
5 | 5 | ||
6 | -class HomeController extends StateController<CasesModel> { | 6 | +class HomeController extends SuperController<CasesModel> { |
7 | HomeController({required this.homeRepository}); | 7 | HomeController({required this.homeRepository}); |
8 | 8 | ||
9 | final IHomeRepository homeRepository; | 9 | final IHomeRepository homeRepository; |
@@ -11,12 +11,74 @@ class HomeController extends StateController<CasesModel> { | @@ -11,12 +11,74 @@ class HomeController extends StateController<CasesModel> { | ||
11 | @override | 11 | @override |
12 | void onInit() { | 12 | void onInit() { |
13 | super.onInit(); | 13 | super.onInit(); |
14 | + | ||
14 | //Loading, Success, Error handle with 1 line of code | 15 | //Loading, Success, Error handle with 1 line of code |
15 | - futurize(homeRepository.getCases); | 16 | + append(() => homeRepository.getCases); |
16 | } | 17 | } |
17 | 18 | ||
18 | Country getCountryById(String id) { | 19 | Country getCountryById(String id) { |
19 | final index = int.tryParse(id); | 20 | final index = int.tryParse(id); |
20 | - return index != null ? state.countries[index] : state.countries.first; | 21 | + if (index != null) { |
22 | + return state!.countries[index]; | ||
23 | + } | ||
24 | + | ||
25 | + return state!.countries.first; | ||
26 | + } | ||
27 | + | ||
28 | + @override | ||
29 | + void onReady() { | ||
30 | + print('The build method is done. ' | ||
31 | + 'Your controller is ready to call dialogs and snackbars'); | ||
32 | + super.onReady(); | ||
33 | + } | ||
34 | + | ||
35 | + @override | ||
36 | + void onClose() { | ||
37 | + print('onClose called'); | ||
38 | + super.onClose(); | ||
39 | + } | ||
40 | + | ||
41 | + @override | ||
42 | + void didChangeMetrics() { | ||
43 | + print('the window size did change'); | ||
44 | + super.didChangeMetrics(); | ||
45 | + } | ||
46 | + | ||
47 | + @override | ||
48 | + void didChangePlatformBrightness() { | ||
49 | + print('platform change ThemeMode'); | ||
50 | + super.didChangePlatformBrightness(); | ||
51 | + } | ||
52 | + | ||
53 | + @override | ||
54 | + Future<bool> didPushRoute(String route) { | ||
55 | + print('the route $route will be open'); | ||
56 | + return super.didPushRoute(route); | ||
57 | + } | ||
58 | + | ||
59 | + @override | ||
60 | + Future<bool> didPopRoute() { | ||
61 | + print('the current route will be closed'); | ||
62 | + return super.didPopRoute(); | ||
63 | + } | ||
64 | + | ||
65 | + @override | ||
66 | + void onDetached() { | ||
67 | + print('onDetached called'); | ||
68 | + } | ||
69 | + | ||
70 | + @override | ||
71 | + void onInactive() { | ||
72 | + print('onInative called'); | ||
73 | + } | ||
74 | + | ||
75 | + @override | ||
76 | + void onPaused() { | ||
77 | + print('onPaused called'); | ||
78 | + } | ||
79 | + | ||
80 | + @override | ||
81 | + void onResumed() { | ||
82 | + print('onResumed called'); | ||
21 | } | 83 | } |
22 | } | 84 | } |
@@ -6,11 +6,10 @@ import 'package:get/get.dart'; | @@ -6,11 +6,10 @@ import 'package:get/get.dart'; | ||
6 | import '../controllers/home_controller.dart'; | 6 | import '../controllers/home_controller.dart'; |
7 | 7 | ||
8 | class CountryView extends GetView<HomeController> { | 8 | class CountryView extends GetView<HomeController> { |
9 | - const CountryView({Key? key}) : super(key: key); | ||
10 | @override | 9 | @override |
11 | Widget build(BuildContext context) { | 10 | Widget build(BuildContext context) { |
12 | return Container( | 11 | return Container( |
13 | - decoration: const BoxDecoration( | 12 | + decoration: BoxDecoration( |
14 | image: DecorationImage( | 13 | image: DecorationImage( |
15 | fit: BoxFit.cover, | 14 | fit: BoxFit.cover, |
16 | colorFilter: ColorFilter.linearToSrgbGamma(), | 15 | colorFilter: ColorFilter.linearToSrgbGamma(), |
@@ -18,6 +17,7 @@ class CountryView extends GetView<HomeController> { | @@ -18,6 +17,7 @@ class CountryView extends GetView<HomeController> { | ||
18 | "https://images.pexels.com/photos/3902882/pexels-photo-3902882.jpeg?auto=compress&cs=tinysrgb&dpr=2&h=650&w=940"))), | 17 | "https://images.pexels.com/photos/3902882/pexels-photo-3902882.jpeg?auto=compress&cs=tinysrgb&dpr=2&h=650&w=940"))), |
19 | child: BackdropFilter( | 18 | child: BackdropFilter( |
20 | filter: ImageFilter.blur(sigmaX: 15.0, sigmaY: 15.0), | 19 | filter: ImageFilter.blur(sigmaX: 15.0, sigmaY: 15.0), |
20 | + child: Container( | ||
21 | child: Scaffold( | 21 | child: Scaffold( |
22 | backgroundColor: Colors.transparent, | 22 | backgroundColor: Colors.transparent, |
23 | appBar: AppBar( | 23 | appBar: AppBar( |
@@ -28,15 +28,14 @@ class CountryView extends GetView<HomeController> { | @@ -28,15 +28,14 @@ class CountryView extends GetView<HomeController> { | ||
28 | ), | 28 | ), |
29 | body: Center( | 29 | body: Center( |
30 | child: ListView.builder( | 30 | child: ListView.builder( |
31 | - itemCount: controller.state.countries.length, | 31 | + itemCount: controller.state!.countries.length, |
32 | itemBuilder: (context, index) { | 32 | itemBuilder: (context, index) { |
33 | - final country = controller.state.countries[index]; | 33 | + final country = controller.state!.countries[index]; |
34 | return ListTile( | 34 | return ListTile( |
35 | - onTap: () async { | 35 | + onTap: () { |
36 | //Get.rootDelegate.toNamed('/home/country'); | 36 | //Get.rootDelegate.toNamed('/home/country'); |
37 | - final data = | ||
38 | - await Get.toNamed('/home/country/details?id=$index'); | ||
39 | - Get.log(data); | 37 | + Get.rootDelegate |
38 | + .toNamed('/home/country/details?id=$index'); | ||
40 | }, | 39 | }, |
41 | trailing: CircleAvatar( | 40 | trailing: CircleAvatar( |
42 | backgroundImage: NetworkImage( | 41 | backgroundImage: NetworkImage( |
@@ -51,6 +50,7 @@ class CountryView extends GetView<HomeController> { | @@ -51,6 +50,7 @@ class CountryView extends GetView<HomeController> { | ||
51 | ), | 50 | ), |
52 | ), | 51 | ), |
53 | ), | 52 | ), |
53 | + ), | ||
54 | ); | 54 | ); |
55 | } | 55 | } |
56 | } | 56 | } |
@@ -2,26 +2,25 @@ import 'dart:ui'; | @@ -2,26 +2,25 @@ import 'dart:ui'; | ||
2 | 2 | ||
3 | import 'package:flutter/material.dart'; | 3 | import 'package:flutter/material.dart'; |
4 | import 'package:get/get.dart'; | 4 | import 'package:get/get.dart'; |
5 | - | ||
6 | import '../controllers/home_controller.dart'; | 5 | import '../controllers/home_controller.dart'; |
7 | 6 | ||
8 | class DetailsView extends GetView<HomeController> { | 7 | class DetailsView extends GetView<HomeController> { |
9 | - const DetailsView({Key? key}) : super(key: key); | ||
10 | @override | 8 | @override |
11 | Widget build(BuildContext context) { | 9 | Widget build(BuildContext context) { |
12 | - final parameter = context.params; //Get.parameters; | 10 | + final parameter = Get.rootDelegate.parameters; |
13 | final country = controller.getCountryById(parameter['id'] ?? ''); | 11 | final country = controller.getCountryById(parameter['id'] ?? ''); |
14 | return Container( | 12 | return Container( |
15 | decoration: BoxDecoration( | 13 | decoration: BoxDecoration( |
16 | image: DecorationImage( | 14 | image: DecorationImage( |
17 | fit: BoxFit.cover, | 15 | fit: BoxFit.cover, |
18 | - colorFilter: const ColorFilter.linearToSrgbGamma(), | 16 | + colorFilter: ColorFilter.linearToSrgbGamma(), |
19 | image: NetworkImage( | 17 | image: NetworkImage( |
20 | "https://flagpedia.net/data/flags/normal/${country.countryCode.toLowerCase()}.png"), | 18 | "https://flagpedia.net/data/flags/normal/${country.countryCode.toLowerCase()}.png"), |
21 | ), | 19 | ), |
22 | ), | 20 | ), |
23 | child: BackdropFilter( | 21 | child: BackdropFilter( |
24 | filter: ImageFilter.blur(sigmaX: 15.0, sigmaY: 15.0), | 22 | filter: ImageFilter.blur(sigmaX: 15.0, sigmaY: 15.0), |
23 | + child: Container( | ||
25 | child: Scaffold( | 24 | child: Scaffold( |
26 | backgroundColor: Colors.transparent, | 25 | backgroundColor: Colors.transparent, |
27 | appBar: AppBar( | 26 | appBar: AppBar( |
@@ -35,61 +34,53 @@ class DetailsView extends GetView<HomeController> { | @@ -35,61 +34,53 @@ class DetailsView extends GetView<HomeController> { | ||
35 | mainAxisAlignment: MainAxisAlignment.center, | 34 | mainAxisAlignment: MainAxisAlignment.center, |
36 | children: [ | 35 | children: [ |
37 | Text( | 36 | Text( |
38 | - country.country, | ||
39 | - style: | ||
40 | - const TextStyle(fontSize: 45, fontWeight: FontWeight.bold), | 37 | + '${country.country}', |
38 | + style: TextStyle(fontSize: 45, fontWeight: FontWeight.bold), | ||
41 | ), | 39 | ), |
42 | - const SizedBox( | 40 | + SizedBox( |
43 | height: 35, | 41 | height: 35, |
44 | ), | 42 | ), |
45 | Text( | 43 | Text( |
46 | 'total_confirmed'.tr, | 44 | 'total_confirmed'.tr, |
47 | - style: const TextStyle( | 45 | + style: TextStyle( |
48 | fontSize: 25, | 46 | fontSize: 25, |
49 | ), | 47 | ), |
50 | ), | 48 | ), |
51 | Text( | 49 | Text( |
52 | '${country.totalConfirmed}', | 50 | '${country.totalConfirmed}', |
53 | - style: | ||
54 | - const TextStyle(fontSize: 35, fontWeight: FontWeight.bold), | 51 | + style: TextStyle(fontSize: 35, fontWeight: FontWeight.bold), |
55 | ), | 52 | ), |
56 | - const SizedBox( | 53 | + SizedBox( |
57 | height: 10, | 54 | height: 10, |
58 | ), | 55 | ), |
59 | Text( | 56 | Text( |
60 | 'total_deaths'.tr, | 57 | 'total_deaths'.tr, |
61 | - style: const TextStyle( | 58 | + style: TextStyle( |
62 | fontSize: 25, | 59 | fontSize: 25, |
63 | ), | 60 | ), |
64 | ), | 61 | ), |
65 | Text( | 62 | Text( |
66 | '${country.totalDeaths}', | 63 | '${country.totalDeaths}', |
67 | - style: | ||
68 | - const TextStyle(fontSize: 35, fontWeight: FontWeight.bold), | 64 | + style: TextStyle(fontSize: 35, fontWeight: FontWeight.bold), |
69 | ), | 65 | ), |
70 | - const SizedBox( | 66 | + SizedBox( |
71 | height: 10, | 67 | height: 10, |
72 | ), | 68 | ), |
73 | Text( | 69 | Text( |
74 | 'total_recovered'.tr, | 70 | 'total_recovered'.tr, |
75 | - style: const TextStyle( | 71 | + style: TextStyle( |
76 | fontSize: 25, | 72 | fontSize: 25, |
77 | ), | 73 | ), |
78 | ), | 74 | ), |
79 | Text( | 75 | Text( |
80 | '${country.totalRecovered}', | 76 | '${country.totalRecovered}', |
81 | - style: | ||
82 | - const TextStyle(fontSize: 35, fontWeight: FontWeight.bold), | ||
83 | - ), | ||
84 | - TextButton( | ||
85 | - onPressed: () { | ||
86 | - Get.back(result: 'djsoidjsoidj'); | ||
87 | - }, | ||
88 | - child: const Text('back')) | 77 | + style: TextStyle(fontSize: 35, fontWeight: FontWeight.bold), |
78 | + ), | ||
89 | ], | 79 | ], |
90 | )), | 80 | )), |
91 | ), | 81 | ), |
92 | ), | 82 | ), |
83 | + ), | ||
93 | ); | 84 | ); |
94 | } | 85 | } |
95 | } | 86 | } |
@@ -4,12 +4,10 @@ import 'package:get/get.dart'; | @@ -4,12 +4,10 @@ import 'package:get/get.dart'; | ||
4 | import '../controllers/home_controller.dart'; | 4 | import '../controllers/home_controller.dart'; |
5 | 5 | ||
6 | class HomeView extends GetView<HomeController> { | 6 | class HomeView extends GetView<HomeController> { |
7 | - const HomeView({Key? key}) : super(key: key); | ||
8 | - | ||
9 | @override | 7 | @override |
10 | Widget build(BuildContext context) { | 8 | Widget build(BuildContext context) { |
11 | return Container( | 9 | return Container( |
12 | - decoration: const BoxDecoration( | 10 | + decoration: BoxDecoration( |
13 | color: Colors.white, | 11 | color: Colors.white, |
14 | image: DecorationImage( | 12 | image: DecorationImage( |
15 | fit: BoxFit.cover, | 13 | fit: BoxFit.cover, |
@@ -22,7 +20,7 @@ class HomeView extends GetView<HomeController> { | @@ -22,7 +20,7 @@ class HomeView extends GetView<HomeController> { | ||
22 | backgroundColor: Colors.transparent, | 20 | backgroundColor: Colors.transparent, |
23 | appBar: AppBar( | 21 | appBar: AppBar( |
24 | leading: IconButton( | 22 | leading: IconButton( |
25 | - icon: const Icon(Icons.add), | 23 | + icon: Icon(Icons.add), |
26 | onPressed: () { | 24 | onPressed: () { |
27 | Get.snackbar('title', 'message'); | 25 | Get.snackbar('title', 'message'); |
28 | }, | 26 | }, |
@@ -38,53 +36,52 @@ class HomeView extends GetView<HomeController> { | @@ -38,53 +36,52 @@ class HomeView extends GetView<HomeController> { | ||
38 | return Column( | 36 | return Column( |
39 | mainAxisAlignment: MainAxisAlignment.center, | 37 | mainAxisAlignment: MainAxisAlignment.center, |
40 | children: [ | 38 | children: [ |
41 | - const SizedBox( | 39 | + SizedBox( |
42 | height: 100, | 40 | height: 100, |
43 | ), | 41 | ), |
44 | Text( | 42 | Text( |
45 | 'total_confirmed'.tr, | 43 | 'total_confirmed'.tr, |
46 | - style: const TextStyle( | 44 | + style: TextStyle( |
47 | fontSize: 30, | 45 | fontSize: 30, |
48 | ), | 46 | ), |
49 | ), | 47 | ), |
50 | Text( | 48 | Text( |
51 | '${state!.global.totalConfirmed}', | 49 | '${state!.global.totalConfirmed}', |
52 | - style: const TextStyle( | ||
53 | - fontSize: 45, fontWeight: FontWeight.bold), | 50 | + style: TextStyle(fontSize: 45, fontWeight: FontWeight.bold), |
54 | ), | 51 | ), |
55 | - const SizedBox( | 52 | + SizedBox( |
56 | height: 10, | 53 | height: 10, |
57 | ), | 54 | ), |
58 | Text( | 55 | Text( |
59 | 'total_deaths'.tr, | 56 | 'total_deaths'.tr, |
60 | - style: const TextStyle( | 57 | + style: TextStyle( |
61 | fontSize: 30, | 58 | fontSize: 30, |
62 | ), | 59 | ), |
63 | ), | 60 | ), |
64 | Text( | 61 | Text( |
65 | '${state.global.totalDeaths}', | 62 | '${state.global.totalDeaths}', |
66 | - style: const TextStyle( | ||
67 | - fontSize: 45, fontWeight: FontWeight.bold), | 63 | + style: TextStyle(fontSize: 45, fontWeight: FontWeight.bold), |
68 | ), | 64 | ), |
69 | - const SizedBox( | 65 | + SizedBox( |
70 | height: 10, | 66 | height: 10, |
71 | ), | 67 | ), |
72 | OutlinedButton( | 68 | OutlinedButton( |
73 | style: OutlinedButton.styleFrom( | 69 | style: OutlinedButton.styleFrom( |
74 | - textStyle: const TextStyle(color: Colors.black), | ||
75 | - side: const BorderSide( | 70 | + textStyle: TextStyle(color: Colors.black), |
71 | + side: BorderSide( | ||
76 | color: Colors.deepPurple, | 72 | color: Colors.deepPurple, |
77 | width: 3, | 73 | width: 3, |
78 | ), | 74 | ), |
79 | - shape: const StadiumBorder(), | 75 | + shape: StadiumBorder(), |
80 | ), | 76 | ), |
81 | onPressed: () async { | 77 | onPressed: () async { |
82 | - //await Navigation Get.rootDelegate.toNamed('/home/country'); | ||
83 | - Get.toNamed('/home/country'); | 78 | + final data = |
79 | + await Get.rootDelegate.toNamed('/home/country'); | ||
80 | + print('DATA: $data'); | ||
84 | }, | 81 | }, |
85 | child: Text( | 82 | child: Text( |
86 | 'fetch_country'.tr, | 83 | 'fetch_country'.tr, |
87 | - style: const TextStyle( | 84 | + style: TextStyle( |
88 | fontWeight: FontWeight.bold, | 85 | fontWeight: FontWeight.bold, |
89 | color: Colors.black, | 86 | color: Colors.black, |
90 | ), | 87 | ), |
@@ -92,17 +89,17 @@ class HomeView extends GetView<HomeController> { | @@ -92,17 +89,17 @@ class HomeView extends GetView<HomeController> { | ||
92 | ), | 89 | ), |
93 | OutlinedButton( | 90 | OutlinedButton( |
94 | style: OutlinedButton.styleFrom( | 91 | style: OutlinedButton.styleFrom( |
95 | - textStyle: const TextStyle(color: Colors.black), | ||
96 | - side: const BorderSide( | 92 | + textStyle: TextStyle(color: Colors.black), |
93 | + side: BorderSide( | ||
97 | color: Colors.deepPurple, | 94 | color: Colors.deepPurple, |
98 | width: 3, | 95 | width: 3, |
99 | ), | 96 | ), |
100 | - shape: const StadiumBorder(), | 97 | + shape: StadiumBorder(), |
101 | ), | 98 | ), |
102 | onPressed: () { | 99 | onPressed: () { |
103 | - Get.updateLocale(const Locale('pt', 'BR')); | 100 | + Get.updateLocale(Locale('pt', 'BR')); |
104 | }, | 101 | }, |
105 | - child: const Text( | 102 | + child: Text( |
106 | 'Update language to Portuguese', | 103 | 'Update language to Portuguese', |
107 | style: TextStyle( | 104 | style: TextStyle( |
108 | fontWeight: FontWeight.bold, | 105 | fontWeight: FontWeight.bold, |
@@ -14,20 +14,19 @@ class AppPages { | @@ -14,20 +14,19 @@ class AppPages { | ||
14 | static final routes = [ | 14 | static final routes = [ |
15 | GetPage( | 15 | GetPage( |
16 | name: Routes.HOME, | 16 | name: Routes.HOME, |
17 | - page: () => const HomeView(), | 17 | + page: () => HomeView(), |
18 | binding: HomeBinding(), | 18 | binding: HomeBinding(), |
19 | children: [ | 19 | children: [ |
20 | GetPage( | 20 | GetPage( |
21 | name: Routes.COUNTRY, | 21 | name: Routes.COUNTRY, |
22 | - page: () => const CountryView(), | 22 | + page: () => CountryView(), |
23 | children: [ | 23 | children: [ |
24 | GetPage( | 24 | GetPage( |
25 | name: Routes.DETAILS, | 25 | name: Routes.DETAILS, |
26 | - page: () => const DetailsView(), | ||
27 | - ), | ||
28 | - ], | 26 | + page: () => DetailsView(), |
29 | ), | 27 | ), |
30 | ], | 28 | ], |
31 | ), | 29 | ), |
30 | + ]), | ||
32 | ]; | 31 | ]; |
33 | } | 32 | } |
@@ -4,8 +4,4 @@ abstract class Routes { | @@ -4,8 +4,4 @@ abstract class Routes { | ||
4 | static const HOME = '/home'; | 4 | static const HOME = '/home'; |
5 | static const COUNTRY = '/country'; | 5 | static const COUNTRY = '/country'; |
6 | static const DETAILS = '/details'; | 6 | static const DETAILS = '/details'; |
7 | - | ||
8 | - static const DASHBOARD = '/dashboard'; | ||
9 | - static const PROFILE = '/profile'; | ||
10 | - static const PRODUCTS = '/products'; | ||
11 | } | 7 | } |
1 | mixin Logger { | 1 | mixin Logger { |
2 | // Sample of abstract logging function | 2 | // Sample of abstract logging function |
3 | static void write(String text, {bool isError = false}) { | 3 | static void write(String text, {bool isError = false}) { |
4 | - // ignore: avoid_print | ||
5 | Future.microtask(() => print('** $text. isError: [$isError]')); | 4 | Future.microtask(() => print('** $text. isError: [$isError]')); |
6 | } | 5 | } |
7 | } | 6 | } |
@@ -18,11 +18,7 @@ publish_to: "none" # Remove this line if you wish to publish to pub.dev | @@ -18,11 +18,7 @@ publish_to: "none" # Remove this line if you wish to publish to pub.dev | ||
18 | version: 1.0.0+1 | 18 | version: 1.0.0+1 |
19 | 19 | ||
20 | environment: | 20 | environment: |
21 | - sdk: ">=3.0.1 <4.0.0" | ||
22 | - | ||
23 | -dependency_overrides: | ||
24 | - get: | ||
25 | - path: ../ | 21 | + sdk: ">=2.12.0 <3.0.0" |
26 | 22 | ||
27 | dependencies: | 23 | dependencies: |
28 | flutter: | 24 | flutter: |
@@ -37,8 +33,6 @@ dependencies: | @@ -37,8 +33,6 @@ dependencies: | ||
37 | dev_dependencies: | 33 | dev_dependencies: |
38 | flutter_test: | 34 | flutter_test: |
39 | sdk: flutter | 35 | sdk: flutter |
40 | - get_test: 4.0.1 | ||
41 | - flutter_lints: ^2.0.1 | ||
42 | 36 | ||
43 | # For information on the generic Dart part of this file, see the | 37 | # For information on the generic Dart part of this file, see the |
44 | # following page: https://dart.dev/tools/pub/pubspec | 38 | # following page: https://dart.dev/tools/pub/pubspec |
1 | import 'dart:io'; | 1 | import 'dart:io'; |
2 | - | 2 | +import 'dart:math'; |
3 | import 'package:flutter/material.dart'; | 3 | import 'package:flutter/material.dart'; |
4 | import 'package:flutter_test/flutter_test.dart'; | 4 | import 'package:flutter_test/flutter_test.dart'; |
5 | import 'package:get/get.dart'; | 5 | import 'package:get/get.dart'; |
@@ -8,10 +8,14 @@ import 'package:get_demo/pages/home/domain/entity/cases_model.dart'; | @@ -8,10 +8,14 @@ import 'package:get_demo/pages/home/domain/entity/cases_model.dart'; | ||
8 | import 'package:get_demo/pages/home/presentation/controllers/home_controller.dart'; | 8 | import 'package:get_demo/pages/home/presentation/controllers/home_controller.dart'; |
9 | // import 'package:get_demo/routes/app_pages.dart'; | 9 | // import 'package:get_demo/routes/app_pages.dart'; |
10 | // import 'package:get_test/get_test.dart'; | 10 | // import 'package:get_test/get_test.dart'; |
11 | +import 'package:matcher/matcher.dart' as m; | ||
11 | 12 | ||
12 | -class MockRepositorySuccess implements IHomeRepository { | 13 | +class MockRepository implements IHomeRepository { |
13 | @override | 14 | @override |
14 | Future<CasesModel> getCases() async { | 15 | Future<CasesModel> getCases() async { |
16 | + await Future.delayed(Duration(milliseconds: 100)); | ||
17 | + | ||
18 | + if (Random().nextBool()) { | ||
15 | return CasesModel( | 19 | return CasesModel( |
16 | global: Global( | 20 | global: Global( |
17 | totalDeaths: 100, | 21 | totalDeaths: 100, |
@@ -23,42 +27,42 @@ class MockRepositorySuccess implements IHomeRepository { | @@ -23,42 +27,42 @@ class MockRepositorySuccess implements IHomeRepository { | ||
23 | totalRecovered: 0), | 27 | totalRecovered: 0), |
24 | countries: [], | 28 | countries: [], |
25 | date: DateTime.now(), | 29 | date: DateTime.now(), |
30 | + id: '', | ||
26 | message: '', | 31 | message: '', |
27 | ); | 32 | ); |
28 | } | 33 | } |
29 | -} | ||
30 | 34 | ||
31 | -class MockRepositoryFailure implements IHomeRepository { | ||
32 | - @override | ||
33 | - Future<CasesModel> getCases() async { | ||
34 | return Future<CasesModel>.error('error'); | 35 | return Future<CasesModel>.error('error'); |
35 | } | 36 | } |
36 | } | 37 | } |
37 | 38 | ||
38 | -class MockBinding extends Binding { | ||
39 | - @override | ||
40 | - List<Bind> dependencies() { | ||
41 | - return [ | ||
42 | - Bind.lazyPut<IHomeRepository>(() => MockRepositorySuccess()), | ||
43 | - Bind.lazyPut<HomeController>( | ||
44 | - () => HomeController(homeRepository: Get.find()), | ||
45 | - ) | ||
46 | - ]; | ||
47 | - } | ||
48 | -} | ||
49 | - | ||
50 | void main() { | 39 | void main() { |
51 | WidgetsFlutterBinding.ensureInitialized(); | 40 | WidgetsFlutterBinding.ensureInitialized(); |
52 | setUpAll(() => HttpOverrides.global = null); | 41 | setUpAll(() => HttpOverrides.global = null); |
53 | - final binding = MockBinding(); | 42 | + final binding = BindingsBuilder(() { |
43 | + Get.lazyPut<IHomeRepository>(() => MockRepository()); | ||
44 | + Get.lazyPut<HomeController>( | ||
45 | + () => HomeController(homeRepository: Get.find())); | ||
46 | + }); | ||
47 | + | ||
48 | + test('Test Binding', () { | ||
49 | + expect(Get.isPrepared<HomeController>(), false); | ||
50 | + expect(Get.isPrepared<IHomeRepository>(), false); | ||
51 | + | ||
52 | + /// test you Binding class with BindingsBuilder | ||
53 | + binding.builder(); | ||
54 | + | ||
55 | + expect(Get.isPrepared<HomeController>(), true); | ||
56 | + expect(Get.isPrepared<IHomeRepository>(), true); | ||
54 | 57 | ||
58 | + Get.reset(); | ||
59 | + }); | ||
55 | test('Test Controller', () async { | 60 | test('Test Controller', () async { |
56 | /// Controller can't be on memory | 61 | /// Controller can't be on memory |
57 | - expect(() => Get.find<HomeController>(tag: 'success'), | ||
58 | - throwsA(const TypeMatcher<String>())); | 62 | + expect(() => Get.find<HomeController>(), throwsA(m.TypeMatcher<String>())); |
59 | 63 | ||
60 | - /// binding will put the controller on memory | ||
61 | - binding.dependencies(); | 64 | + /// build Binding |
65 | + binding.builder(); | ||
62 | 66 | ||
63 | /// recover your controller | 67 | /// recover your controller |
64 | final controller = Get.find<HomeController>(); | 68 | final controller = Get.find<HomeController>(); |
@@ -70,17 +74,26 @@ void main() { | @@ -70,17 +74,26 @@ void main() { | ||
70 | expect(controller.status.isLoading, true); | 74 | expect(controller.status.isLoading, true); |
71 | 75 | ||
72 | /// await time request | 76 | /// await time request |
73 | - await Future.delayed(const Duration(milliseconds: 100)); | ||
74 | - | ||
75 | - /// test if status is success | ||
76 | - expect(controller.status.isSuccess, true); | ||
77 | - expect(controller.state.global.totalDeaths, 100); | ||
78 | - expect(controller.state.global.totalConfirmed, 200); | 77 | + await Future.delayed(Duration(milliseconds: 100)); |
79 | 78 | ||
80 | - /// test if status is error | ||
81 | - Get.lazyReplace<IHomeRepository>(() => MockRepositoryFailure()); | ||
82 | - expect(controller.status.isError, true); | 79 | + if (controller.status.isError) { |
83 | expect(controller.state, null); | 80 | expect(controller.state, null); |
81 | + } | ||
82 | + | ||
83 | + if (controller.status.isSuccess) { | ||
84 | + expect(controller.state!.global.totalDeaths, 100); | ||
85 | + expect(controller.state!.global.totalConfirmed, 200); | ||
86 | + } | ||
87 | + }); | ||
88 | + | ||
89 | + test('ever', () async { | ||
90 | + final count = ''.obs; | ||
91 | + var result = ''; | ||
92 | + ever<String>(count, (value) { | ||
93 | + result = value; | ||
94 | + }); | ||
95 | + count.value = '1'; | ||
96 | + expect('1', result); | ||
84 | }); | 97 | }); |
85 | 98 | ||
86 | /// Tests with GetTests | 99 | /// Tests with GetTests |
@@ -137,3 +150,26 @@ void main() { | @@ -137,3 +150,26 @@ void main() { | ||
137 | }, | 150 | }, |
138 | );*/ | 151 | );*/ |
139 | } | 152 | } |
153 | + | ||
154 | +class Controller extends GetxController { | ||
155 | + final count = 0.obs; | ||
156 | + void increment() => count.value++; | ||
157 | + | ||
158 | + @override | ||
159 | + void onInit() { | ||
160 | + print('inittt'); | ||
161 | + super.onInit(); | ||
162 | + } | ||
163 | + | ||
164 | + @override | ||
165 | + void onReady() { | ||
166 | + print('onReady'); | ||
167 | + super.onReady(); | ||
168 | + } | ||
169 | + | ||
170 | + @override | ||
171 | + void onClose() { | ||
172 | + super.onClose(); | ||
173 | + print('onClose'); | ||
174 | + } | ||
175 | +} |
@@ -21,6 +21,6 @@ | @@ -21,6 +21,6 @@ | ||
21 | <key>CFBundleVersion</key> | 21 | <key>CFBundleVersion</key> |
22 | <string>1.0</string> | 22 | <string>1.0</string> |
23 | <key>MinimumOSVersion</key> | 23 | <key>MinimumOSVersion</key> |
24 | - <string>11.0</string> | 24 | + <string>8.0</string> |
25 | </dict> | 25 | </dict> |
26 | </plist> | 26 | </plist> |
1 | // This is a generated file; do not edit or check into version control. | 1 | // This is a generated file; do not edit or check into version control. |
2 | FLUTTER_ROOT=/Users/jonatasborges/flutter | 2 | FLUTTER_ROOT=/Users/jonatasborges/flutter |
3 | -FLUTTER_APPLICATION_PATH=/Users/jonatasborges/getx5/getx/example_nav2 | 3 | +FLUTTER_APPLICATION_PATH=/Users/jonatasborges/Downloads/get-4.6.1/example_nav2 |
4 | COCOAPODS_PARALLEL_CODE_SIGN=true | 4 | COCOAPODS_PARALLEL_CODE_SIGN=true |
5 | -FLUTTER_TARGET=/Users/jonatasborges/getx5/getx/example_nav2/lib/main.dart | 5 | +FLUTTER_TARGET=lib/main.dart |
6 | FLUTTER_BUILD_DIR=build | 6 | FLUTTER_BUILD_DIR=build |
7 | FLUTTER_BUILD_NAME=1.0.0 | 7 | FLUTTER_BUILD_NAME=1.0.0 |
8 | FLUTTER_BUILD_NUMBER=1 | 8 | FLUTTER_BUILD_NUMBER=1 |
9 | EXCLUDED_ARCHS[sdk=iphonesimulator*]=i386 | 9 | EXCLUDED_ARCHS[sdk=iphonesimulator*]=i386 |
10 | -EXCLUDED_ARCHS[sdk=iphoneos*]=armv7 | ||
11 | -DART_DEFINES=RkxVVFRFUl9XRUJfQVVUT19ERVRFQ1Q9dHJ1ZQ==,RkxVVFRFUl9XRUJfQ0FOVkFTS0lUX1VSTD1odHRwczovL3d3dy5nc3RhdGljLmNvbS9mbHV0dGVyLWNhbnZhc2tpdC9iOGQzNTgxMGU5MWFiOGZjMzliYTVlN2E0MWJmZjZmNjk3ZThlM2E4Lw== | ||
12 | DART_OBFUSCATION=false | 10 | DART_OBFUSCATION=false |
13 | -TRACK_WIDGET_CREATION=true | 11 | +TRACK_WIDGET_CREATION=false |
14 | TREE_SHAKE_ICONS=false | 12 | TREE_SHAKE_ICONS=false |
15 | -PACKAGE_CONFIG=/Users/jonatasborges/getx5/getx/example_nav2/.dart_tool/package_config.json | 13 | +PACKAGE_CONFIG=.packages |
1 | #!/bin/sh | 1 | #!/bin/sh |
2 | # This is a generated file; do not edit or check into version control. | 2 | # This is a generated file; do not edit or check into version control. |
3 | export "FLUTTER_ROOT=/Users/jonatasborges/flutter" | 3 | export "FLUTTER_ROOT=/Users/jonatasborges/flutter" |
4 | -export "FLUTTER_APPLICATION_PATH=/Users/jonatasborges/getx5/getx/example_nav2" | 4 | +export "FLUTTER_APPLICATION_PATH=/Users/jonatasborges/Downloads/get-4.6.1/example_nav2" |
5 | export "COCOAPODS_PARALLEL_CODE_SIGN=true" | 5 | export "COCOAPODS_PARALLEL_CODE_SIGN=true" |
6 | -export "FLUTTER_TARGET=/Users/jonatasborges/getx5/getx/example_nav2/lib/main.dart" | 6 | +export "FLUTTER_TARGET=lib/main.dart" |
7 | export "FLUTTER_BUILD_DIR=build" | 7 | export "FLUTTER_BUILD_DIR=build" |
8 | export "FLUTTER_BUILD_NAME=1.0.0" | 8 | export "FLUTTER_BUILD_NAME=1.0.0" |
9 | export "FLUTTER_BUILD_NUMBER=1" | 9 | export "FLUTTER_BUILD_NUMBER=1" |
10 | -export "DART_DEFINES=RkxVVFRFUl9XRUJfQVVUT19ERVRFQ1Q9dHJ1ZQ==,RkxVVFRFUl9XRUJfQ0FOVkFTS0lUX1VSTD1odHRwczovL3d3dy5nc3RhdGljLmNvbS9mbHV0dGVyLWNhbnZhc2tpdC9iOGQzNTgxMGU5MWFiOGZjMzliYTVlN2E0MWJmZjZmNjk3ZThlM2E4Lw==" | ||
11 | export "DART_OBFUSCATION=false" | 10 | export "DART_OBFUSCATION=false" |
12 | -export "TRACK_WIDGET_CREATION=true" | 11 | +export "TRACK_WIDGET_CREATION=false" |
13 | export "TREE_SHAKE_ICONS=false" | 12 | export "TREE_SHAKE_ICONS=false" |
14 | -export "PACKAGE_CONFIG=/Users/jonatasborges/getx5/getx/example_nav2/.dart_tool/package_config.json" | 13 | +export "PACKAGE_CONFIG=.packages" |
@@ -3,7 +3,7 @@ | @@ -3,7 +3,7 @@ | ||
3 | archiveVersion = 1; | 3 | archiveVersion = 1; |
4 | classes = { | 4 | classes = { |
5 | }; | 5 | }; |
6 | - objectVersion = 54; | 6 | + objectVersion = 46; |
7 | objects = { | 7 | objects = { |
8 | 8 | ||
9 | /* Begin PBXBuildFile section */ | 9 | /* Begin PBXBuildFile section */ |
@@ -127,7 +127,7 @@ | @@ -127,7 +127,7 @@ | ||
127 | 97C146E61CF9000F007C117D /* Project object */ = { | 127 | 97C146E61CF9000F007C117D /* Project object */ = { |
128 | isa = PBXProject; | 128 | isa = PBXProject; |
129 | attributes = { | 129 | attributes = { |
130 | - LastUpgradeCheck = 1430; | 130 | + LastUpgradeCheck = 1020; |
131 | ORGANIZATIONNAME = ""; | 131 | ORGANIZATIONNAME = ""; |
132 | TargetAttributes = { | 132 | TargetAttributes = { |
133 | 97C146ED1CF9000F007C117D = { | 133 | 97C146ED1CF9000F007C117D = { |
@@ -171,12 +171,10 @@ | @@ -171,12 +171,10 @@ | ||
171 | /* Begin PBXShellScriptBuildPhase section */ | 171 | /* Begin PBXShellScriptBuildPhase section */ |
172 | 3B06AD1E1E4923F5004D2608 /* Thin Binary */ = { | 172 | 3B06AD1E1E4923F5004D2608 /* Thin Binary */ = { |
173 | isa = PBXShellScriptBuildPhase; | 173 | isa = PBXShellScriptBuildPhase; |
174 | - alwaysOutOfDate = 1; | ||
175 | buildActionMask = 2147483647; | 174 | buildActionMask = 2147483647; |
176 | files = ( | 175 | files = ( |
177 | ); | 176 | ); |
178 | inputPaths = ( | 177 | inputPaths = ( |
179 | - "${TARGET_BUILD_DIR}/${INFOPLIST_PATH}", | ||
180 | ); | 178 | ); |
181 | name = "Thin Binary"; | 179 | name = "Thin Binary"; |
182 | outputPaths = ( | 180 | outputPaths = ( |
@@ -187,7 +185,6 @@ | @@ -187,7 +185,6 @@ | ||
187 | }; | 185 | }; |
188 | 9740EEB61CF901F6004384FC /* Run Script */ = { | 186 | 9740EEB61CF901F6004384FC /* Run Script */ = { |
189 | isa = PBXShellScriptBuildPhase; | 187 | isa = PBXShellScriptBuildPhase; |
190 | - alwaysOutOfDate = 1; | ||
191 | buildActionMask = 2147483647; | 188 | buildActionMask = 2147483647; |
192 | files = ( | 189 | files = ( |
193 | ); | 190 | ); |
@@ -275,7 +272,7 @@ | @@ -275,7 +272,7 @@ | ||
275 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; | 272 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; |
276 | GCC_WARN_UNUSED_FUNCTION = YES; | 273 | GCC_WARN_UNUSED_FUNCTION = YES; |
277 | GCC_WARN_UNUSED_VARIABLE = YES; | 274 | GCC_WARN_UNUSED_VARIABLE = YES; |
278 | - IPHONEOS_DEPLOYMENT_TARGET = 11.0; | 275 | + IPHONEOS_DEPLOYMENT_TARGET = 9.0; |
279 | MTL_ENABLE_DEBUG_INFO = NO; | 276 | MTL_ENABLE_DEBUG_INFO = NO; |
280 | SDKROOT = iphoneos; | 277 | SDKROOT = iphoneos; |
281 | SUPPORTED_PLATFORMS = iphoneos; | 278 | SUPPORTED_PLATFORMS = iphoneos; |
@@ -349,7 +346,7 @@ | @@ -349,7 +346,7 @@ | ||
349 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; | 346 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; |
350 | GCC_WARN_UNUSED_FUNCTION = YES; | 347 | GCC_WARN_UNUSED_FUNCTION = YES; |
351 | GCC_WARN_UNUSED_VARIABLE = YES; | 348 | GCC_WARN_UNUSED_VARIABLE = YES; |
352 | - IPHONEOS_DEPLOYMENT_TARGET = 11.0; | 349 | + IPHONEOS_DEPLOYMENT_TARGET = 9.0; |
353 | MTL_ENABLE_DEBUG_INFO = YES; | 350 | MTL_ENABLE_DEBUG_INFO = YES; |
354 | ONLY_ACTIVE_ARCH = YES; | 351 | ONLY_ACTIVE_ARCH = YES; |
355 | SDKROOT = iphoneos; | 352 | SDKROOT = iphoneos; |
@@ -398,7 +395,7 @@ | @@ -398,7 +395,7 @@ | ||
398 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; | 395 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; |
399 | GCC_WARN_UNUSED_FUNCTION = YES; | 396 | GCC_WARN_UNUSED_FUNCTION = YES; |
400 | GCC_WARN_UNUSED_VARIABLE = YES; | 397 | GCC_WARN_UNUSED_VARIABLE = YES; |
401 | - IPHONEOS_DEPLOYMENT_TARGET = 11.0; | 398 | + IPHONEOS_DEPLOYMENT_TARGET = 9.0; |
402 | MTL_ENABLE_DEBUG_INFO = NO; | 399 | MTL_ENABLE_DEBUG_INFO = NO; |
403 | SDKROOT = iphoneos; | 400 | SDKROOT = iphoneos; |
404 | SUPPORTED_PLATFORMS = iphoneos; | 401 | SUPPORTED_PLATFORMS = iphoneos; |
@@ -41,9 +41,5 @@ | @@ -41,9 +41,5 @@ | ||
41 | </array> | 41 | </array> |
42 | <key>UIViewControllerBasedStatusBarAppearance</key> | 42 | <key>UIViewControllerBasedStatusBarAppearance</key> |
43 | <false/> | 43 | <false/> |
44 | - <key>CADisableMinimumFrameDurationOnPhone</key> | ||
45 | - <true/> | ||
46 | - <key>UIApplicationSupportsIndirectInputEvents</key> | ||
47 | - <true/> | ||
48 | </dict> | 44 | </dict> |
49 | </plist> | 45 | </plist> |
@@ -5,14 +5,14 @@ import '../routes/app_pages.dart'; | @@ -5,14 +5,14 @@ import '../routes/app_pages.dart'; | ||
5 | 5 | ||
6 | class EnsureAuthMiddleware extends GetMiddleware { | 6 | class EnsureAuthMiddleware extends GetMiddleware { |
7 | @override | 7 | @override |
8 | - Future<RouteDecoder?> redirectDelegate(RouteDecoder route) async { | 8 | + Future<GetNavConfig?> redirectDelegate(GetNavConfig route) async { |
9 | // you can do whatever you want here | 9 | // you can do whatever you want here |
10 | // but it's preferable to make this method fast | 10 | // but it's preferable to make this method fast |
11 | // await Future.delayed(Duration(milliseconds: 500)); | 11 | // await Future.delayed(Duration(milliseconds: 500)); |
12 | 12 | ||
13 | if (!AuthService.to.isLoggedInValue) { | 13 | if (!AuthService.to.isLoggedInValue) { |
14 | - final newRoute = Routes.LOGIN_THEN(route.pageSettings!.name); | ||
15 | - return RouteDecoder.fromRoute(newRoute); | 14 | + final newRoute = Routes.LOGIN_THEN(route.location!); |
15 | + return GetNavConfig.fromRoute(newRoute); | ||
16 | } | 16 | } |
17 | return await super.redirectDelegate(route); | 17 | return await super.redirectDelegate(route); |
18 | } | 18 | } |
@@ -20,13 +20,13 @@ class EnsureAuthMiddleware extends GetMiddleware { | @@ -20,13 +20,13 @@ class EnsureAuthMiddleware extends GetMiddleware { | ||
20 | 20 | ||
21 | class EnsureNotAuthedMiddleware extends GetMiddleware { | 21 | class EnsureNotAuthedMiddleware extends GetMiddleware { |
22 | @override | 22 | @override |
23 | - Future<RouteDecoder?> redirectDelegate(RouteDecoder route) async { | 23 | + Future<GetNavConfig?> redirectDelegate(GetNavConfig route) async { |
24 | if (AuthService.to.isLoggedInValue) { | 24 | if (AuthService.to.isLoggedInValue) { |
25 | //NEVER navigate to auth screen, when user is already authed | 25 | //NEVER navigate to auth screen, when user is already authed |
26 | return null; | 26 | return null; |
27 | 27 | ||
28 | //OR redirect user to another screen | 28 | //OR redirect user to another screen |
29 | - //return RouteDecoder.fromRoute(Routes.PROFILE); | 29 | + //return GetNavConfig.fromRoute(Routes.PROFILE); |
30 | } | 30 | } |
31 | return await super.redirectDelegate(route); | 31 | return await super.redirectDelegate(route); |
32 | } | 32 | } |
@@ -2,13 +2,11 @@ import 'package:get/get.dart'; | @@ -2,13 +2,11 @@ import 'package:get/get.dart'; | ||
2 | 2 | ||
3 | import '../controllers/dashboard_controller.dart'; | 3 | import '../controllers/dashboard_controller.dart'; |
4 | 4 | ||
5 | -class DashboardBinding extends Binding { | 5 | +class DashboardBinding extends Bindings { |
6 | @override | 6 | @override |
7 | - List<Bind> dependencies() { | ||
8 | - return [ | ||
9 | - Bind.lazyPut<DashboardController>( | 7 | + void dependencies() { |
8 | + Get.lazyPut<DashboardController>( | ||
10 | () => DashboardController(), | 9 | () => DashboardController(), |
11 | - ) | ||
12 | - ]; | 10 | + ); |
13 | } | 11 | } |
14 | } | 12 | } |
@@ -8,7 +8,7 @@ class DashboardController extends GetxController { | @@ -8,7 +8,7 @@ class DashboardController extends GetxController { | ||
8 | void onReady() { | 8 | void onReady() { |
9 | super.onReady(); | 9 | super.onReady(); |
10 | Timer.periodic( | 10 | Timer.periodic( |
11 | - const Duration(seconds: 1), | 11 | + Duration(seconds: 1), |
12 | (timer) { | 12 | (timer) { |
13 | now.value = DateTime.now(); | 13 | now.value = DateTime.now(); |
14 | }, | 14 | }, |
@@ -4,8 +4,6 @@ import 'package:get/get.dart'; | @@ -4,8 +4,6 @@ import 'package:get/get.dart'; | ||
4 | import '../controllers/dashboard_controller.dart'; | 4 | import '../controllers/dashboard_controller.dart'; |
5 | 5 | ||
6 | class DashboardView extends GetView<DashboardController> { | 6 | class DashboardView extends GetView<DashboardController> { |
7 | - const DashboardView({super.key}); | ||
8 | - | ||
9 | @override | 7 | @override |
10 | Widget build(BuildContext context) { | 8 | Widget build(BuildContext context) { |
11 | return Scaffold( | 9 | return Scaffold( |
@@ -14,7 +12,7 @@ class DashboardView extends GetView<DashboardController> { | @@ -14,7 +12,7 @@ class DashboardView extends GetView<DashboardController> { | ||
14 | () => Column( | 12 | () => Column( |
15 | mainAxisSize: MainAxisSize.min, | 13 | mainAxisSize: MainAxisSize.min, |
16 | children: [ | 14 | children: [ |
17 | - const Text( | 15 | + Text( |
18 | 'DashboardView is working', | 16 | 'DashboardView is working', |
19 | style: TextStyle(fontSize: 20), | 17 | style: TextStyle(fontSize: 20), |
20 | ), | 18 | ), |
@@ -2,13 +2,11 @@ import 'package:get/get.dart'; | @@ -2,13 +2,11 @@ import 'package:get/get.dart'; | ||
2 | 2 | ||
3 | import '../controllers/home_controller.dart'; | 3 | import '../controllers/home_controller.dart'; |
4 | 4 | ||
5 | -class HomeBinding extends Binding { | 5 | +class HomeBinding extends Bindings { |
6 | @override | 6 | @override |
7 | - List<Bind> dependencies() { | ||
8 | - return [ | ||
9 | - Bind.lazyPut<HomeController>( | 7 | + void dependencies() { |
8 | + Get.lazyPut<HomeController>( | ||
10 | () => HomeController(), | 9 | () => HomeController(), |
11 | - ) | ||
12 | - ]; | 10 | + ); |
13 | } | 11 | } |
14 | } | 12 | } |
@@ -5,38 +5,42 @@ import '../../../routes/app_pages.dart'; | @@ -5,38 +5,42 @@ import '../../../routes/app_pages.dart'; | ||
5 | import '../controllers/home_controller.dart'; | 5 | import '../controllers/home_controller.dart'; |
6 | 6 | ||
7 | class HomeView extends GetView<HomeController> { | 7 | class HomeView extends GetView<HomeController> { |
8 | - const HomeView({Key? key}) : super(key: key); | ||
9 | - | ||
10 | @override | 8 | @override |
11 | Widget build(BuildContext context) { | 9 | Widget build(BuildContext context) { |
12 | - return Column( | ||
13 | - children: [ | ||
14 | - Container( | ||
15 | - color: Colors.yellow, | ||
16 | - width: double.infinity, | ||
17 | - height: 25, | ||
18 | - ), | ||
19 | - Expanded( | ||
20 | - child: GetRouterOutlet.builder( | ||
21 | - route: Routes.home, | ||
22 | - builder: (context) { | 10 | + return GetRouterOutlet.builder( |
11 | + builder: (context, delegate, currentRoute) { | ||
12 | + //This router outlet handles the appbar and the bottom navigation bar | ||
13 | + final currentLocation = currentRoute?.location; | ||
14 | + var currentIndex = 0; | ||
15 | + if (currentLocation?.startsWith(Routes.PRODUCTS) == true) { | ||
16 | + currentIndex = 2; | ||
17 | + } | ||
18 | + if (currentLocation?.startsWith(Routes.PROFILE) == true) { | ||
19 | + currentIndex = 1; | ||
20 | + } | ||
23 | return Scaffold( | 21 | return Scaffold( |
24 | body: GetRouterOutlet( | 22 | body: GetRouterOutlet( |
25 | - initialRoute: Routes.dashboard, | ||
26 | - anchorRoute: Routes.home, | 23 | + initialRoute: Routes.DASHBOARD, |
24 | + // anchorRoute: Routes.HOME, | ||
25 | + key: Get.nestedKey(Routes.HOME), | ||
27 | ), | 26 | ), |
28 | - bottomNavigationBar: IndexedRouteBuilder( | ||
29 | - routes: const [ | ||
30 | - Routes.dashboard, | ||
31 | - Routes.profile, | ||
32 | - Routes.products | ||
33 | - ], | ||
34 | - builder: (context, routes, index) { | ||
35 | - final delegate = context.delegate; | ||
36 | - return BottomNavigationBar( | ||
37 | - currentIndex: index, | ||
38 | - onTap: (value) => delegate.toNamed(routes[value]), | ||
39 | - items: const [ | 27 | + bottomNavigationBar: BottomNavigationBar( |
28 | + currentIndex: currentIndex, | ||
29 | + onTap: (value) { | ||
30 | + switch (value) { | ||
31 | + case 0: | ||
32 | + delegate.toNamed(Routes.HOME); | ||
33 | + break; | ||
34 | + case 1: | ||
35 | + delegate.toNamed(Routes.PROFILE); | ||
36 | + break; | ||
37 | + case 2: | ||
38 | + delegate.toNamed(Routes.PRODUCTS); | ||
39 | + break; | ||
40 | + default: | ||
41 | + } | ||
42 | + }, | ||
43 | + items: [ | ||
40 | // _Paths.HOME + [Empty] | 44 | // _Paths.HOME + [Empty] |
41 | BottomNavigationBarItem( | 45 | BottomNavigationBarItem( |
42 | icon: Icon(Icons.home), | 46 | icon: Icon(Icons.home), |
@@ -53,13 +57,9 @@ class HomeView extends GetView<HomeController> { | @@ -53,13 +57,9 @@ class HomeView extends GetView<HomeController> { | ||
53 | label: 'Products', | 57 | label: 'Products', |
54 | ), | 58 | ), |
55 | ], | 59 | ], |
56 | - ); | ||
57 | - }), | 60 | + ), |
58 | ); | 61 | ); |
59 | }, | 62 | }, |
60 | - ), | ||
61 | - ), | ||
62 | - ], | ||
63 | ); | 63 | ); |
64 | } | 64 | } |
65 | } | 65 | } |
@@ -2,11 +2,11 @@ import 'package:get/get.dart'; | @@ -2,11 +2,11 @@ import 'package:get/get.dart'; | ||
2 | 2 | ||
3 | import '../controllers/login_controller.dart'; | 3 | import '../controllers/login_controller.dart'; |
4 | 4 | ||
5 | -class LoginBinding extends Binding { | 5 | +class LoginBinding extends Bindings { |
6 | @override | 6 | @override |
7 | - List<Bind> dependencies() { | ||
8 | - return [ | ||
9 | - Bind.lazyPut(() => LoginController()), | ||
10 | - ]; | 7 | + void dependencies() { |
8 | + Get.lazyPut<LoginController>( | ||
9 | + () => LoginController(), | ||
10 | + ); | ||
11 | } | 11 | } |
12 | } | 12 | } |
@@ -6,8 +6,6 @@ import '../../../routes/app_pages.dart'; | @@ -6,8 +6,6 @@ import '../../../routes/app_pages.dart'; | ||
6 | import '../controllers/login_controller.dart'; | 6 | import '../controllers/login_controller.dart'; |
7 | 7 | ||
8 | class LoginView extends GetView<LoginController> { | 8 | class LoginView extends GetView<LoginController> { |
9 | - const LoginView({super.key}); | ||
10 | - | ||
11 | @override | 9 | @override |
12 | Widget build(BuildContext context) { | 10 | Widget build(BuildContext context) { |
13 | return Scaffold( | 11 | return Scaffold( |
@@ -27,14 +25,15 @@ class LoginView extends GetView<LoginController> { | @@ -27,14 +25,15 @@ class LoginView extends GetView<LoginController> { | ||
27 | }, | 25 | }, |
28 | ), | 26 | ), |
29 | MaterialButton( | 27 | MaterialButton( |
30 | - child: const Text( | 28 | + child: Text( |
31 | 'Do LOGIN !!', | 29 | 'Do LOGIN !!', |
32 | style: TextStyle(color: Colors.blue, fontSize: 20), | 30 | style: TextStyle(color: Colors.blue, fontSize: 20), |
33 | ), | 31 | ), |
34 | onPressed: () { | 32 | onPressed: () { |
35 | AuthService.to.login(); | 33 | AuthService.to.login(); |
36 | - final thenTo = context.params['then']; | ||
37 | - Get.offNamed(thenTo ?? Routes.home); | 34 | + final thenTo = Get.rootDelegate.currentConfiguration! |
35 | + .currentPage!.parameters?['then']; | ||
36 | + Get.rootDelegate.offNamed(thenTo ?? Routes.HOME); | ||
38 | }, | 37 | }, |
39 | ), | 38 | ), |
40 | ], | 39 | ], |
@@ -2,15 +2,13 @@ import 'package:get/get.dart'; | @@ -2,15 +2,13 @@ import 'package:get/get.dart'; | ||
2 | 2 | ||
3 | import '../controllers/product_details_controller.dart'; | 3 | import '../controllers/product_details_controller.dart'; |
4 | 4 | ||
5 | -class ProductDetailsBinding extends Binding { | 5 | +class ProductDetailsBinding extends Bindings { |
6 | @override | 6 | @override |
7 | - List<Bind> dependencies() { | ||
8 | - return [ | ||
9 | - Bind.spawn<ProductDetailsController>( | 7 | + void dependencies() { |
8 | + Get.create<ProductDetailsController>( | ||
10 | () => ProductDetailsController( | 9 | () => ProductDetailsController( |
11 | Get.parameters['productId'] ?? '', | 10 | Get.parameters['productId'] ?? '', |
12 | ), | 11 | ), |
13 | - ) | ||
14 | - ]; | 12 | + ); |
15 | } | 13 | } |
16 | } | 14 | } |
@@ -13,7 +13,6 @@ class ProductDetailsController extends GetxController { | @@ -13,7 +13,6 @@ class ProductDetailsController extends GetxController { | ||
13 | @override | 13 | @override |
14 | void onClose() { | 14 | void onClose() { |
15 | Get.log('ProductDetailsController close with id: $productId'); | 15 | Get.log('ProductDetailsController close with id: $productId'); |
16 | - | ||
17 | super.onClose(); | 16 | super.onClose(); |
18 | } | 17 | } |
19 | } | 18 | } |
1 | import 'package:flutter/material.dart'; | 1 | import 'package:flutter/material.dart'; |
2 | + | ||
2 | import 'package:get/get.dart'; | 3 | import 'package:get/get.dart'; |
3 | 4 | ||
4 | import '../controllers/product_details_controller.dart'; | 5 | import '../controllers/product_details_controller.dart'; |
5 | 6 | ||
6 | class ProductDetailsView extends GetWidget<ProductDetailsController> { | 7 | class ProductDetailsView extends GetWidget<ProductDetailsController> { |
7 | - const ProductDetailsView({super.key}); | ||
8 | - | ||
9 | @override | 8 | @override |
10 | Widget build(BuildContext context) { | 9 | Widget build(BuildContext context) { |
11 | return Scaffold( | 10 | return Scaffold( |
@@ -13,7 +12,7 @@ class ProductDetailsView extends GetWidget<ProductDetailsController> { | @@ -13,7 +12,7 @@ class ProductDetailsView extends GetWidget<ProductDetailsController> { | ||
13 | child: Column( | 12 | child: Column( |
14 | mainAxisSize: MainAxisSize.min, | 13 | mainAxisSize: MainAxisSize.min, |
15 | children: [ | 14 | children: [ |
16 | - const Text( | 15 | + Text( |
17 | 'ProductDetailsView is working', | 16 | 'ProductDetailsView is working', |
18 | style: TextStyle(fontSize: 20), | 17 | style: TextStyle(fontSize: 20), |
19 | ), | 18 | ), |
@@ -2,13 +2,11 @@ import 'package:get/get.dart'; | @@ -2,13 +2,11 @@ import 'package:get/get.dart'; | ||
2 | 2 | ||
3 | import '../controllers/products_controller.dart'; | 3 | import '../controllers/products_controller.dart'; |
4 | 4 | ||
5 | -class ProductsBinding extends Binding { | 5 | +class ProductsBinding extends Bindings { |
6 | @override | 6 | @override |
7 | - List<Bind> dependencies() { | ||
8 | - return [ | ||
9 | - Bind.lazyPut<ProductsController>( | 7 | + void dependencies() { |
8 | + Get.lazyPut<ProductsController>( | ||
10 | () => ProductsController(), | 9 | () => ProductsController(), |
11 | - ) | ||
12 | - ]; | 10 | + ); |
13 | } | 11 | } |
14 | } | 12 | } |
@@ -5,19 +5,18 @@ import '../../../routes/app_pages.dart'; | @@ -5,19 +5,18 @@ import '../../../routes/app_pages.dart'; | ||
5 | import '../controllers/products_controller.dart'; | 5 | import '../controllers/products_controller.dart'; |
6 | 6 | ||
7 | class ProductsView extends GetView<ProductsController> { | 7 | class ProductsView extends GetView<ProductsController> { |
8 | - const ProductsView({Key? key}) : super(key: key); | ||
9 | @override | 8 | @override |
10 | Widget build(BuildContext context) { | 9 | Widget build(BuildContext context) { |
11 | return Scaffold( | 10 | return Scaffold( |
12 | floatingActionButton: FloatingActionButton.extended( | 11 | floatingActionButton: FloatingActionButton.extended( |
13 | - onPressed: () => controller.loadDemoProductsFromSomeWhere(), | ||
14 | - label: const Text('Add'), | 12 | + onPressed: controller.loadDemoProductsFromSomeWhere, |
13 | + label: Text('Add'), | ||
15 | ), | 14 | ), |
16 | body: Column( | 15 | body: Column( |
17 | children: [ | 16 | children: [ |
18 | - const Hero( | 17 | + Hero( |
19 | tag: 'heroLogo', | 18 | tag: 'heroLogo', |
20 | - child: FlutterLogo(), | 19 | + child: const FlutterLogo(), |
21 | ), | 20 | ), |
22 | Expanded( | 21 | Expanded( |
23 | child: Obx( | 22 | child: Obx( |
@@ -32,7 +31,8 @@ class ProductsView extends GetView<ProductsController> { | @@ -32,7 +31,8 @@ class ProductsView extends GetView<ProductsController> { | ||
32 | final item = controller.products[index]; | 31 | final item = controller.products[index]; |
33 | return ListTile( | 32 | return ListTile( |
34 | onTap: () { | 33 | onTap: () { |
35 | - Get.toNamed(Routes.PRODUCT_DETAILS(item.id)); | 34 | + Get.rootDelegate |
35 | + .toNamed(Routes.PRODUCT_DETAILS(item.id)); | ||
36 | }, | 36 | }, |
37 | title: Text(item.name), | 37 | title: Text(item.name), |
38 | subtitle: Text(item.id), | 38 | subtitle: Text(item.id), |
@@ -2,13 +2,11 @@ import 'package:get/get.dart'; | @@ -2,13 +2,11 @@ import 'package:get/get.dart'; | ||
2 | 2 | ||
3 | import '../controllers/profile_controller.dart'; | 3 | import '../controllers/profile_controller.dart'; |
4 | 4 | ||
5 | -class ProfileBinding extends Binding { | 5 | +class ProfileBinding extends Bindings { |
6 | @override | 6 | @override |
7 | - List<Bind> dependencies() { | ||
8 | - return [ | ||
9 | - Bind.lazyPut<ProfileController>( | 7 | + void dependencies() { |
8 | + Get.lazyPut<ProfileController>( | ||
10 | () => ProfileController(), | 9 | () => ProfileController(), |
11 | - ) | ||
12 | - ]; | 10 | + ); |
13 | } | 11 | } |
14 | } | 12 | } |
@@ -5,8 +5,6 @@ import '../../../routes/app_pages.dart'; | @@ -5,8 +5,6 @@ import '../../../routes/app_pages.dart'; | ||
5 | import '../controllers/profile_controller.dart'; | 5 | import '../controllers/profile_controller.dart'; |
6 | 6 | ||
7 | class ProfileView extends GetView<ProfileController> { | 7 | class ProfileView extends GetView<ProfileController> { |
8 | - const ProfileView({super.key}); | ||
9 | - | ||
10 | @override | 8 | @override |
11 | Widget build(BuildContext context) { | 9 | Widget build(BuildContext context) { |
12 | return Scaffold( | 10 | return Scaffold( |
@@ -15,16 +13,16 @@ class ProfileView extends GetView<ProfileController> { | @@ -15,16 +13,16 @@ class ProfileView extends GetView<ProfileController> { | ||
15 | child: Column( | 13 | child: Column( |
16 | mainAxisSize: MainAxisSize.min, | 14 | mainAxisSize: MainAxisSize.min, |
17 | children: [ | 15 | children: [ |
18 | - const Text( | 16 | + Text( |
19 | 'ProfileView is working', | 17 | 'ProfileView is working', |
20 | style: TextStyle(fontSize: 20), | 18 | style: TextStyle(fontSize: 20), |
21 | ), | 19 | ), |
22 | - const Hero( | 20 | + Hero( |
23 | tag: 'heroLogo', | 21 | tag: 'heroLogo', |
24 | - child: FlutterLogo(), | 22 | + child: const FlutterLogo(), |
25 | ), | 23 | ), |
26 | MaterialButton( | 24 | MaterialButton( |
27 | - child: const Text('Show a test dialog'), | 25 | + child: Text('Show a test dialog'), |
28 | onPressed: () { | 26 | onPressed: () { |
29 | //shows a dialog | 27 | //shows a dialog |
30 | Get.defaultDialog( | 28 | Get.defaultDialog( |
@@ -34,14 +32,14 @@ class ProfileView extends GetView<ProfileController> { | @@ -34,14 +32,14 @@ class ProfileView extends GetView<ProfileController> { | ||
34 | }, | 32 | }, |
35 | ), | 33 | ), |
36 | MaterialButton( | 34 | MaterialButton( |
37 | - child: const Text('Show a test dialog in Home router outlet'), | 35 | + child: Text('Show a test dialog in Home router outlet'), |
38 | onPressed: () { | 36 | onPressed: () { |
39 | //shows a dialog | 37 | //shows a dialog |
38 | + | ||
40 | Get.defaultDialog( | 39 | Get.defaultDialog( |
41 | title: 'Test Dialog In Home Outlet !!', | 40 | title: 'Test Dialog In Home Outlet !!', |
42 | barrierDismissible: true, | 41 | barrierDismissible: true, |
43 | - id: Routes.home, | ||
44 | - // navigatorKey: Get.nestedKey(Routes.HOME), | 42 | + navigatorKey: Get.nestedKey(Routes.HOME), |
45 | ); | 43 | ); |
46 | }, | 44 | }, |
47 | ) | 45 | ) |
@@ -2,13 +2,11 @@ import 'package:get/get.dart'; | @@ -2,13 +2,11 @@ import 'package:get/get.dart'; | ||
2 | 2 | ||
3 | import '../controllers/root_controller.dart'; | 3 | import '../controllers/root_controller.dart'; |
4 | 4 | ||
5 | -class RootBinding extends Binding { | 5 | +class RootBinding extends Bindings { |
6 | @override | 6 | @override |
7 | - List<Bind> dependencies() { | ||
8 | - return [ | ||
9 | - Bind.lazyPut<RootController>( | 7 | + void dependencies() { |
8 | + Get.lazyPut<RootController>( | ||
10 | () => RootController(), | 9 | () => RootController(), |
11 | - ) | ||
12 | - ]; | 10 | + ); |
13 | } | 11 | } |
14 | } | 12 | } |
1 | import 'package:get/get.dart'; | 1 | import 'package:get/get.dart'; |
2 | 2 | ||
3 | class RootController extends GetxController { | 3 | class RootController extends GetxController { |
4 | + //TODO: Implement RootController | ||
5 | + | ||
4 | final count = 0.obs; | 6 | final count = 0.obs; |
5 | @override | 7 | @override |
6 | void onInit() { | 8 | void onInit() { |
@@ -8,6 +10,11 @@ class RootController extends GetxController { | @@ -8,6 +10,11 @@ class RootController extends GetxController { | ||
8 | } | 10 | } |
9 | 11 | ||
10 | @override | 12 | @override |
13 | + void onReady() { | ||
14 | + super.onReady(); | ||
15 | + } | ||
16 | + | ||
17 | + @override | ||
11 | void onClose() {} | 18 | void onClose() {} |
12 | void increment() => count.value++; | 19 | void increment() => count.value++; |
13 | } | 20 | } |
@@ -19,18 +19,18 @@ class DrawerWidget extends StatelessWidget { | @@ -19,18 +19,18 @@ class DrawerWidget extends StatelessWidget { | ||
19 | color: Colors.red, | 19 | color: Colors.red, |
20 | ), | 20 | ), |
21 | ListTile( | 21 | ListTile( |
22 | - title: const Text('Home'), | 22 | + title: Text('Home'), |
23 | onTap: () { | 23 | onTap: () { |
24 | - Get.toNamed(Routes.home); | 24 | + Get.rootDelegate.toNamed(Routes.HOME); |
25 | //to close the drawer | 25 | //to close the drawer |
26 | 26 | ||
27 | Navigator.of(context).pop(); | 27 | Navigator.of(context).pop(); |
28 | }, | 28 | }, |
29 | ), | 29 | ), |
30 | ListTile( | 30 | ListTile( |
31 | - title: const Text('Settings'), | 31 | + title: Text('Settings'), |
32 | onTap: () { | 32 | onTap: () { |
33 | - Get.toNamed(Routes.settings); | 33 | + Get.rootDelegate.toNamed(Routes.SETTINGS); |
34 | //to close the drawer | 34 | //to close the drawer |
35 | 35 | ||
36 | Navigator.of(context).pop(); | 36 | Navigator.of(context).pop(); |
@@ -38,7 +38,7 @@ class DrawerWidget extends StatelessWidget { | @@ -38,7 +38,7 @@ class DrawerWidget extends StatelessWidget { | ||
38 | ), | 38 | ), |
39 | if (AuthService.to.isLoggedInValue) | 39 | if (AuthService.to.isLoggedInValue) |
40 | ListTile( | 40 | ListTile( |
41 | - title: const Text( | 41 | + title: Text( |
42 | 'Logout', | 42 | 'Logout', |
43 | style: TextStyle( | 43 | style: TextStyle( |
44 | color: Colors.red, | 44 | color: Colors.red, |
@@ -46,7 +46,7 @@ class DrawerWidget extends StatelessWidget { | @@ -46,7 +46,7 @@ class DrawerWidget extends StatelessWidget { | ||
46 | ), | 46 | ), |
47 | onTap: () { | 47 | onTap: () { |
48 | AuthService.to.logout(); | 48 | AuthService.to.logout(); |
49 | - Get.toNamed(Routes.login); | 49 | + Get.rootDelegate.toNamed(Routes.LOGIN); |
50 | //to close the drawer | 50 | //to close the drawer |
51 | 51 | ||
52 | Navigator.of(context).pop(); | 52 | Navigator.of(context).pop(); |
@@ -54,14 +54,14 @@ class DrawerWidget extends StatelessWidget { | @@ -54,14 +54,14 @@ class DrawerWidget extends StatelessWidget { | ||
54 | ), | 54 | ), |
55 | if (!AuthService.to.isLoggedInValue) | 55 | if (!AuthService.to.isLoggedInValue) |
56 | ListTile( | 56 | ListTile( |
57 | - title: const Text( | 57 | + title: Text( |
58 | 'Login', | 58 | 'Login', |
59 | style: TextStyle( | 59 | style: TextStyle( |
60 | color: Colors.blue, | 60 | color: Colors.blue, |
61 | ), | 61 | ), |
62 | ), | 62 | ), |
63 | onTap: () { | 63 | onTap: () { |
64 | - Get.toNamed(Routes.login); | 64 | + Get.rootDelegate.toNamed(Routes.LOGIN); |
65 | //to close the drawer | 65 | //to close the drawer |
66 | 66 | ||
67 | Navigator.of(context).pop(); | 67 | Navigator.of(context).pop(); |
@@ -6,25 +6,26 @@ import '../controllers/root_controller.dart'; | @@ -6,25 +6,26 @@ import '../controllers/root_controller.dart'; | ||
6 | import 'drawer.dart'; | 6 | import 'drawer.dart'; |
7 | 7 | ||
8 | class RootView extends GetView<RootController> { | 8 | class RootView extends GetView<RootController> { |
9 | - const RootView({super.key}); | ||
10 | - | ||
11 | @override | 9 | @override |
12 | Widget build(BuildContext context) { | 10 | Widget build(BuildContext context) { |
11 | + return GetRouterOutlet.builder( | ||
12 | + builder: (context, delegate, current) { | ||
13 | + final title = current?.location; | ||
13 | return Scaffold( | 14 | return Scaffold( |
14 | - drawer: const DrawerWidget(), | 15 | + drawer: DrawerWidget(), |
15 | appBar: AppBar( | 16 | appBar: AppBar( |
16 | - title: RouterListener(builder: (context) { | ||
17 | - final title = context.location; | ||
18 | - return Text(title); | ||
19 | - }), | 17 | + title: Text(title ?? ''), |
20 | centerTitle: true, | 18 | centerTitle: true, |
21 | ), | 19 | ), |
22 | - //body: HomeView(), | ||
23 | - | ||
24 | body: GetRouterOutlet( | 20 | body: GetRouterOutlet( |
25 | - initialRoute: Routes.home, | ||
26 | - anchorRoute: '/', | 21 | + initialRoute: Routes.HOME, |
22 | + // anchorRoute: '/', | ||
23 | + // filterPages: (afterAnchor) { | ||
24 | + // return afterAnchor.take(1); | ||
25 | + // }, | ||
27 | ), | 26 | ), |
28 | ); | 27 | ); |
28 | + }, | ||
29 | + ); | ||
29 | } | 30 | } |
30 | } | 31 | } |
@@ -2,13 +2,11 @@ import 'package:get/get.dart'; | @@ -2,13 +2,11 @@ import 'package:get/get.dart'; | ||
2 | 2 | ||
3 | import '../controllers/settings_controller.dart'; | 3 | import '../controllers/settings_controller.dart'; |
4 | 4 | ||
5 | -class SettingsBinding extends Binding { | 5 | +class SettingsBinding extends Bindings { |
6 | @override | 6 | @override |
7 | - List<Bind> dependencies() { | ||
8 | - return [ | ||
9 | - Bind.lazyPut<SettingsController>( | 7 | + void dependencies() { |
8 | + Get.lazyPut<SettingsController>( | ||
10 | () => SettingsController(), | 9 | () => SettingsController(), |
11 | - ) | ||
12 | - ]; | 10 | + ); |
13 | } | 11 | } |
14 | } | 12 | } |
1 | import 'package:get/get.dart'; | 1 | import 'package:get/get.dart'; |
2 | 2 | ||
3 | class SettingsController extends GetxController { | 3 | class SettingsController extends GetxController { |
4 | + //TODO: Implement SettingsController | ||
5 | + | ||
4 | final count = 0.obs; | 6 | final count = 0.obs; |
5 | @override | 7 | @override |
6 | void onInit() { | 8 | void onInit() { |
@@ -8,6 +10,11 @@ class SettingsController extends GetxController { | @@ -8,6 +10,11 @@ class SettingsController extends GetxController { | ||
8 | } | 10 | } |
9 | 11 | ||
10 | @override | 12 | @override |
13 | + void onReady() { | ||
14 | + super.onReady(); | ||
15 | + } | ||
16 | + | ||
17 | + @override | ||
11 | void onClose() {} | 18 | void onClose() {} |
12 | void increment() => count.value++; | 19 | void increment() => count.value++; |
13 | } | 20 | } |
1 | import 'package:flutter/material.dart'; | 1 | import 'package:flutter/material.dart'; |
2 | + | ||
2 | import 'package:get/get.dart'; | 3 | import 'package:get/get.dart'; |
3 | 4 | ||
4 | import '../controllers/settings_controller.dart'; | 5 | import '../controllers/settings_controller.dart'; |
5 | 6 | ||
6 | class SettingsView extends GetView<SettingsController> { | 7 | class SettingsView extends GetView<SettingsController> { |
7 | - const SettingsView({super.key}); | ||
8 | - | ||
9 | @override | 8 | @override |
10 | Widget build(BuildContext context) { | 9 | Widget build(BuildContext context) { |
11 | - return const Scaffold( | 10 | + return Scaffold( |
12 | body: Center( | 11 | body: Center( |
13 | child: Text( | 12 | child: Text( |
14 | 'SettingsView is working', | 13 | 'SettingsView is working', |
@@ -23,13 +23,13 @@ part 'app_routes.dart'; | @@ -23,13 +23,13 @@ part 'app_routes.dart'; | ||
23 | class AppPages { | 23 | class AppPages { |
24 | AppPages._(); | 24 | AppPages._(); |
25 | 25 | ||
26 | - static const initial = Routes.home; | 26 | + static const INITIAL = Routes.HOME; |
27 | 27 | ||
28 | static final routes = [ | 28 | static final routes = [ |
29 | GetPage( | 29 | GetPage( |
30 | name: '/', | 30 | name: '/', |
31 | - page: () => const RootView(), | ||
32 | - bindings: [RootBinding()], | 31 | + page: () => RootView(), |
32 | + binding: RootBinding(), | ||
33 | participatesInRootNavigator: true, | 33 | participatesInRootNavigator: true, |
34 | preventDuplicates: true, | 34 | preventDuplicates: true, |
35 | children: [ | 35 | children: [ |
@@ -38,52 +38,46 @@ class AppPages { | @@ -38,52 +38,46 @@ class AppPages { | ||
38 | //only enter this route when not authed | 38 | //only enter this route when not authed |
39 | EnsureNotAuthedMiddleware(), | 39 | EnsureNotAuthedMiddleware(), |
40 | ], | 40 | ], |
41 | - name: _Paths.login, | ||
42 | - page: () => const LoginView(), | ||
43 | - bindings: [LoginBinding()], | 41 | + name: _Paths.LOGIN, |
42 | + page: () => LoginView(), | ||
43 | + binding: LoginBinding(), | ||
44 | ), | 44 | ), |
45 | GetPage( | 45 | GetPage( |
46 | preventDuplicates: true, | 46 | preventDuplicates: true, |
47 | - name: _Paths.home, | ||
48 | - page: () => const HomeView(), | 47 | + name: _Paths.HOME, |
48 | + page: () => HomeView(), | ||
49 | bindings: [ | 49 | bindings: [ |
50 | HomeBinding(), | 50 | HomeBinding(), |
51 | ], | 51 | ], |
52 | title: null, | 52 | title: null, |
53 | children: [ | 53 | children: [ |
54 | GetPage( | 54 | GetPage( |
55 | - name: _Paths.dashboard, | ||
56 | - page: () => const DashboardView(), | ||
57 | - bindings: [ | ||
58 | - DashboardBinding(), | ||
59 | - ], | 55 | + name: _Paths.DASHBOARD, |
56 | + page: () => DashboardView(), | ||
57 | + binding: DashboardBinding(), | ||
60 | ), | 58 | ), |
61 | GetPage( | 59 | GetPage( |
62 | middlewares: [ | 60 | middlewares: [ |
63 | //only enter this route when authed | 61 | //only enter this route when authed |
64 | EnsureAuthMiddleware(), | 62 | EnsureAuthMiddleware(), |
65 | ], | 63 | ], |
66 | - name: _Paths.profile, | ||
67 | - page: () => const ProfileView(), | 64 | + name: _Paths.PROFILE, |
65 | + page: () => ProfileView(), | ||
68 | title: 'Profile', | 66 | title: 'Profile', |
69 | transition: Transition.size, | 67 | transition: Transition.size, |
70 | - bindings: [ProfileBinding()], | 68 | + binding: ProfileBinding(), |
71 | ), | 69 | ), |
72 | GetPage( | 70 | GetPage( |
73 | - name: _Paths.products, | ||
74 | - page: () => const ProductsView(), | 71 | + name: _Paths.PRODUCTS, |
72 | + page: () => ProductsView(), | ||
75 | title: 'Products', | 73 | title: 'Products', |
76 | - transition: Transition.cupertino, | ||
77 | - showCupertinoParallax: true, | ||
78 | - participatesInRootNavigator: false, | ||
79 | - bindings: [ProductsBinding(), ProductDetailsBinding()], | 74 | + transition: Transition.zoom, |
75 | + binding: ProductsBinding(), | ||
80 | children: [ | 76 | children: [ |
81 | GetPage( | 77 | GetPage( |
82 | - name: _Paths.productDetails, | ||
83 | - transition: Transition.cupertino, | ||
84 | - showCupertinoParallax: true, | ||
85 | - page: () => const ProductDetailsView(), | ||
86 | - bindings: const [], | 78 | + name: _Paths.PRODUCT_DETAILS, |
79 | + page: () => ProductDetailsView(), | ||
80 | + binding: ProductDetailsBinding(), | ||
87 | middlewares: [ | 81 | middlewares: [ |
88 | //only enter this route when authed | 82 | //only enter this route when authed |
89 | EnsureAuthMiddleware(), | 83 | EnsureAuthMiddleware(), |
@@ -94,11 +88,9 @@ class AppPages { | @@ -94,11 +88,9 @@ class AppPages { | ||
94 | ], | 88 | ], |
95 | ), | 89 | ), |
96 | GetPage( | 90 | GetPage( |
97 | - name: _Paths.settings, | ||
98 | - page: () => const SettingsView(), | ||
99 | - bindings: [ | ||
100 | - SettingsBinding(), | ||
101 | - ], | 91 | + name: _Paths.SETTINGS, |
92 | + page: () => SettingsView(), | ||
93 | + binding: SettingsBinding(), | ||
102 | ), | 94 | ), |
103 | ], | 95 | ], |
104 | ), | 96 | ), |
@@ -4,27 +4,27 @@ part of 'app_pages.dart'; | @@ -4,27 +4,27 @@ part of 'app_pages.dart'; | ||
4 | // DO NOT EDIT. This is code generated via package:get_cli/get_cli.dart | 4 | // DO NOT EDIT. This is code generated via package:get_cli/get_cli.dart |
5 | 5 | ||
6 | abstract class Routes { | 6 | abstract class Routes { |
7 | - static const home = _Paths.home; | 7 | + static const HOME = _Paths.HOME; |
8 | 8 | ||
9 | - static const profile = _Paths.home + _Paths.profile; | ||
10 | - static const settings = _Paths.settings; | 9 | + static const PROFILE = _Paths.HOME + _Paths.PROFILE; |
10 | + static const SETTINGS = _Paths.SETTINGS; | ||
11 | 11 | ||
12 | - static const products = _Paths.home + _Paths.products; | 12 | + static const PRODUCTS = _Paths.HOME + _Paths.PRODUCTS; |
13 | 13 | ||
14 | - static const login = _Paths.login; | ||
15 | - static const dashboard = _Paths.home + _Paths.dashboard; | 14 | + static const LOGIN = _Paths.LOGIN; |
15 | + static const DASHBOARD = _Paths.HOME + _Paths.DASHBOARD; | ||
16 | Routes._(); | 16 | Routes._(); |
17 | static String LOGIN_THEN(String afterSuccessfulLogin) => | 17 | static String LOGIN_THEN(String afterSuccessfulLogin) => |
18 | - '$login?then=${Uri.encodeQueryComponent(afterSuccessfulLogin)}'; | ||
19 | - static String PRODUCT_DETAILS(String productId) => '$products/$productId'; | 18 | + '$LOGIN?then=${Uri.encodeQueryComponent(afterSuccessfulLogin)}'; |
19 | + static String PRODUCT_DETAILS(String productId) => '$PRODUCTS/$productId'; | ||
20 | } | 20 | } |
21 | 21 | ||
22 | abstract class _Paths { | 22 | abstract class _Paths { |
23 | - static const home = '/home'; | ||
24 | - static const products = '/products'; | ||
25 | - static const profile = '/profile'; | ||
26 | - static const settings = '/settings'; | ||
27 | - static const productDetails = '/:productId'; | ||
28 | - static const login = '/login'; | ||
29 | - static const dashboard = '/dashboard'; | 23 | + static const HOME = '/home'; |
24 | + static const PRODUCTS = '/products'; | ||
25 | + static const PROFILE = '/profile'; | ||
26 | + static const SETTINGS = '/settings'; | ||
27 | + static const PRODUCT_DETAILS = '/:productId'; | ||
28 | + static const LOGIN = '/login'; | ||
29 | + static const DASHBOARD = '/dashboard'; | ||
30 | } | 30 | } |
1 | -import 'package:example_nav2/services/auth_service.dart'; | ||
2 | import 'package:flutter/material.dart'; | 1 | import 'package:flutter/material.dart'; |
3 | import 'package:get/get.dart'; | 2 | import 'package:get/get.dart'; |
4 | 3 | ||
5 | import 'app/routes/app_pages.dart'; | 4 | import 'app/routes/app_pages.dart'; |
5 | +import 'services/auth_service.dart'; | ||
6 | 6 | ||
7 | void main() { | 7 | void main() { |
8 | runApp( | 8 | runApp( |
9 | - GetMaterialApp( | 9 | + GetMaterialApp.router( |
10 | title: "Application", | 10 | title: "Application", |
11 | - binds: [ | ||
12 | - Bind.put(AuthService()), | ||
13 | - ], | 11 | + initialBinding: BindingsBuilder( |
12 | + () { | ||
13 | + Get.put(AuthService()); | ||
14 | + }, | ||
15 | + ), | ||
14 | getPages: AppPages.routes, | 16 | getPages: AppPages.routes, |
15 | - initialRoute: AppPages.initial, | ||
16 | - // builder: (context, child) { | ||
17 | - // return FutureBuilder<void>( | ||
18 | - // key: ValueKey('initFuture'), | ||
19 | - // future: Get.find<SplashService>().init(), | ||
20 | - // builder: (context, snapshot) { | ||
21 | - // if (snapshot.connectionState == ConnectionState.done) { | ||
22 | - // return child ?? SizedBox.shrink(); | ||
23 | - // } | ||
24 | - // return SplashView(); | ||
25 | - // }, | ||
26 | - // ); | ||
27 | - // }, | ||
28 | // routeInformationParser: GetInformationParser( | 17 | // routeInformationParser: GetInformationParser( |
29 | // // initialRoute: Routes.HOME, | 18 | // // initialRoute: Routes.HOME, |
30 | // ), | 19 | // ), |
@@ -3,16 +3,16 @@ version: 1.0.0+1 | @@ -3,16 +3,16 @@ version: 1.0.0+1 | ||
3 | publish_to: none | 3 | publish_to: none |
4 | description: A new Flutter project. | 4 | description: A new Flutter project. |
5 | environment: | 5 | environment: |
6 | - sdk: ">=2.19.2 <3.0.0" | 6 | + sdk: ">=2.12.0 <3.0.0" |
7 | 7 | ||
8 | dependencies: | 8 | dependencies: |
9 | cupertino_icons: ^1.0.2 | 9 | cupertino_icons: ^1.0.2 |
10 | + effective_dart: 1.3.1 | ||
10 | # get: ^4.1.4 | 11 | # get: ^4.1.4 |
11 | get: | 12 | get: |
12 | path: ../ | 13 | path: ../ |
13 | flutter: | 14 | flutter: |
14 | sdk: flutter | 15 | sdk: flutter |
15 | - flutter_lints: ^2.0.1 | ||
16 | 16 | ||
17 | dev_dependencies: | 17 | dev_dependencies: |
18 | flutter_test: | 18 | flutter_test: |
@@ -5,9 +5,6 @@ | @@ -5,9 +5,6 @@ | ||
5 | list(APPEND FLUTTER_PLUGIN_LIST | 5 | list(APPEND FLUTTER_PLUGIN_LIST |
6 | ) | 6 | ) |
7 | 7 | ||
8 | -list(APPEND FLUTTER_FFI_PLUGIN_LIST | ||
9 | -) | ||
10 | - | ||
11 | set(PLUGIN_BUNDLED_LIBRARIES) | 8 | set(PLUGIN_BUNDLED_LIBRARIES) |
12 | 9 | ||
13 | foreach(plugin ${FLUTTER_PLUGIN_LIST}) | 10 | foreach(plugin ${FLUTTER_PLUGIN_LIST}) |
@@ -16,8 +13,3 @@ foreach(plugin ${FLUTTER_PLUGIN_LIST}) | @@ -16,8 +13,3 @@ foreach(plugin ${FLUTTER_PLUGIN_LIST}) | ||
16 | list(APPEND PLUGIN_BUNDLED_LIBRARIES $<TARGET_FILE:${plugin}_plugin>) | 13 | list(APPEND PLUGIN_BUNDLED_LIBRARIES $<TARGET_FILE:${plugin}_plugin>) |
17 | list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries}) | 14 | list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries}) |
18 | endforeach(plugin) | 15 | endforeach(plugin) |
19 | - | ||
20 | -foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST}) | ||
21 | - add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/windows plugins/${ffi_plugin}) | ||
22 | - list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries}) | ||
23 | -endforeach(ffi_plugin) |
1 | -/// GetX is an extra-light and powerful multi-platform framework. | 1 | +/// GetX is an extra-light and powerful multiplatform framework. |
2 | /// It combines high performance state management, intelligent dependency | 2 | /// It combines high performance state management, intelligent dependency |
3 | /// injection, and route management in a quick and practical way. | 3 | /// injection, and route management in a quick and practical way. |
4 | library get; | 4 | library get; |
5 | 5 | ||
6 | -export 'get_animations/index.dart'; | ||
7 | export 'get_common/get_reset.dart'; | 6 | export 'get_common/get_reset.dart'; |
8 | export 'get_connect/connect.dart'; | 7 | export 'get_connect/connect.dart'; |
9 | export 'get_core/get_core.dart'; | 8 | export 'get_core/get_core.dart'; |
1 | import '../get.dart'; | 1 | import '../get.dart'; |
2 | 2 | ||
3 | extension GetResetExt on GetInterface { | 3 | extension GetResetExt on GetInterface { |
4 | - void reset({bool clearRouteBindings = true}) { | ||
5 | - Get.resetInstance(clearRouteBindings: clearRouteBindings); | ||
6 | - // Get.clearRouteTree(); | 4 | + void reset( |
5 | + {@deprecated bool clearFactory = true, bool clearRouteBindings = true}) { | ||
6 | + GetInstance().resetInstance(clearRouteBindings: clearRouteBindings); | ||
7 | + Get.clearRouteTree(); | ||
7 | Get.clearTranslations(); | 8 | Get.clearTranslations(); |
8 | - // Get.resetRootNavigator(); | 9 | + Get.resetRootNavigator(); |
9 | } | 10 | } |
10 | } | 11 | } |
@@ -12,7 +12,7 @@ export 'http/src/multipart/multipart_file.dart'; | @@ -12,7 +12,7 @@ export 'http/src/multipart/multipart_file.dart'; | ||
12 | export 'http/src/response/response.dart'; | 12 | export 'http/src/response/response.dart'; |
13 | export 'sockets/sockets.dart'; | 13 | export 'sockets/sockets.dart'; |
14 | 14 | ||
15 | -abstract class GetConnectInterface with GetLifeCycleMixin { | 15 | +abstract class GetConnectInterface with GetLifeCycleBase { |
16 | List<GetSocket>? sockets; | 16 | List<GetSocket>? sockets; |
17 | GetHttpClient get httpClient; | 17 | GetHttpClient get httpClient; |
18 | 18 | ||
@@ -100,7 +100,9 @@ class GetConnect extends GetConnectInterface { | @@ -100,7 +100,9 @@ class GetConnect extends GetConnectInterface { | ||
100 | this.maxAuthRetries = 1, | 100 | this.maxAuthRetries = 1, |
101 | this.allowAutoSignedCert = false, | 101 | this.allowAutoSignedCert = false, |
102 | this.withCredentials = false, | 102 | this.withCredentials = false, |
103 | - }); | 103 | + }) { |
104 | + $configureLifeCycle(); | ||
105 | + } | ||
104 | 106 | ||
105 | bool allowAutoSignedCert; | 107 | bool allowAutoSignedCert; |
106 | String userAgent; | 108 | String userAgent; |
@@ -278,7 +280,7 @@ class GetConnect extends GetConnectInterface { | @@ -278,7 +280,7 @@ class GetConnect extends GetConnectInterface { | ||
278 | return baseUrl == null ? url : baseUrl! + url; | 280 | return baseUrl == null ? url : baseUrl! + url; |
279 | } | 281 | } |
280 | 282 | ||
281 | - /// query allow made GraphQL raw queries | 283 | + /// query allow made GraphQL raw querys |
282 | /// final connect = GetConnect(); | 284 | /// final connect = GetConnect(); |
283 | /// connect.baseUrl = 'https://countries.trevorblades.com/'; | 285 | /// connect.baseUrl = 'https://countries.trevorblades.com/'; |
284 | /// final response = await connect.query( | 286 | /// final response = await connect.query( |
@@ -316,20 +318,17 @@ class GetConnect extends GetConnectInterface { | @@ -316,20 +318,17 @@ class GetConnect extends GetConnectInterface { | ||
316 | return GraphQLResponse<T>( | 318 | return GraphQLResponse<T>( |
317 | graphQLErrors: listError | 319 | graphQLErrors: listError |
318 | .map((e) => GraphQLError( | 320 | .map((e) => GraphQLError( |
319 | - code: (e['extensions'] != null | ||
320 | - ? e['extensions']['code'] ?? '' | ||
321 | - : '') | ||
322 | - .toString(), | ||
323 | - message: (e['message'] ?? '').toString(), | 321 | + code: e['extensions']['code']?.toString(), |
322 | + message: e['message']?.toString(), | ||
324 | )) | 323 | )) |
325 | .toList()); | 324 | .toList()); |
326 | } | 325 | } |
327 | return GraphQLResponse<T>.fromResponse(res); | 326 | return GraphQLResponse<T>.fromResponse(res); |
328 | - } on Exception catch (err) { | 327 | + } on Exception catch (_) { |
329 | return GraphQLResponse<T>(graphQLErrors: [ | 328 | return GraphQLResponse<T>(graphQLErrors: [ |
330 | GraphQLError( | 329 | GraphQLError( |
331 | code: null, | 330 | code: null, |
332 | - message: err.toString(), | 331 | + message: _.toString(), |
333 | ) | 332 | ) |
334 | ]); | 333 | ]); |
335 | } | 334 | } |
@@ -360,11 +359,11 @@ class GetConnect extends GetConnectInterface { | @@ -360,11 +359,11 @@ class GetConnect extends GetConnectInterface { | ||
360 | .toList()); | 359 | .toList()); |
361 | } | 360 | } |
362 | return GraphQLResponse<T>.fromResponse(res); | 361 | return GraphQLResponse<T>.fromResponse(res); |
363 | - } on Exception catch (err) { | 362 | + } on Exception catch (_) { |
364 | return GraphQLResponse<T>(graphQLErrors: [ | 363 | return GraphQLResponse<T>(graphQLErrors: [ |
365 | GraphQLError( | 364 | GraphQLError( |
366 | code: null, | 365 | code: null, |
367 | - message: err.toString(), | 366 | + message: _.toString(), |
368 | ) | 367 | ) |
369 | ]); | 368 | ]); |
370 | } | 369 | } |
1 | +List<int> fileToBytes(dynamic data) { | ||
2 | + if (data is List<int>) { | ||
3 | + return data; | ||
4 | + } else { | ||
5 | + throw const FormatException( | ||
6 | + 'File is not "File" or "String" or "List<int>"'); | ||
7 | + } | ||
8 | +} | ||
9 | + | ||
10 | +// void writeOnFile(List<int> bytes) { | ||
11 | +// var blob = html.Blob(["data"], 'text/plain', 'native'); | ||
12 | +// var anchorElement = html.AnchorElement( | ||
13 | +// href: html.Url.createObjectUrlFromBlob(blob).toString(), | ||
14 | +// ) | ||
15 | +// ..setAttribute("download", "data.txt") | ||
16 | +// ..click(); | ||
17 | +// } |
1 | +import 'dart:async'; | ||
2 | +// ignore: avoid_web_libraries_in_flutter | ||
3 | +import 'dart:html'; | ||
4 | + | ||
5 | +import '../../certificates/certificates.dart'; | ||
6 | +import '../../exceptions/exceptions.dart'; | ||
7 | +import '../../request/request.dart'; | ||
8 | +import '../../response/response.dart'; | ||
9 | +import '../interface/request_base.dart'; | ||
10 | +import '../utils/body_decoder.dart'; | ||
11 | + | ||
12 | +/// A `dart:html` implementation of `HttpRequestBase`. | ||
13 | +class HttpRequestImpl implements HttpRequestBase { | ||
14 | + HttpRequestImpl({ | ||
15 | + bool allowAutoSignedCert = true, | ||
16 | + List<TrustedCertificate>? trustedCertificates, | ||
17 | + this.withCredentials = false, | ||
18 | + String Function(Uri url)? findProxy, | ||
19 | + }); | ||
20 | + | ||
21 | + /// The currently active XHRs. | ||
22 | + final _xhrs = <HttpRequest>{}; | ||
23 | + | ||
24 | + ///This option requires that you submit credentials for requests | ||
25 | + ///on different sites. The default is false | ||
26 | + final bool withCredentials; | ||
27 | + | ||
28 | + @override | ||
29 | + Duration? timeout; | ||
30 | + | ||
31 | + /// Sends an HTTP request and asynchronously returns the response. | ||
32 | + @override | ||
33 | + Future<Response<T>> send<T>(Request<T> request) async { | ||
34 | + var bytes = await request.bodyBytes.toBytes(); | ||
35 | + HttpRequest xhr; | ||
36 | + | ||
37 | + xhr = HttpRequest() | ||
38 | + ..timeout = timeout?.inMilliseconds | ||
39 | + ..open(request.method, '${request.url}', async: true); // check this | ||
40 | + | ||
41 | + _xhrs.add(xhr); | ||
42 | + | ||
43 | + xhr | ||
44 | + ..responseType = 'blob' | ||
45 | + ..withCredentials = withCredentials; | ||
46 | + request.headers.forEach(xhr.setRequestHeader); | ||
47 | + | ||
48 | + var completer = Completer<Response<T>>(); | ||
49 | + xhr.onLoad.first.then((_) { | ||
50 | + var blob = xhr.response as Blob? ?? Blob([]); | ||
51 | + var reader = FileReader(); | ||
52 | + | ||
53 | + reader.onLoad.first.then((_) async { | ||
54 | + var bodyBytes = BodyBytesStream.fromBytes(reader.result as List<int>); | ||
55 | + | ||
56 | + final stringBody = | ||
57 | + await bodyBytesToString(bodyBytes, xhr.responseHeaders); | ||
58 | + | ||
59 | + String? contentType; | ||
60 | + | ||
61 | + if (xhr.responseHeaders.containsKey('content-type')) { | ||
62 | + contentType = xhr.responseHeaders['content-type']; | ||
63 | + } else { | ||
64 | + contentType = 'application/json'; | ||
65 | + } | ||
66 | + // xhr.responseHeaders.containsKey(key) | ||
67 | + final body = bodyDecoded<T>( | ||
68 | + request, | ||
69 | + stringBody, | ||
70 | + contentType, | ||
71 | + ); | ||
72 | + | ||
73 | + final response = Response<T>( | ||
74 | + bodyBytes: bodyBytes, | ||
75 | + statusCode: xhr.status, | ||
76 | + request: request, | ||
77 | + headers: xhr.responseHeaders, | ||
78 | + statusText: xhr.statusText, | ||
79 | + body: body, | ||
80 | + bodyString: stringBody, | ||
81 | + ); | ||
82 | + completer.complete(response); | ||
83 | + }); | ||
84 | + | ||
85 | + reader.onError.first.then((error) { | ||
86 | + completer.completeError( | ||
87 | + GetHttpException(error.toString(), request.url), | ||
88 | + StackTrace.current, | ||
89 | + ); | ||
90 | + }); | ||
91 | + | ||
92 | + reader.readAsArrayBuffer(blob); | ||
93 | + }); | ||
94 | + | ||
95 | + xhr.onError.first.then((_) { | ||
96 | + completer.completeError( | ||
97 | + GetHttpException('XMLHttpRequest error.', request.url), | ||
98 | + StackTrace.current); | ||
99 | + }); | ||
100 | + | ||
101 | + xhr.send(bytes); | ||
102 | + | ||
103 | + try { | ||
104 | + return await completer.future; | ||
105 | + } finally { | ||
106 | + _xhrs.remove(xhr); | ||
107 | + } | ||
108 | + } | ||
109 | + | ||
110 | + /// Closes the client and abort all active requests. | ||
111 | + @override | ||
112 | + void close() { | ||
113 | + for (var xhr in _xhrs) { | ||
114 | + xhr.abort(); | ||
115 | + } | ||
116 | + } | ||
117 | +} |
1 | +import 'dart:io'; | ||
2 | + | ||
3 | +List<int> fileToBytes(dynamic data) { | ||
4 | + if (data is File) { | ||
5 | + return data.readAsBytesSync(); | ||
6 | + } else if (data is String) { | ||
7 | + if (File(data).existsSync()) { | ||
8 | + return File(data).readAsBytesSync(); | ||
9 | + } else { | ||
10 | + throw 'File $data not exists'; | ||
11 | + } | ||
12 | + } else if (data is List<int>) { | ||
13 | + return data; | ||
14 | + } else { | ||
15 | + throw const FormatException( | ||
16 | + 'File is not "File" or "String" or "List<int>"'); | ||
17 | + } | ||
18 | +} | ||
19 | + | ||
20 | +void writeOnFile(List<int> bytes) {} |
1 | +import 'dart:async'; | ||
2 | +import 'dart:io' as io; | ||
3 | + | ||
4 | +import '../../certificates/certificates.dart'; | ||
5 | +import '../../exceptions/exceptions.dart'; | ||
6 | +import '../../request/request.dart'; | ||
7 | +import '../../response/response.dart'; | ||
8 | +import '../interface/request_base.dart'; | ||
9 | +import '../utils/body_decoder.dart'; | ||
10 | + | ||
11 | +/// A `dart:io` implementation of `HttpRequestBase`. | ||
12 | +class HttpRequestImpl extends HttpRequestBase { | ||
13 | + io.HttpClient? _httpClient; | ||
14 | + io.SecurityContext? _securityContext; | ||
15 | + | ||
16 | + HttpRequestImpl({ | ||
17 | + bool allowAutoSignedCert = true, | ||
18 | + List<TrustedCertificate>? trustedCertificates, | ||
19 | + bool withCredentials = false, | ||
20 | + String Function(Uri url)? findProxy, | ||
21 | + }) { | ||
22 | + _httpClient = io.HttpClient(); | ||
23 | + if (trustedCertificates != null) { | ||
24 | + _securityContext = io.SecurityContext(); | ||
25 | + for (final trustedCertificate in trustedCertificates) { | ||
26 | + _securityContext! | ||
27 | + .setTrustedCertificatesBytes(List.from(trustedCertificate.bytes)); | ||
28 | + } | ||
29 | + } | ||
30 | + | ||
31 | + _httpClient = io.HttpClient(context: _securityContext); | ||
32 | + _httpClient!.badCertificateCallback = (_, __, ___) => allowAutoSignedCert; | ||
33 | + _httpClient!.findProxy = findProxy; | ||
34 | + } | ||
35 | + | ||
36 | + @override | ||
37 | + Future<Response<T>> send<T>(Request<T> request) async { | ||
38 | + var stream = request.bodyBytes.asBroadcastStream(); | ||
39 | + io.HttpClientRequest? ioRequest; | ||
40 | + try { | ||
41 | + _httpClient!.connectionTimeout = timeout; | ||
42 | + ioRequest = (await _httpClient!.openUrl(request.method, request.url)) | ||
43 | + ..followRedirects = request.followRedirects | ||
44 | + ..persistentConnection = request.persistentConnection | ||
45 | + ..maxRedirects = request.maxRedirects | ||
46 | + ..contentLength = request.contentLength ?? -1; | ||
47 | + request.headers.forEach(ioRequest.headers.set); | ||
48 | + | ||
49 | + var response = timeout == null | ||
50 | + ? await stream.pipe(ioRequest) as io.HttpClientResponse | ||
51 | + : await stream.pipe(ioRequest).timeout(timeout!) | ||
52 | + as io.HttpClientResponse; | ||
53 | + | ||
54 | + var headers = <String, String>{}; | ||
55 | + response.headers.forEach((key, values) { | ||
56 | + headers[key] = values.join(','); | ||
57 | + }); | ||
58 | + | ||
59 | + final bodyBytes = (response); | ||
60 | + final stringBody = await bodyBytesToString(bodyBytes, headers); | ||
61 | + | ||
62 | + final body = bodyDecoded<T>( | ||
63 | + request, | ||
64 | + stringBody, | ||
65 | + response.headers.contentType?.mimeType, | ||
66 | + ); | ||
67 | + | ||
68 | + return Response( | ||
69 | + headers: headers, | ||
70 | + request: request, | ||
71 | + statusCode: response.statusCode, | ||
72 | + statusText: response.reasonPhrase, | ||
73 | + bodyBytes: bodyBytes, | ||
74 | + body: body, | ||
75 | + bodyString: stringBody, | ||
76 | + ); | ||
77 | + } on TimeoutException catch (_) { | ||
78 | + ioRequest?.abort(); | ||
79 | + rethrow; | ||
80 | + } on io.HttpException catch (error) { | ||
81 | + throw GetHttpException(error.message, error.uri); | ||
82 | + } | ||
83 | + } | ||
84 | + | ||
85 | + /// Closes the HttpClient. | ||
86 | + @override | ||
87 | + void close() { | ||
88 | + if (_httpClient != null) { | ||
89 | + _httpClient!.close(force: true); | ||
90 | + _httpClient = null; | ||
91 | + } | ||
92 | + } | ||
93 | +} | ||
94 | + | ||
95 | +// extension FileExt on io.FileSystemEntity { | ||
96 | +// String get fileName { | ||
97 | +// return this?.path?.split(io.Platform.pathSeparator)?.last; | ||
98 | +// } | ||
99 | +// } |
1 | +import '../../certificates/certificates.dart'; | ||
2 | +import '../../request/request.dart'; | ||
3 | +import '../../response/response.dart'; | ||
4 | +import '../interface/request_base.dart'; | ||
5 | + | ||
6 | +class HttpRequestImpl extends HttpRequestBase { | ||
7 | + HttpRequestImpl({ | ||
8 | + bool allowAutoSignedCert = true, | ||
9 | + List<TrustedCertificate>? trustedCertificates, | ||
10 | + bool withCredentials = false, | ||
11 | + String Function(Uri url)? findProxy, | ||
12 | + }); | ||
13 | + @override | ||
14 | + void close() {} | ||
15 | + | ||
16 | + @override | ||
17 | + Future<Response<T>> send<T>(Request<T> request) { | ||
18 | + throw UnimplementedError(); | ||
19 | + } | ||
20 | +} |
1 | +import '../../request/request.dart'; | ||
2 | +import '../../response/response.dart'; | ||
3 | + | ||
4 | +/// Abstract interface of [HttpRequestImpl]. | ||
5 | +abstract class HttpRequestBase { | ||
6 | + /// Sends an HTTP [Request]. | ||
7 | + Future<Response<T>> send<T>(Request<T> request); | ||
8 | + | ||
9 | + /// Closes the [Request] and cleans up any resources associated with it. | ||
10 | + void close(); | ||
11 | + | ||
12 | + /// Gets and sets the timeout. | ||
13 | + /// | ||
14 | + /// For mobile, this value will be applied for both connection and request | ||
15 | + /// timeout. | ||
16 | + /// | ||
17 | + /// For web, this value will be the request timeout. | ||
18 | + Duration? timeout; | ||
19 | +} |
1 | +import '../../request/request.dart'; | ||
2 | +import '../../response/response.dart'; | ||
3 | +import '../interface/request_base.dart'; | ||
4 | +import '../utils/body_decoder.dart'; | ||
5 | + | ||
6 | +typedef MockClientHandler = Future<Response> Function(Request request); | ||
7 | + | ||
8 | +class MockClient extends HttpRequestBase { | ||
9 | + /// The handler for than transforms request on response | ||
10 | + final MockClientHandler _handler; | ||
11 | + | ||
12 | + /// Creates a [MockClient] with a handler that receives [Request]s and sends | ||
13 | + /// [Response]s. | ||
14 | + MockClient(this._handler); | ||
15 | + | ||
16 | + @override | ||
17 | + Future<Response<T>> send<T>(Request<T> request) async { | ||
18 | + var requestBody = await request.bodyBytes.toBytes(); | ||
19 | + var bodyBytes = BodyBytesStream.fromBytes(requestBody); | ||
20 | + | ||
21 | + var response = await _handler(request); | ||
22 | + | ||
23 | + final stringBody = await bodyBytesToString(bodyBytes, response.headers!); | ||
24 | + | ||
25 | + var mimeType = response.headers!.containsKey('content-type') | ||
26 | + ? response.headers!['content-type'] | ||
27 | + : ''; | ||
28 | + | ||
29 | + final body = bodyDecoded<T>( | ||
30 | + request, | ||
31 | + stringBody, | ||
32 | + mimeType, | ||
33 | + ); | ||
34 | + return Response( | ||
35 | + headers: response.headers, | ||
36 | + request: request, | ||
37 | + statusCode: response.statusCode, | ||
38 | + statusText: response.statusText, | ||
39 | + bodyBytes: bodyBytes, | ||
40 | + body: body, | ||
41 | + bodyString: stringBody, | ||
42 | + ); | ||
43 | + } | ||
44 | + | ||
45 | + @override | ||
46 | + void close() {} | ||
47 | +} |
1 | +import 'dart:convert'; | ||
2 | + | ||
3 | +import '../../../../../get_core/get_core.dart'; | ||
4 | +import '../../request/request.dart'; | ||
5 | + | ||
6 | +T? bodyDecoded<T>(Request<T> request, String stringBody, String? mimeType) { | ||
7 | + T? body; | ||
8 | + dynamic bodyToDecode; | ||
9 | + | ||
10 | + if (mimeType != null && mimeType.contains('application/json')) { | ||
11 | + try { | ||
12 | + bodyToDecode = jsonDecode(stringBody); | ||
13 | + } on FormatException catch (_) { | ||
14 | + Get.log('Cannot decode server response to json'); | ||
15 | + bodyToDecode = stringBody; | ||
16 | + } | ||
17 | + } else { | ||
18 | + bodyToDecode = stringBody; | ||
19 | + } | ||
20 | + | ||
21 | + try { | ||
22 | + if (stringBody == '') { | ||
23 | + body = null; | ||
24 | + } else if (request.decoder == null) { | ||
25 | + body = bodyToDecode as T?; | ||
26 | + } else { | ||
27 | + body = request.decoder!(bodyToDecode); | ||
28 | + } | ||
29 | + } on Exception catch (_) { | ||
30 | + body = stringBody as T; | ||
31 | + } | ||
32 | + | ||
33 | + return body; | ||
34 | +} |
-
Please register or login to post a comment