Toggle navigation
Toggle navigation
This project
Loading...
Sign in
flutter_package
/
fluttertpc_get
Go to a project
Toggle navigation
Projects
Groups
Snippets
Help
Toggle navigation pinning
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Authored by
Jonny Borges
2023-03-10 13:47:27 -0300
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
e6093da20cb126de2fd026f82b68ba974ea3c0d0
e6093da2
1 parent
a686292c
fix example
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
116 additions
and
112 deletions
example/lib/main.dart
example/lib/main.dart
View file @
e6093da
import
'package:flutter/material.dart'
;
import
'package:get/get.dart'
;
// void main() {
// runApp(const MyApp());
// }
// class MyApp extends StatelessWidget {
// const MyApp({Key? key}) : super(key: key);
// @override
// Widget build(BuildContext context) {
// return GetMaterialApp(
// debugShowCheckedModeBanner: false,
// enableLog: true,
// logWriterCallback: Logger.write,
// initialRoute: AppPages.INITIAL,
// getPages: AppPages.routes,
// locale: TranslationService.locale,
// fallbackLocale: TranslationService.fallbackLocale,
// translations: TranslationService(),
// );
// }
// }
import
'lang/translation_service.dart'
;
import
'routes/app_pages.dart'
;
import
'shared/logger/logger_utils.dart'
;
/// Nav 2 snippet
void
main
(
)
{
runApp
(
const
MyApp
());
}
...
...
@@ -34,103 +15,126 @@ class MyApp extends StatelessWidget {
@override
Widget
build
(
BuildContext
context
)
{
return
GetMaterialApp
(
getPages:
[
GetPage
(
participatesInRootNavigator:
true
,
name:
'/first'
,
page:
()
=>
const
First
()),
GetPage
(
name:
'/second'
,
page:
()
=>
const
Second
(),
),
GetPage
(
name:
'/third'
,
page:
()
=>
const
Third
(),
),
],
debugShowCheckedModeBanner:
false
,
enableLog:
true
,
logWriterCallback:
Logger
.
write
,
initialRoute:
AppPages
.
INITIAL
,
getPages:
AppPages
.
routes
,
locale:
TranslationService
.
locale
,
fallbackLocale:
TranslationService
.
fallbackLocale
,
translations:
TranslationService
(),
);
}
}
class
First
extends
StatelessWidget
{
const
First
({
Key
?
key
})
:
super
(
key:
key
);
/// Nav 2 snippet
// void main() {
// runApp(const MyApp());
// }
@override
Widget
build
(
BuildContext
context
)
{
print
(
'First rebuild'
);
return
Scaffold
(
appBar:
AppBar
(
title:
const
Text
(
'page one'
),
leading:
IconButton
(
icon:
const
Icon
(
Icons
.
more
),
onPressed:
()
{
print
(
'THEME CHANGED'
);
Get
.
changeTheme
(
Get
.
isDarkMode
?
ThemeData
.
light
()
:
ThemeData
.
dark
());
},
),
),
body:
Center
(
child:
SizedBox
(
height:
300
,
width:
300
,
child:
ElevatedButton
(
onPressed:
()
{
Get
.
toNamed
(
'/second?id=123'
);
},
child:
const
Text
(
'next screen'
),
),
),
),
);
}
}
// class MyApp extends StatelessWidget {
// const MyApp({Key? key}) : super(key: key);
class
Second
extends
StatelessWidget
{
const
Second
({
Key
?
key
})
:
super
(
key:
key
);
// @override
// Widget build(BuildContext context) {
// return GetMaterialApp(
// getPages: [
// GetPage(
// participatesInRootNavigator: true,
// name: '/first',
// page: () => const First()),
// GetPage(
// name: '/second',
// page: () => const Second(),
// ),
// GetPage(
// name: '/third',
// page: () => const Third(),
// ),
// ],
// debugShowCheckedModeBanner: false,
// );
// }
// }
@override
Widget
build
(
BuildContext
context
)
{
print
(
'second rebuild'
);
return
Scaffold
(
appBar:
AppBar
(
title:
Text
(
'page two
${Get.parameters["id"]}
'
),
),
body:
Center
(
child:
SizedBox
(
height:
300
,
width:
300
,
child:
ElevatedButton
(
onPressed:
()
{},
child:
const
Text
(
'next screen'
),
),
),
),
);
}
}
// class First extends StatelessWidget {
// const First({Key? key}) : super(key: key);
class
Third
extends
StatelessWidget
{
const
Third
({
Key
?
key
})
:
super
(
key:
key
);
// @override
// Widget build(BuildContext context) {
// print('First rebuild');
// return Scaffold(
// appBar: AppBar(
// title: const Text('page one'),
// leading: IconButton(
// icon: const Icon(Icons.more),
// onPressed: () {
// print('THEME CHANGED');
// Get.changeTheme(
// Get.isDarkMode ? ThemeData.light() : ThemeData.dark());
// },
// ),
// ),
// body: Center(
// child: SizedBox(
// height: 300,
// width: 300,
// child: ElevatedButton(
// onPressed: () {
// Get.toNamed('/second?id=123');
// },
// child: const Text('next screen'),
// ),
// ),
// ),
// );
// }
// }
@override
Widget
build
(
BuildContext
context
)
{
return
Scaffold
(
backgroundColor:
Colors
.
red
,
appBar:
AppBar
(
title:
const
Text
(
'page three'
),
),
body:
Center
(
child:
SizedBox
(
height:
300
,
width:
300
,
child:
ElevatedButton
(
onPressed:
()
{},
child:
const
Text
(
'go to first screen'
),
),
),
),
);
}
}
// class Second extends StatelessWidget {
// const Second({Key? key}) : super(key: key);
// @override
// Widget build(BuildContext context) {
// print('second rebuild');
// return Scaffold(
// appBar: AppBar(
// title: Text('page two ${Get.parameters["id"]}'),
// ),
// body: Center(
// child: SizedBox(
// height: 300,
// width: 300,
// child: ElevatedButton(
// onPressed: () {},
// child: const Text('next screen'),
// ),
// ),
// ),
// );
// }
// }
// class Third extends StatelessWidget {
// const Third({Key? key}) : super(key: key);
// @override
// Widget build(BuildContext context) {
// return Scaffold(
// backgroundColor: Colors.red,
// appBar: AppBar(
// title: const Text('page three'),
// ),
// body: Center(
// child: SizedBox(
// height: 300,
// width: 300,
// child: ElevatedButton(
// onPressed: () {},
// child: const Text('go to first screen'),
// ),
// ),
// ),
// );
// }
// }
...
...
Please
register
or
login
to post a comment