Jonny Borges

fix changeThemeMode and Rxlist

  1 +## [5.0.0-release-candidate-4]
  2 +-Fix changeThemeMode and RxList
  3 +
  4 +## [5.0.0-release-candidate-3]
  5 +-Fix changeTheme
  6 +
1 ## [5.0.0-release-candidate-2] 7 ## [5.0.0-release-candidate-2]
2 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. 8 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.
3 9
@@ -4,7 +4,7 @@ @@ -4,7 +4,7 @@
4 # This file should be version controlled. 4 # This file should be version controlled.
5 5
6 version: 6 version:
7 - revision: 9944297138845a94256f1cf37beb88ff9a8e811a 7 + revision: c07f7888888435fd9df505aa2efc38d3cf65681b
8 channel: stable 8 channel: stable
9 9
10 project_type: app 10 project_type: app
@@ -13,26 +13,26 @@ project_type: app @@ -13,26 +13,26 @@ project_type: app
13 migration: 13 migration:
14 platforms: 14 platforms:
15 - platform: root 15 - platform: root
16 - create_revision: 9944297138845a94256f1cf37beb88ff9a8e811a  
17 - base_revision: 9944297138845a94256f1cf37beb88ff9a8e811a 16 + create_revision: c07f7888888435fd9df505aa2efc38d3cf65681b
  17 + base_revision: c07f7888888435fd9df505aa2efc38d3cf65681b
18 - platform: android 18 - platform: android
19 - create_revision: 9944297138845a94256f1cf37beb88ff9a8e811a  
20 - base_revision: 9944297138845a94256f1cf37beb88ff9a8e811a 19 + create_revision: c07f7888888435fd9df505aa2efc38d3cf65681b
  20 + base_revision: c07f7888888435fd9df505aa2efc38d3cf65681b
21 - platform: ios 21 - platform: ios
22 - create_revision: 9944297138845a94256f1cf37beb88ff9a8e811a  
23 - base_revision: 9944297138845a94256f1cf37beb88ff9a8e811a 22 + create_revision: c07f7888888435fd9df505aa2efc38d3cf65681b
  23 + base_revision: c07f7888888435fd9df505aa2efc38d3cf65681b
24 - platform: linux 24 - platform: linux
25 - create_revision: 9944297138845a94256f1cf37beb88ff9a8e811a  
26 - base_revision: 9944297138845a94256f1cf37beb88ff9a8e811a 25 + create_revision: c07f7888888435fd9df505aa2efc38d3cf65681b
  26 + base_revision: c07f7888888435fd9df505aa2efc38d3cf65681b
27 - platform: macos 27 - platform: macos
28 - create_revision: 9944297138845a94256f1cf37beb88ff9a8e811a  
29 - base_revision: 9944297138845a94256f1cf37beb88ff9a8e811a 28 + create_revision: c07f7888888435fd9df505aa2efc38d3cf65681b
  29 + base_revision: c07f7888888435fd9df505aa2efc38d3cf65681b
30 - platform: web 30 - platform: web
31 - create_revision: 9944297138845a94256f1cf37beb88ff9a8e811a  
32 - base_revision: 9944297138845a94256f1cf37beb88ff9a8e811a 31 + create_revision: c07f7888888435fd9df505aa2efc38d3cf65681b
  32 + base_revision: c07f7888888435fd9df505aa2efc38d3cf65681b
33 - platform: windows 33 - platform: windows
34 - create_revision: 9944297138845a94256f1cf37beb88ff9a8e811a  
35 - base_revision: 9944297138845a94256f1cf37beb88ff9a8e811a 34 + create_revision: c07f7888888435fd9df505aa2efc38d3cf65681b
  35 + base_revision: c07f7888888435fd9df505aa2efc38d3cf65681b
36 36
37 # User provided section 37 # User provided section
38 38
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 'lang/translation_service.dart';  
5 -import 'routes/app_pages.dart';  
6 -import 'shared/logger/logger_utils.dart'; 4 +// void main() {
  5 +// runApp(const MyApp());
  6 +// }
  7 +
  8 +// class MyApp extends StatelessWidget {
  9 +// const MyApp({Key? key}) : super(key: key);
