Jonny Borges

fix example

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 -// void main() {  
5 -// runApp(const MyApp());  
6 -// }  
7 -  
8 -// class MyApp extends StatelessWidget {  
9 -// const MyApp({Key? key}) : super(key: key);  
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 -// } 4 +import 'lang/translation_service.dart';
  5 +import 'routes/app_pages.dart';
  6 +import 'shared/logger/logger_utils.dart';
25 7
26 -/// Nav 2 snippet  
27 void main() { 8 void main() {
28 runApp(const MyApp()); 9 runApp(const MyApp());
29 } 10 }
@@ -34,103 +15,126 @@ class MyApp extends StatelessWidget { @@ -34,103 +15,126 @@ class MyApp extends StatelessWidget {
34 @override 15 @override
35 Widget build(BuildContext context) { 16 Widget build(BuildContext context) {
36 return GetMaterialApp( 17 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 - ],  
51 debugShowCheckedModeBanner: false, 18 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(),
52 ); 26 );
53 } 27 }
54 } 28 }
55 29
56 -class First extends StatelessWidget {  
57 - const First({Key? key}) : super(key: key); 30 +/// Nav 2 snippet
  31 +// void main() {
  32 +// runApp(const MyApp());
  33 +// }
58 34
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 -} 35 +// class MyApp extends StatelessWidget {
  36 +// const MyApp({Key? key}) : super(key: key);
89 37
90 -class Second extends StatelessWidget {  
91 - const Second({Key? key}) : super(key: key); 38 +// @override
  39 +// Widget build(BuildContext context) {
  40 +// return GetMaterialApp(
  41 +// getPages: [
  42 +// GetPage(
  43 +// participatesInRootNavigator: true,
  44 +// name: '/first',
  45 +// page: () => const First()),
  46 +// GetPage(
  47 +// name: '/second',
  48 +// page: () => const Second(),
  49 +// ),
  50 +// GetPage(
  51 +// name: '/third',
  52 +// page: () => const Third(),
  53 +// ),
  54 +// ],
  55 +// debugShowCheckedModeBanner: false,
  56 +// );
  57 +// }
  58 +// }
92 59
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 -} 60 +// class First extends StatelessWidget {
  61 +// const First({Key? key}) : super(key: key);
113 62
114 -class Third extends StatelessWidget {  
115 - const Third({Key? key}) : super(key: key); 63 +// @override
  64 +// Widget build(BuildContext context) {
  65 +// print('First rebuild');
  66 +// return Scaffold(
  67 +// appBar: AppBar(
  68 +// title: const Text('page one'),
  69 +// leading: IconButton(
  70 +// icon: const Icon(Icons.more),
  71 +// onPressed: () {
  72 +// print('THEME CHANGED');
  73 +// Get.changeTheme(
  74 +// Get.isDarkMode ? ThemeData.light() : ThemeData.dark());
  75 +// },
  76 +// ),
  77 +// ),
  78 +// body: Center(
  79 +// child: SizedBox(
  80 +// height: 300,
  81 +// width: 300,
  82 +// child: ElevatedButton(
  83 +// onPressed: () {
  84 +// Get.toNamed('/second?id=123');
  85 +// },
  86 +// child: const Text('next screen'),
  87 +// ),
  88 +// ),
  89 +// ),
  90 +// );
  91 +// }
  92 +// }
116 93
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 -} 94 +// class Second extends StatelessWidget {
  95 +// const Second({Key? key}) : super(key: key);
  96 +
  97 +// @override
  98 +// Widget build(BuildContext context) {
  99 +// print('second rebuild');
  100 +// return Scaffold(
  101 +// appBar: AppBar(
  102 +// title: Text('page two ${Get.parameters["id"]}'),
  103 +// ),
  104 +// body: Center(
  105 +// child: SizedBox(
  106 +// height: 300,
  107 +// width: 300,
  108 +// child: ElevatedButton(
  109 +// onPressed: () {},
  110 +// child: const Text('next screen'),
  111 +// ),
  112 +// ),
  113 +// ),
  114 +// );
  115 +// }
  116 +// }
  117 +
  118 +// class Third extends StatelessWidget {
  119 +// const Third({Key? key}) : super(key: key);
  120 +
  121 +// @override
  122 +// Widget build(BuildContext context) {
  123 +// return Scaffold(
  124 +// backgroundColor: Colors.red,
  125 +// appBar: AppBar(
  126 +// title: const Text('page three'),
  127 +// ),
  128 +// body: Center(
  129 +// child: SizedBox(
  130 +// height: 300,
  131 +// width: 300,
  132 +// child: ElevatedButton(
  133 +// onPressed: () {},
  134 +// child: const Text('go to first screen'),
  135 +// ),
  136 +// ),
  137 +// ),
  138 +// );
  139 +// }
  140 +// }