Eduardo Florence

Adjustment in the sample code in the readme of all languages

@@ -125,11 +125,13 @@ class Controller extends GetxController { @@ -125,11 +125,13 @@ class Controller extends GetxController {
125 ```dart 125 ```dart
126 class Home extends StatelessWidget { 126 class Home extends StatelessWidget {
127 127
  128 + @override
  129 + Widget build(context) {
  130 +
128 // Cree una instancia de su clase usando Get.put() para que esté disponible para todas las rutas "secundarias" allí. 131 // Cree una instancia de su clase usando Get.put() para que esté disponible para todas las rutas "secundarias" allí.
129 final Controller c = Get.put(Controller()); 132 final Controller c = Get.put(Controller());
130 133
131 - @override  
132 - Widget build(context) => Scaffold( 134 + return Scaffold(
133 // Utilice Obx(()=> para actualizar Text() siempre que se cambie el recuento. 135 // Utilice Obx(()=> para actualizar Text() siempre que se cambie el recuento.
134 appBar: AppBar(title: Obx(() => Text("Clicks: " + c.count.string))), 136 appBar: AppBar(title: Obx(() => Text("Clicks: " + c.count.string))),
135 137
@@ -138,6 +140,7 @@ class Home extends StatelessWidget { @@ -138,6 +140,7 @@ class Home extends StatelessWidget {
138 child: Text("Go to Other"), onPressed: () => Get.to(Other()))), 140 child: Text("Go to Other"), onPressed: () => Get.to(Other()))),
139 floatingActionButton: 141 floatingActionButton:
140 FloatingActionButton(child: Icon(Icons.add), onPressed: c.increment)); 142 FloatingActionButton(child: Icon(Icons.add), onPressed: c.increment));
  143 + }
141 } 144 }
142 145
143 class Other extends StatelessWidget { 146 class Other extends StatelessWidget {
@@ -123,11 +123,13 @@ class Controller extends GetxController{ @@ -123,11 +123,13 @@ class Controller extends GetxController{
123 ```dart 123 ```dart
124 class Home extends StatelessWidget { 124 class Home extends StatelessWidget {
125 125
  126 + @override
  127 + Widget build(context) {
  128 +
126 // Get.put()을 사용하여 클래스를 인스턴스화하여 모든 "child'에서 사용가능하게 합니다. 129 // Get.put()을 사용하여 클래스를 인스턴스화하여 모든 "child'에서 사용가능하게 합니다.
127 final Controller c = Get.put(Controller()); 130 final Controller c = Get.put(Controller());
128 131
129 - @override  
130 - Widget build(context) => Scaffold( 132 + return Scaffold(
131 // count가 변경 될 때마다 Obx(()=> 를 사용하여 Text()에 업데이트합니다. 133 // count가 변경 될 때마다 Obx(()=> 를 사용하여 Text()에 업데이트합니다.
132 appBar: AppBar(title: Obx(() => Text("Clicks: ${c.count}"))), 134 appBar: AppBar(title: Obx(() => Text("Clicks: ${c.count}"))),
133 135
@@ -136,6 +138,7 @@ class Home extends StatelessWidget { @@ -136,6 +138,7 @@ class Home extends StatelessWidget {
136 child: Text("Go to Other"), onPressed: () => Get.to(Other()))), 138 child: Text("Go to Other"), onPressed: () => Get.to(Other()))),
137 floatingActionButton: 139 floatingActionButton:
138 FloatingActionButton(child: Icon(Icons.add), onPressed: c.increment)); 140 FloatingActionButton(child: Icon(Icons.add), onPressed: c.increment));
  141 + }
139 } 142 }
140 143
141 class Other extends StatelessWidget { 144 class Other extends StatelessWidget {
@@ -123,11 +123,13 @@ class Controller extends GetxController{ @@ -123,11 +123,13 @@ class Controller extends GetxController{
123 ```dart 123 ```dart
124 class Home extends StatelessWidget { 124 class Home extends StatelessWidget {
125 125
  126 + @override
  127 + Widget build(context) {
  128 +
126 // Instantiate your class using Get.put() to make it available for all "child" routes there. 129 // Instantiate your class using Get.put() to make it available for all "child" routes there.
127 final Controller c = Get.put(Controller()); 130 final Controller c = Get.put(Controller());
128 131
129 - @override  
130 - Widget build(context) => Scaffold( 132 + return Scaffold(
131 // Use Obx(()=> to update Text() whenever count is changed. 133 // Use Obx(()=> to update Text() whenever count is changed.
132 appBar: AppBar(title: Obx(() => Text("Clicks: ${c.count}"))), 134 appBar: AppBar(title: Obx(() => Text("Clicks: ${c.count}"))),
133 135
@@ -136,6 +138,7 @@ class Home extends StatelessWidget { @@ -136,6 +138,7 @@ class Home extends StatelessWidget {
136 child: Text("Go to Other"), onPressed: () => Get.to(Other()))), 138 child: Text("Go to Other"), onPressed: () => Get.to(Other()))),
137 floatingActionButton: 139 floatingActionButton:
138 FloatingActionButton(child: Icon(Icons.add), onPressed: c.increment)); 140 FloatingActionButton(child: Icon(Icons.add), onPressed: c.increment));
  141 + }
139 } 142 }
140 143
141 class Other extends StatelessWidget { 144 class Other extends StatelessWidget {
@@ -102,11 +102,13 @@ Tworzymy View. Użyj StatelessWidget oszczędzajac przy tym RAM. Z Get nie będz @@ -102,11 +102,13 @@ Tworzymy View. Użyj StatelessWidget oszczędzajac przy tym RAM. Z Get nie będz
102 ```dart 102 ```dart
103 class Home extends StatelessWidget { 103 class Home extends StatelessWidget {
104 104
  105 + @override
  106 + Widget build(context) {
  107 +
105 // Instantiate your class using Get.put() to make it available for all "child" routes there. 108 // Instantiate your class using Get.put() to make it available for all "child" routes there.
106 final Controller c = Get.put(Controller()); 109 final Controller c = Get.put(Controller());
107 110
108 - @override  
109 - Widget build(context) => Scaffold( 111 + return Scaffold(
110 // Use Obx(()=> to update Text() whenever count is changed. 112 // Use Obx(()=> to update Text() whenever count is changed.
111 appBar: AppBar(title: Obx(() => Text("Clicks: " + c.count.string))), 113 appBar: AppBar(title: Obx(() => Text("Clicks: " + c.count.string))),
112 114
@@ -115,6 +117,7 @@ class Home extends StatelessWidget { @@ -115,6 +117,7 @@ class Home extends StatelessWidget {
115 child: Text("Go to Other"), onPressed: () => Get.to(Other()))), 117 child: Text("Go to Other"), onPressed: () => Get.to(Other()))),
116 floatingActionButton: 118 floatingActionButton:
117 FloatingActionButton(child: Icon(Icons.add), onPressed: c.increment)); 119 FloatingActionButton(child: Icon(Icons.add), onPressed: c.increment));
  120 + }
118 } 121 }
119 122
120 class Other extends StatelessWidget { 123 class Other extends StatelessWidget {
@@ -124,16 +124,23 @@ Crie sua View usando StatelessWidget, já que, usando Get, você não precisa ma @@ -124,16 +124,23 @@ Crie sua View usando StatelessWidget, já que, usando Get, você não precisa ma
124 124
125 ```dart 125 ```dart
126 class Home extends StatelessWidget { 126 class Home extends StatelessWidget {
  127 +
  128 + @override
  129 + Widget build(context) {
  130 +
127 // Instancie sua classe usando Get.put() para torná-la disponível para todas as rotas subsequentes 131 // Instancie sua classe usando Get.put() para torná-la disponível para todas as rotas subsequentes
128 final Controller c = Get.put(Controller()); 132 final Controller c = Get.put(Controller());
129 - @override  
130 - Widget build(context) => Scaffold( 133 +
  134 + return Scaffold(
  135 + // Use Obx(()=> para atualizar Text() sempre que a contagem é alterada.
131 appBar: AppBar(title: Obx(() => Text("Total de cliques: ${c.count}"))), 136 appBar: AppBar(title: Obx(() => Text("Total de cliques: ${c.count}"))),
  137 +
132 // Troque o Navigator.push de 8 linhas por um simples Get.to(). Você não precisa do 'context' 138 // Troque o Navigator.push de 8 linhas por um simples Get.to(). Você não precisa do 'context'
133 body: Center(child: RaisedButton( 139 body: Center(child: RaisedButton(
134 child: Text("Ir pra Outra tela"), onPressed: () => Get.to(Outra()))), 140 child: Text("Ir pra Outra tela"), onPressed: () => Get.to(Outra()))),
135 - floatingActionButton: FloatingActionButton(child:  
136 - Icon(Icons.add), onPressed: c.increment)); 141 + floatingActionButton:
  142 + FloatingActionButton(child: Icon(Icons.add), onPressed: c.increment));
  143 + }
137 } 144 }
138 145
139 class Outra extends StatelessWidget { 146 class Outra extends StatelessWidget {
@@ -118,11 +118,13 @@ class Controller extends GetxController{ @@ -118,11 +118,13 @@ class Controller extends GetxController{
118 ```dart 118 ```dart
119 class Home extends StatelessWidget { 119 class Home extends StatelessWidget {
120 120
  121 + @override
  122 + Widget build(context) {
  123 +
121 // Instantiate your class using Get.put() to make it available for all "child" routes there. 124 // Instantiate your class using Get.put() to make it available for all "child" routes there.
122 final Controller c = Get.put(Controller()); 125 final Controller c = Get.put(Controller());
123 126
124 - @override  
125 - Widget build(context) => Scaffold( 127 + return Scaffold(
126 // Use Obx(()=> to update Text() whenever count is changed. 128 // Use Obx(()=> to update Text() whenever count is changed.
127 appBar: AppBar(title: Obx(() => Text("Clicks: ${c.count}"))), 129 appBar: AppBar(title: Obx(() => Text("Clicks: ${c.count}"))),
128 130
@@ -131,6 +133,7 @@ class Home extends StatelessWidget { @@ -131,6 +133,7 @@ class Home extends StatelessWidget {
131 child: Text("Go to Other"), onPressed: () => Get.to(Other()))), 133 child: Text("Go to Other"), onPressed: () => Get.to(Other()))),
132 floatingActionButton: 134 floatingActionButton:
133 FloatingActionButton(child: Icon(Icons.add), onPressed: c.increment)); 135 FloatingActionButton(child: Icon(Icons.add), onPressed: c.increment));
  136 + }
134 } 137 }
135 138
136 class Other extends StatelessWidget { 139 class Other extends StatelessWidget {
@@ -122,11 +122,13 @@ class Controller extends GetxController{ @@ -122,11 +122,13 @@ class Controller extends GetxController{
122 ```dart 122 ```dart
123 class Home extends StatelessWidget { 123 class Home extends StatelessWidget {
124 124
  125 + @override
  126 + Widget build(context) {
  127 +
125 // 使用Get.put()实例化你的类,使其对当下的所有子路由可用。 128 // 使用Get.put()实例化你的类,使其对当下的所有子路由可用。
126 final Controller c = Get.put(Controller()); 129 final Controller c = Get.put(Controller());
127 130
128 - @override  
129 - Widget build(context) => Scaffold( 131 + return Scaffold(
130 // 使用Obx(()=>每当改变计数时,就更新Text()。 132 // 使用Obx(()=>每当改变计数时,就更新Text()。
131 appBar: AppBar(title: Obx(() => Text("Clicks: ${c.count}"))), 133 appBar: AppBar(title: Obx(() => Text("Clicks: ${c.count}"))),
132 134
@@ -135,6 +137,7 @@ class Home extends StatelessWidget { @@ -135,6 +137,7 @@ class Home extends StatelessWidget {
135 child: Text("Go to Other"), onPressed: () => Get.to(Other()))), 137 child: Text("Go to Other"), onPressed: () => Get.to(Other()))),
136 floatingActionButton: 138 floatingActionButton:
137 FloatingActionButton(child: Icon(Icons.add), onPressed: c.increment)); 139 FloatingActionButton(child: Icon(Icons.add), onPressed: c.increment));
  140 + }
138 } 141 }
139 142
140 class Other extends StatelessWidget { 143 class Other extends StatelessWidget {