7 10
  11 +// @override
  12 +// Widget build(BuildContext context) {
  13 +// return GetMaterialApp(
  14 +// debugShowCheckedModeBanner: false,
  15 +// enableLog: true,
  16 +// logWriterCallback: Logger.write,
  17 +// initialRoute: AppPages.INITIAL,
  18 +// getPages: AppPages.routes,
  19 +// locale: TranslationService.locale,
  20 +// fallbackLocale: TranslationService.fallbackLocale,
  21 +// translations: TranslationService(),
  22 +// );
  23 +// }
  24 +// }
  25 +
  26 +/// Nav 2 snippet
8 void main() { 27 void main() {
9 runApp(const MyApp()); 28 runApp(const MyApp());
10 } 29 }
@@ -15,115 +34,103 @@ class MyApp extends StatelessWidget { @@ -15,115 +34,103 @@ class MyApp extends StatelessWidget {
15 @override 34 @override
16 Widget build(BuildContext context) { 35 Widget build(BuildContext context) {
17 return GetMaterialApp( 36 return GetMaterialApp(
  37 + getPages: [
  38 + GetPage(
  39 + participatesInRootNavigator: true,
  40 + name: '/first',
  41 + page: () => const First()),
  42 + GetPage(
  43 + name: '/second',
  44 + page: () => const Second(),
  45 + ),
  46 + GetPage(
  47 + name: '/third',
  48 + page: () => const Third(),
  49 + ),
  50 + ],
18 debugShowCheckedModeBanner: false, 51 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(),  
26 ); 52 );
27 } 53 }
28 } 54 }
29 55
30 -/// Nav 2 snippet  
31 -// void main() {  
32 -// runApp(MyApp());  
33 -// } 56 +class First extends StatelessWidget {
  57 + const First({Key? key}) : super(key: key);
34 58
35 -// class MyApp extends StatelessWidget {  
36 -// MyApp({Key? key}) : super(key: key); 59 + @override
  60 + Widget build(BuildContext context) {
  61 + print('First rebuild');
  62 + return Scaffold(
  63 + appBar: AppBar(
  64 + title: const Text('page one'),
  65 + leading: IconButton(
  66 + icon: const Icon(Icons.more),
  67 + onPressed: () {
  68 + print('THEME CHANGED');
  69 + Get.changeTheme(
  70 + Get.isDarkMode ? ThemeData.light() : ThemeData.dark());
  71 + },
  72 + ),
  73 + ),
  74 + body: Center(
  75 + child: SizedBox(
  76 + height: 300,
  77 + width: 300,
  78 + child: ElevatedButton(
  79 + onPressed: () {
  80 + Get.toNamed('/second?id=123');
  81 + },
  82 + child: const Text('next screen'),
  83 + ),
  84 + ),
  85 + ),
  86 + );
  87 + }
  88 +}
37 89
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 -// } 90 +class Second extends StatelessWidget {
  91 + const Second({Key? key}) : super(key: key);
59 92
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 -// } 93 + @override
  94 + Widget build(BuildContext context) {
  95 + print('second rebuild');
  96 + return Scaffold(
  97 + appBar: AppBar(
  98 + title: Text('page two ${Get.parameters["id"]}'),
  99 + ),
  100 + body: Center(
  101 + child: SizedBox(
  102 + height: 300,
  103 + width: 300,
  104 + child: ElevatedButton(
  105 + onPressed: () {},
  106 + child: const Text('next screen'),
  107 + ),
  108 + ),
  109 + ),
  110 + );
  111 + }
  112 +}
87 113
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 -// } 114 +class Third extends StatelessWidget {
  115 + const Third({Key? key}) : super(key: key);
108 116
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 -// } 117 + @override
  118 + Widget build(BuildContext context) {
  119 + return Scaffold(
  120 + backgroundColor: Colors.red,
  121 + appBar: AppBar(
  122 + title: const Text('page three'),
  123 + ),
  124 + body: Center(
  125 + child: SizedBox(
  126 + height: 300,
  127 + width: 300,
  128 + child: ElevatedButton(
  129 + onPressed: () {},
  130 + child: const Text('go to first screen'),
  131 + ),
  132 + ),
  133 + ),
  134 + );
  135 + }
  136 +}
