Showing
3 changed files
with
128 additions
and
108 deletions
@@ -6,125 +6,125 @@ import 'lang/translation_service.dart'; | @@ -6,125 +6,125 @@ import 'lang/translation_service.dart'; | ||
6 | import 'routes/app_pages.dart'; | 6 | import 'routes/app_pages.dart'; |
7 | import 'shared/logger/logger_utils.dart'; | 7 | import 'shared/logger/logger_utils.dart'; |
8 | 8 | ||
9 | -void main() { | ||
10 | - runApp(MyApp()); | ||
11 | -} | ||
12 | - | ||
13 | -class MyApp extends StatelessWidget { | ||
14 | - const MyApp({Key? key}) : super(key: key); | ||
15 | - | ||
16 | - @override | ||
17 | - Widget build(BuildContext context) { | ||
18 | - return GetMaterialApp( | ||
19 | - debugShowCheckedModeBanner: false, | ||
20 | - enableLog: true, | ||
21 | - logWriterCallback: Logger.write, | ||
22 | - initialRoute: AppPages.INITIAL, | ||
23 | - getPages: AppPages.routes, | ||
24 | - locale: TranslationService.locale, | ||
25 | - fallbackLocale: TranslationService.fallbackLocale, | ||
26 | - translations: TranslationService(), | ||
27 | - ); | ||
28 | - } | ||
29 | -} | ||
30 | - | ||
31 | -/// Nav 2 snippet | ||
32 | // void main() { | 9 | // void main() { |
33 | // runApp(MyApp()); | 10 | // runApp(MyApp()); |
34 | // } | 11 | // } |
35 | 12 | ||
36 | // class MyApp extends StatelessWidget { | 13 | // class MyApp extends StatelessWidget { |
37 | -// MyApp({Key? key}) : super(key: key); | 14 | +// const MyApp({Key? key}) : super(key: key); |
38 | 15 | ||
39 | // @override | 16 | // @override |
40 | // Widget build(BuildContext context) { | 17 | // Widget build(BuildContext context) { |
41 | -// return GetMaterialApp.router( | ||
42 | -// getPages: [ | ||
43 | -// GetPage( | ||
44 | -// participatesInRootNavigator: true, | ||
45 | -// name: '/first', | ||
46 | -// page: () => First()), | ||
47 | -// GetPage( | ||
48 | -// name: '/second', | ||
49 | -// page: () => Second(), | ||
50 | -// ), | ||
51 | -// GetPage( | ||
52 | -// name: '/third', | ||
53 | -// page: () => Third(), | ||
54 | -// ), | ||
55 | -// ], | 18 | +// return GetMaterialApp( |
56 | // debugShowCheckedModeBanner: false, | 19 | // debugShowCheckedModeBanner: false, |
20 | +// enableLog: true, | ||
21 | +// logWriterCallback: Logger.write, | ||
22 | +// initialRoute: AppPages.INITIAL, | ||
23 | +// getPages: AppPages.routes, | ||
24 | +// locale: TranslationService.locale, | ||
25 | +// fallbackLocale: TranslationService.fallbackLocale, | ||
26 | +// translations: TranslationService(), | ||
57 | // ); | 27 | // ); |
58 | // } | 28 | // } |
59 | // } | 29 | // } |
60 | 30 | ||
61 | -// class First extends StatelessWidget { | ||
62 | -// @override | ||
63 | -// Widget build(BuildContext context) { | ||
64 | -// return Scaffold( | ||
65 | -// appBar: AppBar( | ||
66 | -// title: Text('page one'), | ||
67 | -// leading: IconButton( | ||
68 | -// icon: Icon(Icons.more), | ||
69 | -// onPressed: () { | ||
70 | -// Get.changeTheme( | ||
71 | -// context.isDarkMode ? ThemeData.light() : ThemeData.dark()); | ||
72 | -// }, | ||
73 | -// ), | ||
74 | -// ), | ||
75 | -// body: Center( | ||
76 | -// child: Container( | ||
77 | -// height: 300, | ||
78 | -// width: 300, | ||
79 | -// child: ElevatedButton( | ||
80 | -// onPressed: () {}, | ||
81 | -// child: Text('next screen'), | ||
82 | -// ), | ||
83 | -// ), | ||
84 | -// ), | ||
85 | -// ); | ||
86 | -// } | ||
87 | -// } | 31 | +/// Nav 2 snippet |
32 | +void main() { | ||
33 | + runApp(MyApp()); | ||
34 | +} | ||
88 | 35 | ||
89 | -// class Second extends StatelessWidget { | ||
90 | -// @override | ||
91 | -// Widget build(BuildContext context) { | ||
92 | -// return Scaffold( | ||
93 | -// appBar: AppBar( | ||
94 | -// title: Text('page two ${Get.parameters["id"]}'), | ||
95 | -// ), | ||
96 | -// body: Center( | ||
97 | -// child: Container( | ||
98 | -// height: 300, | ||
99 | -// width: 300, | ||
100 | -// child: ElevatedButton( | ||
101 | -// onPressed: () {}, | ||
102 | -// child: Text('next screen'), | ||
103 | -// ), | ||
104 | -// ), | ||
105 | -// ), | ||
106 | -// ); | ||
107 | -// } | ||
108 | -// } | 36 | +class MyApp extends StatelessWidget { |
37 | + MyApp({Key? key}) : super(key: key); | ||
109 | 38 | ||
110 | -// class Third extends StatelessWidget { | ||
111 | -// @override | ||
112 | -// Widget build(BuildContext context) { | ||
113 | -// return Scaffold( | ||
114 | -// backgroundColor: Colors.red, | ||
115 | -// appBar: AppBar( | ||
116 | -// title: Text('page three'), | ||
117 | -// ), | ||
118 | -// body: Center( | ||
119 | -// child: Container( | ||
120 | -// height: 300, | ||
121 | -// width: 300, | ||
122 | -// child: ElevatedButton( | ||
123 | -// onPressed: () {}, | ||
124 | -// child: Text('go to first screen'), | ||
125 | -// ), | ||
126 | -// ), | ||
127 | -// ), | ||
128 | -// ); | ||
129 | -// } | ||
130 | -// } | 39 | + @override |
40 | + Widget build(BuildContext context) { | ||
41 | + return GetMaterialApp.router( | ||
42 | + getPages: [ | ||
43 | + GetPage( | ||
44 | + participatesInRootNavigator: true, | ||
45 | + name: '/first', | ||
46 | + page: () => First()), | ||
47 | + GetPage( | ||
48 | + name: '/second', | ||
49 | + page: () => Second(), | ||
50 | + ), | ||
51 | + GetPage( | ||
52 | + name: '/third', | ||
53 | + page: () => Third(), | ||
54 | + ), | ||
55 | + ], | ||
56 | + debugShowCheckedModeBanner: false, | ||
57 | + ); | ||
58 | + } | ||
59 | +} | ||
60 | + | ||
61 | +class First extends StatelessWidget { | ||
62 | + @override | ||
63 | + Widget build(BuildContext context) { | ||
64 | + return Scaffold( | ||
65 | + appBar: AppBar( | ||
66 | + title: Text('page one'), | ||
67 | + leading: IconButton( | ||
68 | + icon: Icon(Icons.more), | ||
69 | + onPressed: () { | ||
70 | + Get.changeTheme( | ||
71 | + context.isDarkMode ? ThemeData.light() : ThemeData.dark()); | ||
72 | + }, | ||
73 | + ), | ||
74 | + ), | ||
75 | + body: Center( | ||
76 | + child: Container( | ||
77 | + height: 300, | ||
78 | + width: 300, | ||
79 | + child: ElevatedButton( | ||
80 | + onPressed: () {}, | ||
81 | + child: Text('next screen'), | ||
82 | + ), | ||
83 | + ), | ||
84 | + ), | ||
85 | + ); | ||
86 | + } | ||
87 | +} | ||
88 | + | ||
89 | +class Second extends StatelessWidget { | ||
90 | + @override | ||
91 | + Widget build(BuildContext context) { | ||
92 | + return Scaffold( | ||
93 | + appBar: AppBar( | ||
94 | + title: Text('page two ${Get.parameters["id"]}'), | ||
95 | + ), | ||
96 | + body: Center( | ||
97 | + child: Container( | ||
98 | + height: 300, | ||
99 | + width: 300, | ||
100 | + child: ElevatedButton( | ||
101 | + onPressed: () {}, | ||
102 | + child: Text('next screen'), | ||
103 | + ), | ||
104 | + ), | ||
105 | + ), | ||
106 | + ); | ||
107 | + } | ||
108 | +} | ||
109 | + | ||
110 | +class Third extends StatelessWidget { | ||
111 | + @override | ||
112 | + Widget build(BuildContext context) { | ||
113 | + return Scaffold( | ||
114 | + backgroundColor: Colors.red, | ||
115 | + appBar: AppBar( | ||
116 | + title: Text('page three'), | ||
117 | + ), | ||
118 | + body: Center( | ||
119 | + child: Container( | ||
120 | + height: 300, | ||
121 | + width: 300, | ||
122 | + child: ElevatedButton( | ||
123 | + onPressed: () {}, | ||
124 | + child: Text('go to first screen'), | ||
125 | + ), | ||
126 | + ), | ||
127 | + ), | ||
128 | + ); | ||
129 | + } | ||
130 | +} |
@@ -80,6 +80,26 @@ class HomeView extends GetView<HomeController> { | @@ -80,6 +80,26 @@ class HomeView extends GetView<HomeController> { | ||
80 | color: Colors.black, | 80 | color: Colors.black, |
81 | ), | 81 | ), |
82 | ), | 82 | ), |
83 | + ), | ||
84 | + OutlinedButton( | ||
85 | + style: OutlinedButton.styleFrom( | ||
86 | + textStyle: TextStyle(color: Colors.black), | ||
87 | + side: BorderSide( | ||
88 | + color: Colors.deepPurple, | ||
89 | + width: 3, | ||
90 | + ), | ||
91 | + shape: StadiumBorder(), | ||
92 | + ), | ||
93 | + onPressed: () { | ||
94 | + Get.updateLocale(Locale('pt', 'BR')); | ||
95 | + }, | ||
96 | + child: Text( | ||
97 | + 'Update language to Portuguese', | ||
98 | + style: TextStyle( | ||
99 | + fontWeight: FontWeight.bold, | ||
100 | + color: Colors.black, | ||
101 | + ), | ||
102 | + ), | ||
83 | ) | 103 | ) |
84 | ], | 104 | ], |
85 | ); | 105 | ); |
@@ -1227,7 +1227,7 @@ extension NavTwoExt on GetInterface { | @@ -1227,7 +1227,7 @@ extension NavTwoExt on GetInterface { | ||
1227 | initialRoute: initialRoute, | 1227 | initialRoute: initialRoute, |
1228 | ); | 1228 | ); |
1229 | } else { | 1229 | } else { |
1230 | - return routerDelegate as GetInformationParser; | 1230 | + return routeInformationParser as GetInformationParser; |
1231 | } | 1231 | } |
1232 | } | 1232 | } |
1233 | 1233 |
-
Please register or login to post a comment