Jonny Borges
Committed by GitHub

Merge pull request #321 from Nipodemos/update_docs

[Docs] update main README english and pt-br
@@ -14,6 +14,7 @@ @@ -14,6 +14,7 @@
14 [![All Contributors](https://img.shields.io/badge/all_contributors-4-orange.svg?style=flat-square)](#contributors-) 14 [![All Contributors](https://img.shields.io/badge/all_contributors-4-orange.svg?style=flat-square)](#contributors-)
15 <!-- ALL-CONTRIBUTORS-BADGE:END --> 15 <!-- ALL-CONTRIBUTORS-BADGE:END -->
16 - [About Get](#about-get) 16 - [About Get](#about-get)
  17 +- [Installing](#installing)
17 - [The Three pillars](#the-three-pillars) 18 - [The Three pillars](#the-three-pillars)
18 - [State management](#state-management) 19 - [State management](#state-management)
19 - [In-depth explanation](#in-depth-explanation) 20 - [In-depth explanation](#in-depth-explanation)
@@ -33,10 +34,27 @@ @@ -33,10 +34,27 @@
33 34
34 - GetX is an extra-light and powerful solution for Flutter. It combines high performance state management, intelligent dependency injection, and route management in a quick and practical way. 35 - GetX is an extra-light and powerful solution for Flutter. It combines high performance state management, intelligent dependency injection, and route management in a quick and practical way.
35 - GetX is not for everyone, its focus is (performance) on the minimum consumption of resources ([look the benchmarks](https://github.com/jonataslaw/benchmarks)), (productivity) using an easy and pleasant syntax and (organization) allowing the total decoupling of the View from the business logic. 36 - GetX is not for everyone, its focus is (performance) on the minimum consumption of resources ([look the benchmarks](https://github.com/jonataslaw/benchmarks)), (productivity) using an easy and pleasant syntax and (organization) allowing the total decoupling of the View from the business logic.
36 -- GetX will save hours of development, and will extract the maximum performance that your application can deliver, being easy for beginners, and accurate for experts. Navigate without context, open dialogs, snackbars or bottomsheets from anywhere in your code, Manage states and inject dependencies in an easy and practical way. Get is secure, stable, up-to-date, and offers a huge range of APIs that are not present on default framework. 37 +- GetX will save hours of development, and will extract the maximum performance that your application can deliver, being easy for beginners, and accurate for experts.
  38 +- Navigate without `context`, open `dialogs`, `snackbars` or `bottomsheets` from anywhere in your code, Manage states and inject dependencies in an easy and practical way.
  39 +- Get is secure, stable, up-to-date, and offers a huge range of APIs that are not present on default framework.
37 - GetX is not a bloc. It has a multitude of features that allow you to start programming without worrying about anything, but each of these features are in separate containers, and are only started after use. If you only use State Management, only State Management will be compiled. If you only use routes, nothing from the state management will be compiled. You can compile the benchmark repository, and you will see that using only Get state management, the application compiled with Get has become smaller than all other applications that have only the state management of other packages, because nothing that is not used will be compiled into your code, and each GetX solution was designed to be extra lightweight. The merit here also comes from Flutter's AOT which is incredible, and manages to eliminate unused resources like no other framework does. 40 - GetX is not a bloc. It has a multitude of features that allow you to start programming without worrying about anything, but each of these features are in separate containers, and are only started after use. If you only use State Management, only State Management will be compiled. If you only use routes, nothing from the state management will be compiled. You can compile the benchmark repository, and you will see that using only Get state management, the application compiled with Get has become smaller than all other applications that have only the state management of other packages, because nothing that is not used will be compiled into your code, and each GetX solution was designed to be extra lightweight. The merit here also comes from Flutter's AOT which is incredible, and manages to eliminate unused resources like no other framework does.
38 41
39 -**GetX makes your development productive, but want to make it even more productive? Add the extension [GetX extension to VSCode](https://marketplace.visualstudio.com/items?itemName=get-snippets.get-snippets) to your VSCode** 42 +**GetX makes your development productive, but want to make it even more productive? Add the extension [GetX extension](https://marketplace.visualstudio.com/items?itemName=get-snippets.get-snippets) to your VSCode**. Not available in other IDEs for now.
  43 +
  44 +# Installing
  45 +
  46 +Add Get to your pubspec.yaml file:
  47 +
  48 +```yaml
  49 +dependencies:
  50 + get:
  51 +```
  52 +
  53 +Import get in files that it will be used:
  54 +
  55 +```dart
  56 +import 'package:get/get.dart';
  57 +```
40 58
41 # The Three pillars 59 # The Three pillars
42 60
@@ -103,7 +121,7 @@ This is a simple project but it already makes clear how powerful Get is. As your @@ -103,7 +121,7 @@ This is a simple project but it already makes clear how powerful Get is. As your
103 121
104 ### In-depth explanation 122 ### In-depth explanation
105 123
106 -**See an more in-depth explanation of state management [here](./docs/en_US/state_management.md). There you will see more examples and also the differente between the simple stage manager and the reactive state manager** 124 +**See an more in-depth explanation of state management [here](./docs/en_US/state_management.md). There you will see more examples and also the difference between the simple stage manager and the reactive state manager**
107 125
108 ## Route management 126 ## Route management
109 127
@@ -237,43 +255,63 @@ If you want to know in depth how to change the theme, you can follow this tutori @@ -237,43 +255,63 @@ If you want to know in depth how to change the theme, you can follow this tutori
237 ## Other Advanced APIs 255 ## Other Advanced APIs
238 256
239 ```dart 257 ```dart
240 -Get.arguments // give the current args from currentScreen 258 +// give the current args from currentScreen
  259 +Get.arguments
241 260
242 -Get.previousArguments // give arguments of previous route 261 +// give arguments of previous route
  262 +Get.previousArguments
243 263
244 -Get.previousRoute // give name of previous route 264 +// give name of previous route
  265 +Get.previousRoute
245 266
246 -Get.rawRoute // give the raw route to access for example, rawRoute.isFirst() 267 +// give the raw route to access for example, rawRoute.isFirst()
  268 +Get.rawRoute
247 269
248 -Get.routing // give access to Rounting API from GetObserver 270 +// give access to Rounting API from GetObserver
  271 +Get.routing
249 272
250 -Get.isSnackbarOpen // check if snackbar is open 273 +// check if snackbar is open
  274 +Get.isSnackbarOpen
251 275
252 -Get.isDialogOpen // check if dialog is open 276 +// check if dialog is open
  277 +Get.isDialogOpen
253 278
254 -Get.isBottomSheetOpen // check if bottomsheet is open 279 +// check if bottomsheet is open
  280 +Get.isBottomSheetOpen
255 281
256 -Get.removeRoute() // remove one route. 282 +// remove one route.
  283 +Get.removeRoute()
257 284
258 -Get.until() // back repeatedly until the predicate returns true. 285 +// back repeatedly until the predicate returns true.
  286 +Get.until()
259 287
260 -Get.offUntil() // go to next route and remove all the previous routes until the predicate returns true. 288 +// go to next route and remove all the previous routes until the predicate returns true.
  289 +Get.offUntil()
261 290
262 -Get.offNamedUntil() // go to next named route and remove all the previous routes until the predicate returns true. 291 +// go to next named route and remove all the previous routes until the predicate returns true.
  292 +Get.offNamedUntil()
263 293
264 -GetPlatform.isAndroid/isIOS/isWeb... //(This method is completely compatible with FlutterWeb, unlike the framework. "Platform.isAndroid") 294 +//Check in what platform the app is running
  295 +GetPlatform.isAndroid
  296 +GetPlatform.isIOS
  297 +GetPlatform.isWeb
265 298
266 -Get.height / Get.width // Equivalent to the method: MediaQuery.of(context).size.height, but they are immutable. If you need a changeable height/width (like browser windows that can be scaled) you will need to use context.height and context.width 299 +// Equivalent to the method: MediaQuery.of(context).size.height, but they are immutable.
  300 +// If you need a changeable height/width (like browser windows that can be scaled) you will need to use context.
  301 +Get.height
  302 +Get.width
267 303
268 -Get.context // Gives the context of the screen in the foreground anywhere in your code. 304 +// Gives the context of the screen in the foreground anywhere in your code.
  305 +Get.context
269 306
270 -Get.contextOverlay // Gives the context of the snackbar/dialog/bottomsheet in the foreground anywhere in your code. 307 +// Gives the context of the snackbar/dialog/bottomsheet in the foreground anywhere in your code.
  308 +Get.contextOverlay
271 309
272 ``` 310 ```
273 311
274 ### Optional Global Settings and Manual configurations 312 ### Optional Global Settings and Manual configurations
275 313
276 -GetMaterialApp configures everything for you, but if you want to configure Get Manually using advanced APIs. 314 +GetMaterialApp configures everything for you, but if you want to configure Get manually.
277 315
278 ```dart 316 ```dart
279 MaterialApp( 317 MaterialApp(
@@ -287,7 +325,9 @@ You will also be able to use your own Middleware within GetObserver, this will n @@ -287,7 +325,9 @@ You will also be able to use your own Middleware within GetObserver, this will n
287 ```dart 325 ```dart
288 MaterialApp( 326 MaterialApp(
289 navigatorKey: Get.key, 327 navigatorKey: Get.key,
290 - navigatorObservers: [GetObserver(MiddleWare.observer)], // Here 328 + navigatorObservers: [
  329 + GetObserver(MiddleWare.observer) // Here
  330 + ],
291 ); 331 );
292 ``` 332 ```
293 333
@@ -313,17 +353,15 @@ Get.config( @@ -313,17 +353,15 @@ Get.config(
313 # Breaking changes from 2.0 353 # Breaking changes from 2.0
314 354
315 1- Rx types: 355 1- Rx types:
316 -Before: StringX now: RxString  
317 356
318 -Before: IntX now: RxInt  
319 -  
320 -Before: MapX now: RxMax  
321 -  
322 -Before: ListX now: RxList  
323 -  
324 -Before: NumX now: RxNum  
325 -  
326 -Before: RxDouble now: RxDouble 357 +| Before | After |
  358 +| -------- | ---------- |
  359 +| StringX | `RxString` |
  360 +| IntX | `RxInt` |
  361 +| MapX | `RxMax` |
  362 +| ListX | `RxList` |
  363 +| NumX | `RxNum` |
  364 +| RxDouble | `RxDouble` |
327 365
328 RxController and GetBuilder now have merged, you no longer need to memorize which controller you want to use, just use GetxController, it will work for simple state management and for reactive as well. 366 RxController and GetBuilder now have merged, you no longer need to memorize which controller you want to use, just use GetxController, it will work for simple state management and for reactive as well.
329 367
@@ -365,8 +403,6 @@ GetMaterialApp( @@ -365,8 +403,6 @@ GetMaterialApp(
365 ) 403 )
366 ``` 404 ```
367 405
368 -This library will always be updated and implementing new features. Feel free to offer PRs and contribute to them.  
369 -  
370 # Why I made this package 406 # Why I made this package
371 407
372 The problem that this package tries to solve is to have most of what you need in only one package. One day, when i update some of my apps to work with Flutter 1.9, something bad happened: Everything broke. 408 The problem that this package tries to solve is to have most of what you need in only one package. One day, when i update some of my apps to work with Flutter 1.9, something bad happened: Everything broke.
@@ -381,4 +417,6 @@ I know this looks a lot like the package being based on my personal experiences, @@ -381,4 +417,6 @@ I know this looks a lot like the package being based on my personal experiences,
381 417
382 Every time I go through a frustrating experience, I write it down in my schedule, and try to resolve it after completing the project. 418 Every time I go through a frustrating experience, I write it down in my schedule, and try to resolve it after completing the project.
383 419
384 -And then I decided to make a package that have the three things that you will always use: State management, route management, Dependency injection/management, internationalization, and storage (the last two are still being made) 420 +And then I decided to make a package that have the three things that you will always use: State management, route management, Dependency injection/management. Eventually i made internationalization, and storage (the last two are still being made)
  421 +
  422 +This library will always be updated and implementing new features. Feel free to offer PRs and contribute to them.
1 ![](get.png) 1 ![](get.png)
2 2
3 -*Idiomas: [Inglês](README.md), Português Brasileiro (este arquivo), [Spanish](README-es.md).* 3 +*Idiomas: [Inglês](README.md), Português Brasileiro (este arquivo), [Espanhol](README-es.md).*
4 4
5 [![pub package](https://img.shields.io/pub/v/get.svg?label=get&color=blue)](https://pub.dev/packages/get) 5 [![pub package](https://img.shields.io/pub/v/get.svg?label=get&color=blue)](https://pub.dev/packages/get)
6 ![building](https://github.com/jonataslaw/get/workflows/build/badge.svg) 6 ![building](https://github.com/jonataslaw/get/workflows/build/badge.svg)
@@ -12,7 +12,7 @@ @@ -12,7 +12,7 @@
12 <a href="https://www.buymeacoffee.com/jonataslaw" target="_blank"><img src="https://www.buymeacoffee.com/assets/img/custom_images/orange_img.png" alt="Me compre um café" style="height: 41px !important;width: 174px !important; box-shadow: 0px 3px 2px 0px rgba(190, 190, 190, 0.5) !important;-webkit-box-shadow: 0px 3px 2px 0px rgba(190, 190, 190, 0.5) !important;" > </a> 12 <a href="https://www.buymeacoffee.com/jonataslaw" target="_blank"><img src="https://www.buymeacoffee.com/assets/img/custom_images/orange_img.png" alt="Me compre um café" style="height: 41px !important;width: 174px !important; box-shadow: 0px 3px 2px 0px rgba(190, 190, 190, 0.5) !important;-webkit-box-shadow: 0px 3px 2px 0px rgba(190, 190, 190, 0.5) !important;" > </a>
13 13
14 - [Sobre Get](#sobre-get) 14 - [Sobre Get](#sobre-get)
15 - - [Instalando e iniciando](#instalando-e-iniciando) 15 +- [Instalando e iniciando](#instalando-e-iniciando)
16 - [Os três pilares](#os-três-pilares) 16 - [Os três pilares](#os-três-pilares)
17 - [Gerenciamento de estado](#gerenciamento-de-estado) 17 - [Gerenciamento de estado](#gerenciamento-de-estado)
18 - [Explicação completa](#explicação-completa) 18 - [Explicação completa](#explicação-completa)
@@ -21,12 +21,20 @@ @@ -21,12 +21,20 @@
21 - [Gerenciamento de Dependência](#gerenciamento-de-dependência) 21 - [Gerenciamento de Dependência](#gerenciamento-de-dependência)
22 - [Explicação completa](#explicação-completa-2) 22 - [Explicação completa](#explicação-completa-2)
23 - [Utilidades](#utilidades) 23 - [Utilidades](#utilidades)
24 - - [Outras APIs avançadas e Configurações Manuais](#outras-apis-avançadas-e-configurações-manuais) 24 + - [Mudar tema (changeTheme)](#mudar-tema-changetheme)
  25 + - [Outras APIs avançadas](#outras-apis-avançadas)
  26 + - [Configurações Globais opcionais e configurações manuais](#configurações-globais-opcionais-e-configurações-manuais)
  27 +- [Breaking Changes da versão 2 para 3](#breaking-changes-da-versão-2-para-3)
  28 + - [Tipagem Rx](#tipagem-rx)
  29 + - [RxController e GetBuilder se uniram](#rxcontroller-e-getbuilder-se-uniram)
  30 + - [Rotas nomeadas](#rotas-nomeadas)
  31 + - [Porque essa mudança](#porque-essa-mudança)
  32 +- [Porque eu fiz esse package](#porque-eu-fiz-esse-package)
25 33
26 # Sobre Get 34 # Sobre Get
27 35
28 - Get é uma biblioteca poderosa e extra-leve para Flutter. Ela combina um gerenciador de estado de alta performance, injeção de dependência inteligente e gerenciamento de rotas de uma forma rápida e prática. 36 - Get é uma biblioteca poderosa e extra-leve para Flutter. Ela combina um gerenciador de estado de alta performance, injeção de dependência inteligente e gerenciamento de rotas de uma forma rápida e prática.
29 -- Get não é para todos, seu foco é 37 +- Get não é para todos, seu foco é:
30 - **Performance**: Já que gasta o mínimo de recursos 38 - **Performance**: Já que gasta o mínimo de recursos
31 - **Produtividade**: Usando uma sintaxe fácil e agradável 39 - **Produtividade**: Usando uma sintaxe fácil e agradável
32 - **Organização**: Que permite o total desacoplamento da View e da lógica de negócio. 40 - **Organização**: Que permite o total desacoplamento da View e da lógica de negócio.
@@ -35,7 +43,7 @@ @@ -35,7 +43,7 @@
35 - Get é seguro, estável, atualizado e oferece uma enorme gama de APIs que não estão presentes no framework padrão. 43 - Get é seguro, estável, atualizado e oferece uma enorme gama de APIs que não estão presentes no framework padrão.
36 - GetX não é um `bloc` da vida. Ele tem uma variedade de recursos que te permite começar a programar sem se preocupar com nada, mas cada um desses recursos estão em um container separado, ou seja, nenhuma depende da outra para funcionar. Elas só são inicializadas após o uso. Se você usa apenas o gerenciador de estado, apenas ele será compilado. Teste você mesmo, vá no repositório de benchmark do getX e perceberá: usando somente o gerenciador de estado do Get, a aplicação ficou mais leve do que outros projetos que também estão usando só o gerenciador de estado, porque nada que não seja usado será compilado no seu código, e cada recuro do GetX foi feito para ser muito leve. O mérito vem também do AOT do próprio Flutter que é incrível, e consegue eliminar recursos não utilizados de uma forma que nenhum outro framework consegue. 44 - GetX não é um `bloc` da vida. Ele tem uma variedade de recursos que te permite começar a programar sem se preocupar com nada, mas cada um desses recursos estão em um container separado, ou seja, nenhuma depende da outra para funcionar. Elas só são inicializadas após o uso. Se você usa apenas o gerenciador de estado, apenas ele será compilado. Teste você mesmo, vá no repositório de benchmark do getX e perceberá: usando somente o gerenciador de estado do Get, a aplicação ficou mais leve do que outros projetos que também estão usando só o gerenciador de estado, porque nada que não seja usado será compilado no seu código, e cada recuro do GetX foi feito para ser muito leve. O mérito vem também do AOT do próprio Flutter que é incrível, e consegue eliminar recursos não utilizados de uma forma que nenhum outro framework consegue.
37 45
38 -**GetX faz seu desenvolvimento mais produtivo, mas quer deixá-lo mais produtivo ainda? Adicione a extensão [GetX extension to VSCode](https://marketplace.visualstudio.com/items?itemName=get-snippets.get-snippets) no seu VSCode**. Não disponível para outras IDEs por enquanto. 46 +**GetX faz seu desenvolvimento mais produtivo, mas quer deixá-lo mais produtivo ainda? Adicione a extensão [GetX extension](https://marketplace.visualstudio.com/items?itemName=get-snippets.get-snippets) no seu VSCode**. Não disponível para outras IDEs por enquanto.
39 47
40 Quer contribuir no projeto? Nós ficaremos orgulhosos de ressaltar você como um dos colaboradores. Aqui vai algumas formas em que você pode contribuir e fazer Get (e Flutter) ainda melhores 48 Quer contribuir no projeto? Nós ficaremos orgulhosos de ressaltar você como um dos colaboradores. Aqui vai algumas formas em que você pode contribuir e fazer Get (e Flutter) ainda melhores
41 49
@@ -47,11 +55,7 @@ Quer contribuir no projeto? Nós ficaremos orgulhosos de ressaltar você como um @@ -47,11 +55,7 @@ Quer contribuir no projeto? Nós ficaremos orgulhosos de ressaltar você como um
47 55
48 Qualquer contribuição é bem-vinda! 56 Qualquer contribuição é bem-vinda!
49 57
50 -## Instalando e iniciando  
51 -  
52 -<!-- - Flutter Master/Dev/Beta: version 2.0.x-dev  
53 -- Flutter Stable branch: version 2.0.x  
54 -(procure pela versão mais recente em pub.dev) --> 58 +# Instalando e iniciando
55 59
56 Adicione Get ao seu arquivo pubspec.yaml 60 Adicione Get ao seu arquivo pubspec.yaml
57 61
@@ -60,14 +64,10 @@ dependencies: @@ -60,14 +64,10 @@ dependencies:
60 get: 64 get:
61 ``` 65 ```
62 66
63 -Troque seu `MaterialApp()` por `GetMaterialApp()` e aproveite! 67 +Importe o get nos arquivos que ele for usado:
64 68
65 ```dart 69 ```dart
66 import 'package:get/get.dart'; 70 import 'package:get/get.dart';
67 -  
68 -GetMaterialApp( // Antes: MaterialApp(  
69 - home: HomePage(),  
70 -)  
71 ``` 71 ```
72 72
73 # Os três pilares 73 # Os três pilares
@@ -85,10 +85,11 @@ Troque `MaterialApp` para `GetMaterialApp` @@ -85,10 +85,11 @@ Troque `MaterialApp` para `GetMaterialApp`
85 void main() => runApp(GetMaterialApp(home: Home())); 85 void main() => runApp(GetMaterialApp(home: Home()));
86 ``` 86 ```
87 87
88 -- **Obs:** Isso não modifica o `MaterialApp` do Flutter, GetMaterialApp não é uma versão modificada do MaterialApp, é só um Widget pré-configurado, que tem como child o MaterialApp padrão. Você pode configurar isso manualmente, mas definitivamente não é necessário. GetMaterialApp vai criar rotas, injetá-las, injetar traduções, injetar tudo que você precisa para navegação por rotas (gerenciamento de rotas). Se você quer somente usar o gerenciado de estado ou somente o gerenciador de dependências, não é necessário usar o GetMaterialApp. Ele somente é necessário para: 88 +- **Obs:** Isso não modifica o `MaterialApp` do Flutter, GetMaterialApp não é uma versão modificada do MaterialApp, é só um Widget pré-configurado, que tem como child o MaterialApp padrão. Você pode configurar isso manualmente, mas definitivamente não é necessário. GetMaterialApp vai criar rotas, injetá-las, injetar traduções, injetar tudo que você precisa para navegação por rotas (gerenciamento de rotas). Se você quer somente usar o gerenciadro de estado ou somente o gerenciador de dependências, não é necessário usar o GetMaterialApp. Ele somente é necessário para:
89 - Rotas 89 - Rotas
90 - Snackbars/bottomsheets/dialogs 90 - Snackbars/bottomsheets/dialogs
91 - apis relacionadas a rotas e a ausência de `context` 91 - apis relacionadas a rotas e a ausência de `context`
  92 + - Internacionalização
92 93
93 - Passo 2: 94 - Passo 2:
94 Cria a sua classe de regra de negócio e coloque todas as variáveis, métodos e controllers dentro dela. 95 Cria a sua classe de regra de negócio e coloque todas as variáveis, métodos e controllers dentro dela.
@@ -140,7 +141,7 @@ Melhore seus prazos, entregue tudo a tempo sem perder performance. Get não é p @@ -140,7 +141,7 @@ Melhore seus prazos, entregue tudo a tempo sem perder performance. Get não é p
140 141
141 ## Gerenciamento de rotas 142 ## Gerenciamento de rotas
142 143
143 -Veja uma explicação mais completa do gerenciamento de estado [aqui](./docs/pt_BR/route_management.md) 144 +Veja uma explicação mais completa do gerenciamento de rotas [aqui](./docs/pt_BR/route_management.md)
144 145
145 Para navegar para uma próxima tela: 146 Para navegar para uma próxima tela:
146 147
@@ -172,6 +173,8 @@ Para navegar para a próxima rota, e receber ou atualizar dados assim que retorn @@ -172,6 +173,8 @@ Para navegar para a próxima rota, e receber ou atualizar dados assim que retorn
172 var dados = await Get.to(Pagamento()); 173 var dados = await Get.to(Pagamento());
173 ``` 174 ```
174 175
  176 +Notou que você não precisou usar `context` para fazer nenhuma dessas coisas? Essa é uma das maiores vantagens de usar o gerenciamento de rotas do GetX. Com isso, você pode executar todos esse métodos de dentro da classe Controller, sem preocupações.
  177 +
175 ### Explicação completa 178 ### Explicação completa
176 179
177 **GetX funciona com rotas nomeadas também! Veja uma explicação mais completa do gerenciamento de rotas [aqui](./docs/pt_BR/route_management.md)** 180 **GetX funciona com rotas nomeadas também! Veja uma explicação mais completa do gerenciamento de rotas [aqui](./docs/pt_BR/route_management.md)**
@@ -224,26 +227,34 @@ Get.lazyPut<Service>(()=> ApiMock()); @@ -224,26 +227,34 @@ Get.lazyPut<Service>(()=> ApiMock());
224 227
225 # Utilidades 228 # Utilidades
226 229
227 -## Outras APIs avançadas e Configurações Manuais 230 +## Mudar tema (changeTheme)
  231 +
  232 +Por favor não use widget acima do GetMaterialApp para atualizar o tome. Isso pode causar keys duplicadas. Várias pessoas estão acostumadas com o jeito normal de criar um Widget `ThemeProvider` só pra alterar o thema do app, mas isso definitivamente NÃO é necessário no Get.
228 233
229 -GetMaterialApp configura tudo para você, mas se quiser configurar Get manualmente, você pode usando APIs avançadas. 234 +Você pode criar seu tema customizado e simplesmente adicionar dentro do `Get.changeTheme` sem nenhum boilerplate para isso:
230 235
231 ```dart 236 ```dart
232 -MaterialApp(  
233 - navigatorKey: Get.key,  
234 - navigatorObservers: [GetObserver()],  
235 -); 237 +Get.changeTheme(ThemeData.light())
236 ``` 238 ```
237 239
238 -Você também será capaz de usar seu próprio Middleware dentro do GetObserver, isso não irá influenciar em nada. 240 +Se você quer criar algo como um botão que muda o tema com o toque, você pode combinar duas APIs Get pra isso: a API que checa se o tema dark está sendo aplicado, e a API de mudar o tema, e colocar isso no `onPressed:`
239 241
240 ```dart 242 ```dart
241 -MaterialApp(  
242 - navigatorKey: Get.key,  
243 - navigatorObservers: [GetObserver(MiddleWare.observer)], // Aqui  
244 -); 243 +Get.changeTheme(
  244 + Get.isDarkMode
  245 + ? ThemeData.light()
  246 + : ThemeData.dark()
  247 +)
245 ``` 248 ```
246 249
  250 +Quando o modo Dark está ativado, ele vai trocar pro modo light, e vice versa.
  251 +
  252 +Se você quiser saber mais como trocar o tema, você pode seguir esse tutorial no Medium que até ensina persistência do tema usando Get (e SharedPreferences):
  253 +
  254 +- [Dynamic Themes in 3 lines using Get](https://medium.com/swlh/flutter-dynamic-themes-in-3-lines-c3b375f292e3) - Tutorial by [Rod Brown](https://github.com/RodBr).
  255 +
  256 +## Outras APIs avançadas
  257 +
247 ```dart 258 ```dart
248 // fornece os arguments da tela atual 259 // fornece os arguments da tela atual
249 Get.arguments 260 Get.arguments
@@ -306,4 +317,141 @@ Get.contextOverlay @@ -306,4 +317,141 @@ Get.contextOverlay
306 317
307 ``` 318 ```
308 319
  320 +### Configurações Globais opcionais e configurações manuais
  321 +
  322 +GetMaterialApp configura tudo para você, mas se quiser configurar Get manualmente, você pode.
  323 +
  324 +```dart
  325 +MaterialApp(
  326 + navigatorKey: Get.key,
  327 + navigatorObservers: [GetObserver()],
  328 +);
  329 +```
  330 +
  331 +Você também será capaz de usar seu próprio Middleware dentro do GetObserver, isso não irá influenciar em nada.
  332 +
  333 +```dart
  334 +MaterialApp(
  335 + navigatorKey: Get.key,
  336 + navigatorObservers: [
  337 + GetObserver(MiddleWare.observer) // Aqui
  338 + ],
  339 +);
  340 +```
  341 +
  342 +Você pode criar Configurações Globais para o Get. Apenas adicione `Get.config` ao seu código antes de usar qualquer rota ou faça diretamente no seu GetMaterialApp
  343 +
  344 +```dart
  345 +GetMaterialApp(
  346 + enableLog: true,
  347 + defaultTransition: Transition.fade,
  348 + opaqueRoute: Get.isOpaqueRouteDefault,
  349 + popGesture: Get.isPopGestureEnable,
  350 + transitionDuration: Get.defaultDurationTransition,
  351 + defaultGlobalState: Get.defaultGlobalState,
  352 +);
  353 +Get.config(
  354 + enableLog = true,
  355 + defaultPopGesture = true,
  356 + defaultTransition = Transitions.cupertino
  357 +)
  358 +```
  359 +
  360 +# Breaking Changes da versão 2 para 3
  361 +
  362 +## Tipagem Rx
  363 +
  364 +| Antes | Depois |
  365 +| -------- | ---------- |
  366 +| StringX | `RxString` |
  367 +| IntX | `RxInt` |
  368 +| MapX | `RxMax` |
  369 +| ListX | `RxList` |
  370 +| NumX | `RxNum` |
  371 +| RxDouble | `RxDouble` |
  372 +
  373 +## RxController e GetBuilder se uniram
  374 +
  375 +RxController e GetBuilder agora viraram um só, você não precisa mais memorizar qual controller quer usar, apenas coloque `GetxController`, vai funcionar para os dois gerenciamento de estados
  376 +
  377 +```dart
  378 +//Gerenciador de estado simples
  379 +class Controller extends GetXController {
  380 + String nome = '';
  381 +
  382 + void atualizarNome(String novoNome) {
  383 + nome = novoNome;
  384 + update()
  385 + }
  386 +}
  387 +```
  388 +
  389 +```dart
  390 +class Controller extends GetXController {
  391 + final nome = ''.obs;
  392 +
  393 + // não precisa de um método direto pra atualizar o nome
  394 + // só usar o nome.value
  395 +}
  396 +```
  397 +
  398 +## Rotas nomeadas
  399 +
  400 +Antes:
  401 +
  402 +```dart
  403 +GetMaterialApp(
  404 + namedRoutes: {
  405 + '/': GetRoute(page: Home()),
  406 + }
  407 +)
  408 +```
  409 +
  410 +Agora:
  411 +
  412 +```dart
  413 +GetMaterialApp(
  414 + getPages: [
  415 + GetPage(name: '/', page:()=> Home()),
  416 + ]
  417 +)
  418 +```
  419 +
  420 +### Porque essa mudança
  421 +
  422 +Frequentemente, pode ser necessário decidir qual pagina vai ser mostrada ao usuário a partir de um parâmetro, como um token de login. A forma abordada anteriormente não era flexível, já que não permitia isso.
  423 +
  424 +Inserir a página numa função reduziu significativamente o consumo de RAM, já que as rotas não são alocadas na memória desde o app inicia, e também permite fazer esse tipo de abordagem:
  425 +
  426 +```dart
  427 +
  428 +GetStorage box = GetStorage();
  429 +
  430 +GetMaterialApp(
  431 + getPages: [
  432 + GetPage(name: '/', page:(){
  433 + return box.hasData('token') ? Home() : Login();
  434 + })
  435 + ]
  436 +)
  437 +```
  438 +
  439 +# Porque eu fiz esse package
  440 +
  441 +O problema que esse package tenta resolver é possuir a maioria das funções que preciso num package só.
  442 +
  443 +Um dia, quando eu atualizei um dos meus apps no trabalho para o Flutter 1.9, algo ruim aconteceu: Tudo quebrou.
  444 +
  445 +Todas as bibliotecas pararam de funcionar, na atualização foi bloqueado o uso do hifen "-". Alguns atualizaram seus packages, outros não. Outros eu tive que olhar o porque do projeto não compilar. Outros simplesmente se tornaram incompatíveis com a versão atual, como o `image_extended` que eu até ofereci um PR lá pra conseguir corrigir, e tudo isso por causa de um simples update.
  446 +
  447 +Eu perdi 2 dias de trabalho só procurando por erros pra saber de onde eles vieram.
  448 +
  449 +Eu confesso que foi uma das situações mais estressantes que eu já passei na vida. Foi exatamente nesse dia que eu decidi colocar tudo num package.
  450 +
  451 +Eu sei que parece que esse package é feito só pra sanar minha experiência pessoal, mas eu sou um programador, e eu tento resolver problemas sempre da perspectiva do programador. Eu não me importo em nada mais que fazer a minha vida e de outros programadores mais fácil com esse package.
  452 +
  453 +Sempre que eu passo por uma experiência frustrante, eu escrevo no meu caleundário, e tento resolver depois de completar o projeto.
  454 +
  455 +E então eu decidi fazer um package que tenha três coisas que eu sempre uso: Gerenciamento de Estado, de rotas e de dependências. Depois eu fiz também internacionalização, e persistênsia de dados (estilo Hive)
  456 +
309 Essa biblioteca sempre será atualizada e terá sempre nova features sendo implementadas. Sinta-se livre para oferecer PRs e contribuir com o package. 457 Essa biblioteca sempre será atualizada e terá sempre nova features sendo implementadas. Sinta-se livre para oferecer PRs e contribuir com o package.