@@ -438,7 +438,7 @@ class GetRootState extends State<GetRoot> with WidgetsBindingObserver { @@ -438,7 +438,7 @@ class GetRootState extends State<GetRoot> with WidgetsBindingObserver {
438 } 438 }
439 439
440 Transition? getThemeTransition() { 440 Transition? getThemeTransition() {
441 - final platform = Get.theme.platform; 441 + final platform = context.theme.platform;
442 final matchingTransition = 442 final matchingTransition =
443 Get.theme.pageTransitionsTheme.builders[platform]; 443 Get.theme.pageTransitionsTheme.builders[platform];
444 switch (matchingTransition) { 444 switch (matchingTransition) {
@@ -489,7 +489,10 @@ class GetRootState extends State<GetRoot> with WidgetsBindingObserver { @@ -489,7 +489,10 @@ class GetRootState extends State<GetRoot> with WidgetsBindingObserver {
489 } 489 }
490 490
491 void update() { 491 void update() {
492 - setState(() {}); 492 + context.visitAncestorElements((element) {
  493 + element.markNeedsBuild();
  494 + return false;
  495 + });
493 } 496 }
494 497
495 GlobalKey<NavigatorState> get key => rootDelegate.navigatorKey; 498 GlobalKey<NavigatorState> get key => rootDelegate.navigatorKey;
@@ -48,7 +48,7 @@ class RxList<E> extends GetListenable<List<E>> @@ -48,7 +48,7 @@ class RxList<E> extends GetListenable<List<E>>
48 @override 48 @override
49 RxList<E> operator +(Iterable<E> val) { 49 RxList<E> operator +(Iterable<E> val) {
50 addAll(val); 50 addAll(val);
51 - refresh(); 51 + // refresh();
52 return this; 52 return this;
53 } 53 }
54 54
@@ -113,11 +113,11 @@ class RxList<E> extends GetListenable<List<E>> @@ -113,11 +113,11 @@ class RxList<E> extends GetListenable<List<E>>
113 @override 113 @override
114 Iterable<E> get reversed => value.reversed; 114 Iterable<E> get reversed => value.reversed;
115 115
116 - @override  
117 - set value(List<E> val) {  
118 - value = val;  
119 - refresh();  
120 - } 116 + // @override
  117 + // set value(List<E> val) {
  118 + // value = val;
  119 + // refresh();
  120 + // }
121 121
122 @override 122 @override
123 Iterable<E> where(bool Function(E) test) { 123 Iterable<E> where(bool Function(E) test) {
@@ -8,7 +8,7 @@ class RxSet<E> extends GetListenable<Set<E>> @@ -8,7 +8,7 @@ class RxSet<E> extends GetListenable<Set<E>>
8 /// inside the List, 8 /// inside the List,
9 RxSet<E> operator +(Set<E> val) { 9 RxSet<E> operator +(Set<E> val) {
10 addAll(val); 10 addAll(val);
11 - refresh(); 11 + //refresh();
12 return this; 12 return this;
13 } 13 }
14 14
@@ -25,13 +25,13 @@ class RxSet<E> extends GetListenable<Set<E>> @@ -25,13 +25,13 @@ class RxSet<E> extends GetListenable<Set<E>>
25 // // return _value; 25 // // return _value;
26 // } 26 // }
27 27
28 - @override  
29 - @protected  
30 - set value(Set<E> val) {  
31 - if (value == val) return;  
32 - value = val;  
33 - refresh();  
34 - } 28 + // @override
  29 + // @protected
  30 + // set value(Set<E> val) {
  31 + // if (value == val) return;
  32 + // value = val;
  33 + // refresh();
  34 + // }
35 35
36 @override 36 @override
37 bool add(E value) { 37 bool add(E value) {
1 name: get 1 name: get
2 description: Open screens/snackbars/dialogs without context, manage states and inject dependencies easily with GetX. 2 description: Open screens/snackbars/dialogs without context, manage states and inject dependencies easily with GetX.
3 -version: 5.0.0-release-candidate-2 3 +version: 5.0.0-release-candidate-4
4 homepage: https://github.com/jonataslaw/getx 4 homepage: https://github.com/jonataslaw/getx
5 5
6 environment: 6 environment: