Showing
1 changed file
with
31 additions
and
36 deletions
@@ -46,8 +46,8 @@ Essa biblioteca vai mudar a forma que você trabalha com o Framework e salvar se | @@ -46,8 +46,8 @@ Essa biblioteca vai mudar a forma que você trabalha com o Framework e salvar se | ||
46 | - [Reactive State Manager - GetX](#reactive-state-manager---getx) | 46 | - [Reactive State Manager - GetX](#reactive-state-manager---getx) |
47 | - [Gerenciamento de dependências simples](#gerenciamento-de-dependências-simples) | 47 | - [Gerenciamento de dependências simples](#gerenciamento-de-dependências-simples) |
48 | - [Navegar com rotas nomeadas](#navegar-com-rotas-nomeadas) | 48 | - [Navegar com rotas nomeadas](#navegar-com-rotas-nomeadas) |
49 | - - [Send data to named Routes:](#send-data-to-named-routes) | ||
50 | - - [Dynamic urls links](#dynamic-urls-links) | 49 | + - [Enviar dados para rotas nomeadas](#enviar-dados-para-rotas-nomeadas) |
50 | + - [Links de Url dinâmicos](#links-de-url-dinâmicos) | ||
51 | - [Middleware](#middleware) | 51 | - [Middleware](#middleware) |
52 | - [Change Theme](#change-theme) | 52 | - [Change Theme](#change-theme) |
53 | - [Optional Global Settings](#optional-global-settings) | 53 | - [Optional Global Settings](#optional-global-settings) |
@@ -741,72 +741,67 @@ void main() { | @@ -741,72 +741,67 @@ void main() { | ||
741 | initialRoute: '/', | 741 | initialRoute: '/', |
742 | namedRoutes: { | 742 | namedRoutes: { |
743 | '/': GetRoute(page: MyHomePage()), | 743 | '/': GetRoute(page: MyHomePage()), |
744 | - '/second': GetRoute(page: Second()), | ||
745 | - '/third': GetRoute(page: Third(),transition: Transition.cupertino); | 744 | + '/login': GetRoute(page: Login()), |
745 | + '/cadastro': GetRoute(page: Cadastro(),transition: Transition.cupertino); | ||
746 | }, | 746 | }, |
747 | ) | 747 | ) |
748 | ); | 748 | ); |
749 | } | 749 | } |
750 | ``` | 750 | ``` |
751 | 751 | ||
752 | -### Send data to named Routes: | 752 | +### Enviar dados para rotas nomeadas |
753 | 753 | ||
754 | -Just send what you want for arguments. Get accepts anything here, whether it is a String, a Map, a List, or even a class instance. | 754 | +Apenas envie o que você quiser no parâmetro `arguments`. Get aceita qualquer coisa aqui, seja String, Map, List, ou até a instância de uma classe. |
755 | ```dart | 755 | ```dart |
756 | -Get.toNamed("/NextScreen", arguments: 'Get is the best'); | 756 | +Get.toNamed("/ProximaTela", arguments: 'Get é o melhor'); |
757 | ``` | 757 | ``` |
758 | -on your class or controller: | ||
759 | 758 | ||
759 | +Na sua classe ou controller: | ||
760 | ```dart | 760 | ```dart |
761 | -print(Get.arguments); | ||
762 | -//print out: Get is the best | 761 | +print(Get.arguments); //mostra: Get é o melhor |
763 | ``` | 762 | ``` |
763 | +#### Links de Url dinâmicos | ||
764 | 764 | ||
765 | -#### Dynamic urls links | ||
766 | -Get offer advanced dynamic urls just like on the Web. Web developers have probably already wanted this feature on Flutter, and most likely have seen a package promise this feature and deliver a totally different syntax than a URL would have on web, but Get also solves that. | ||
767 | - | 765 | +Get oferece links de url dinâmicos assim como na Web. |
766 | +Desenvolvedores Web provavelmente já queriam essa featura no Flutter, e muito provavelmente viram um package que promete essa feature e entrega uma sintaxe totalmente diferente do que uma url teria na web, mas o Get também resolve isso. | ||
768 | ```dart | 767 | ```dart |
769 | -Get.offAllNamed("/NextScreen?device=phone&id=354&name=Enzo"); | 768 | +Get.offAllNamed("/ProximaTela?device=phone&id=354&name=Enzo"); |
770 | ``` | 769 | ``` |
771 | -on your controller/bloc/stateful/stateless class: | ||
772 | - | 770 | +na sua classe controller/bloc/stateful/stateless: |
773 | ```dart | 771 | ```dart |
774 | -print(Get.parameters['id']); | ||
775 | -// out: 354 | ||
776 | -print(Get.parameters['name']); | ||
777 | -// out: Enzo | 772 | +print(Get.parameters['id']); // valor: 354 |
773 | +print(Get.parameters['name']); // valor: Enzo | ||
778 | ``` | 774 | ``` |
779 | 775 | ||
780 | -You can also receive NamedParameters with Get easily: | ||
781 | - | 776 | +Você também pode receber parâmetros nomeados com o Get facilmente: |
782 | ```dart | 777 | ```dart |
783 | -void main() { | ||
784 | - runApp(GetMaterialApp( | 778 | +void main() => runApp( |
779 | + GetMaterialApp( | ||
785 | initialRoute: '/', | 780 | initialRoute: '/', |
786 | namedRoutes: { | 781 | namedRoutes: { |
787 | '/': GetRoute(page: MyHomePage()), | 782 | '/': GetRoute(page: MyHomePage()), |
788 | - /// Important! :user is not a new route, it is just a parameter | ||
789 | - /// specification. Do not use '/second/:user' and '/second' | ||
790 | - /// if you need new route to user, use '/second/user/:user' | ||
791 | - /// if '/second' is a route. | ||
792 | - '/second/:user': GetRoute(page: Second()), // receive ID | 783 | + /// Importante! :user não é uma nova rota, é somente uma |
784 | + /// especificação do parâmentro. Não use '/second/:user/' e '/second' | ||
785 | + /// se você precisa de uma nova rota para o user, então | ||
786 | + /// use '/second/user/:user' se '/second' for uma rota | ||
787 | + '/second/:user': GetRoute(page: Second()), // recebe a ID | ||
793 | '/third': GetRoute(page: Third(),transition: Transition.cupertino); | 788 | '/third': GetRoute(page: Third(),transition: Transition.cupertino); |
794 | }, | 789 | }, |
795 | - )); | ||
796 | -} | 790 | + ), |
791 | +); | ||
797 | ``` | 792 | ``` |
798 | -Send data on route name | 793 | +Envie dados na rota nomeada |
799 | ```dart | 794 | ```dart |
800 | Get.toNamed("/second/34954"); | 795 | Get.toNamed("/second/34954"); |
801 | ``` | 796 | ``` |
802 | 797 | ||
803 | -On second screen take the data by parameter | ||
804 | - | 798 | +Na segunda tela receba os dados usando `Get.parameters[]` |
805 | ```dart | 799 | ```dart |
806 | -print(Get.parameters['user']); | ||
807 | -// out: 34954 | 800 | +print(Get.parameters['user']); // valor: 34954 |
808 | ``` | 801 | ``` |
809 | 802 | ||
803 | +E agora, tudo que você precisa fazer é usar `Get.toNamed)` para navegar por suas rotas nomeadas, sem nenhum `context` (você pode chamar suas rotas diretamente do seu BLoc ou do Controller), e quando seu aplicativo é compilado para a web, suas rotas vão aparecer na url :heart: | ||
804 | + | ||
810 | And now, all you need to do is use Get.toNamed() to navigate your named routes, without any context (you can call your routes directly from your BLoC or Controller class), and when your app is compiled to the web, your routes will appear in the url <3 | 805 | And now, all you need to do is use Get.toNamed() to navigate your named routes, without any context (you can call your routes directly from your BLoC or Controller class), and when your app is compiled to the web, your routes will appear in the url <3 |
811 | 806 | ||
812 | 807 |
-
Please register or login to post a comment