Skip to content

Commit

Permalink
Adjustment in the sample code in the readme of all languages
Browse files Browse the repository at this point in the history
  • Loading branch information
edugemini committed Nov 25, 2020
1 parent a27d206 commit e51e645
Show file tree
Hide file tree
Showing 7 changed files with 57 additions and 32 deletions.
11 changes: 7 additions & 4 deletions README-es.md
Original file line number Diff line number Diff line change
Expand Up @@ -125,11 +125,13 @@ class Controller extends GetxController {
```dart
class Home extends StatelessWidget {
// Cree una instancia de su clase usando Get.put() para que esté disponible para todas las rutas "secundarias" allí.
final Controller c = Get.put(Controller());
@override
Widget build(context) => Scaffold(
Widget build(context) {
// Cree una instancia de su clase usando Get.put() para que esté disponible para todas las rutas "secundarias" allí.
final Controller c = Get.put(Controller());
return Scaffold(
// Utilice Obx(()=> para actualizar Text() siempre que se cambie el recuento.
appBar: AppBar(title: Obx(() => Text("Clicks: " + c.count.string))),
Expand All @@ -138,6 +140,7 @@ class Home extends StatelessWidget {
child: Text("Go to Other"), onPressed: () => Get.to(Other()))),
floatingActionButton:
FloatingActionButton(child: Icon(Icons.add), onPressed: c.increment));
}
}
class Other extends StatelessWidget {
Expand Down
11 changes: 7 additions & 4 deletions README.ko-kr.md
Original file line number Diff line number Diff line change
Expand Up @@ -123,11 +123,13 @@ class Controller extends GetxController{
```dart
class Home extends StatelessWidget {
// Get.put()을 사용하여 클래스를 인스턴스화하여 모든 "child'에서 사용가능하게 합니다.
final Controller c = Get.put(Controller());
@override
Widget build(context) => Scaffold(
Widget build(context) {
// Get.put()을 사용하여 클래스를 인스턴스화하여 모든 "child'에서 사용가능하게 합니다.
final Controller c = Get.put(Controller());
return Scaffold(
// count가 변경 될 때마다 Obx(()=> 를 사용하여 Text()에 업데이트합니다.
appBar: AppBar(title: Obx(() => Text("Clicks: ${c.count}"))),
Expand All @@ -136,6 +138,7 @@ class Home extends StatelessWidget {
child: Text("Go to Other"), onPressed: () => Get.to(Other()))),
floatingActionButton:
FloatingActionButton(child: Icon(Icons.add), onPressed: c.increment));
}
}
class Other extends StatelessWidget {
Expand Down
11 changes: 7 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -123,11 +123,13 @@ class Controller extends GetxController{
```dart
class Home extends StatelessWidget {
// Instantiate your class using Get.put() to make it available for all "child" routes there.
final Controller c = Get.put(Controller());
@override
Widget build(context) => Scaffold(
Widget build(context) {
// Instantiate your class using Get.put() to make it available for all "child" routes there.
final Controller c = Get.put(Controller());
return Scaffold(
// Use Obx(()=> to update Text() whenever count is changed.
appBar: AppBar(title: Obx(() => Text("Clicks: ${c.count}"))),
Expand All @@ -136,6 +138,7 @@ class Home extends StatelessWidget {
child: Text("Go to Other"), onPressed: () => Get.to(Other()))),
floatingActionButton:
FloatingActionButton(child: Icon(Icons.add), onPressed: c.increment));
}
}
class Other extends StatelessWidget {
Expand Down
11 changes: 7 additions & 4 deletions README.pl.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,11 +102,13 @@ Tworzymy View. Użyj StatelessWidget oszczędzajac przy tym RAM. Z Get nie będz
```dart
class Home extends StatelessWidget {
// Instantiate your class using Get.put() to make it available for all "child" routes there.
final Controller c = Get.put(Controller());
@override
Widget build(context) => Scaffold(
Widget build(context) {
// Instantiate your class using Get.put() to make it available for all "child" routes there.
final Controller c = Get.put(Controller());
return Scaffold(
// Use Obx(()=> to update Text() whenever count is changed.
appBar: AppBar(title: Obx(() => Text("Clicks: " + c.count.string))),
Expand All @@ -115,6 +117,7 @@ class Home extends StatelessWidget {
child: Text("Go to Other"), onPressed: () => Get.to(Other()))),
floatingActionButton:
FloatingActionButton(child: Icon(Icons.add), onPressed: c.increment));
}
}
class Other extends StatelessWidget {
Expand Down
23 changes: 15 additions & 8 deletions README.pt-br.md
Original file line number Diff line number Diff line change
Expand Up @@ -124,16 +124,23 @@ Crie sua View usando StatelessWidget, já que, usando Get, você não precisa ma

```dart
class Home extends StatelessWidget {
// Instancie sua classe usando Get.put() para torná-la disponível para todas as rotas subsequentes
final Controller c = Get.put(Controller());
@override
Widget build(context) => Scaffold(
appBar: AppBar(title: Obx(() => Text("Total de cliques: ${c.count}"))),
Widget build(context) {
// Instancie sua classe usando Get.put() para torná-la disponível para todas as rotas subsequentes
final Controller c = Get.put(Controller());
return Scaffold(
// Use Obx(()=> para atualizar Text() sempre que a contagem é alterada.
appBar: AppBar(title: Obx(() => Text("Total de cliques: ${c.count}"))),
// Troque o Navigator.push de 8 linhas por um simples Get.to(). Você não precisa do 'context'
body: Center(child: RaisedButton(
child: Text("Ir pra Outra tela"), onPressed: () => Get.to(Outra()))),
floatingActionButton: FloatingActionButton(child:
Icon(Icons.add), onPressed: c.increment));
body: Center(child: RaisedButton(
child: Text("Ir pra Outra tela"), onPressed: () => Get.to(Outra()))),
floatingActionButton:
FloatingActionButton(child: Icon(Icons.add), onPressed: c.increment));
}
}
class Outra extends StatelessWidget {
Expand Down
11 changes: 7 additions & 4 deletions README.ru.md
Original file line number Diff line number Diff line change
Expand Up @@ -118,11 +118,13 @@ class Controller extends GetxController{
```dart
class Home extends StatelessWidget {
// Instantiate your class using Get.put() to make it available for all "child" routes there.
final Controller c = Get.put(Controller());
@override
Widget build(context) => Scaffold(
Widget build(context) {
// Instantiate your class using Get.put() to make it available for all "child" routes there.
final Controller c = Get.put(Controller());
return Scaffold(
// Use Obx(()=> to update Text() whenever count is changed.
appBar: AppBar(title: Obx(() => Text("Clicks: ${c.count}"))),
Expand All @@ -131,6 +133,7 @@ class Home extends StatelessWidget {
child: Text("Go to Other"), onPressed: () => Get.to(Other()))),
floatingActionButton:
FloatingActionButton(child: Icon(Icons.add), onPressed: c.increment));
}
}
class Other extends StatelessWidget {
Expand Down
11 changes: 7 additions & 4 deletions README.zh-cn.md
Original file line number Diff line number Diff line change
Expand Up @@ -122,11 +122,13 @@ class Controller extends GetxController{
```dart
class Home extends StatelessWidget {
// 使用Get.put()实例化你的类,使其对当下的所有子路由可用。
final Controller c = Get.put(Controller());
@override
Widget build(context) => Scaffold(
Widget build(context) {
// 使用Get.put()实例化你的类,使其对当下的所有子路由可用。
final Controller c = Get.put(Controller());
return Scaffold(
// 使用Obx(()=>每当改变计数时,就更新Text()。
appBar: AppBar(title: Obx(() => Text("Clicks: ${c.count}"))),
Expand All @@ -135,6 +137,7 @@ class Home extends StatelessWidget {
child: Text("Go to Other"), onPressed: () => Get.to(Other()))),
floatingActionButton:
FloatingActionButton(child: Icon(Icons.add), onPressed: c.increment));
}
}
class Other extends StatelessWidget {
Expand Down

0 comments on commit e51e645

Please sign in to comment.