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
2021-07-17 16:48:41 -0300
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
1391c8fb89763f74129ae29f1ccc4b25813ecc37
1391c8fb
1 parent
827c557d
fix error on GetInformationParser
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
128 additions
and
108 deletions
example/lib/main.dart
example/lib/pages/home/presentation/views/home_view.dart
lib/get_navigation/src/extension_navigation.dart
example/lib/main.dart
View file @
1391c8f
...
...
@@ -6,125 +6,125 @@ import 'lang/translation_service.dart';
import
'routes/app_pages.dart'
;
import
'shared/logger/logger_utils.dart'
;
void
main
(
)
{
runApp
(
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
(),
);
}
}
/// Nav 2 snippet
// void main() {
// runApp(MyApp());
// }
// class MyApp extends StatelessWidget {
// MyApp({Key? key}) : super(key: key);
//
const
MyApp({Key? key}) : super(key: key);
// @override
// Widget build(BuildContext context) {
// return GetMaterialApp.router(
// getPages: [
// GetPage(
// participatesInRootNavigator: true,
// name: '/first',
// page: () => First()),
// GetPage(
// name: '/second',
// page: () => Second(),
// ),
// GetPage(
// name: '/third',
// page: () => Third(),
// ),
// ],
// return GetMaterialApp(
// 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 {
// @override
// Widget build(BuildContext context) {
// return Scaffold(
// appBar: AppBar(
// title: Text('page one'),
// leading: IconButton(
// icon: Icon(Icons.more),
// onPressed: () {
// Get.changeTheme(
// context.isDarkMode ? ThemeData.light() : ThemeData.dark());
// },
// ),
// ),
// body: Center(
// child: Container(
// height: 300,
// width: 300,
// child: ElevatedButton(
// onPressed: () {},
// child: Text('next screen'),
// ),
// ),
// ),
// );
// }
// }
/// Nav 2 snippet
void
main
(
)
{
runApp
(
MyApp
());
}
// class Second extends StatelessWidget {
// @override
// Widget build(BuildContext context) {
// return Scaffold(
// appBar: AppBar(
// title: Text('page two ${Get.parameters["id"]}'),
// ),
// body: Center(
// child: Container(
// height: 300,
// width: 300,
// child: ElevatedButton(
// onPressed: () {},
// child: Text('next screen'),
// ),
// ),
// ),
// );
// }
// }
class
MyApp
extends
StatelessWidget
{
MyApp
({
Key
?
key
})
:
super
(
key:
key
);
// class Third extends StatelessWidget {
// @override
// Widget build(BuildContext context) {
// return Scaffold(
// backgroundColor: Colors.red,
// appBar: AppBar(
// title: Text('page three'),
// ),
// body: Center(
// child: Container(
// height: 300,
// width: 300,
// child: ElevatedButton(
// onPressed: () {},
// child: Text('go to first screen'),
// ),
// ),
// ),
// );
// }
// }
@override
Widget
build
(
BuildContext
context
)
{
return
GetMaterialApp
.
router
(
getPages:
[
GetPage
(
participatesInRootNavigator:
true
,
name:
'/first'
,
page:
()
=>
First
()),
GetPage
(
name:
'/second'
,
page:
()
=>
Second
(),
),
GetPage
(
name:
'/third'
,
page:
()
=>
Third
(),
),
],
debugShowCheckedModeBanner:
false
,
);
}
}
class
First
extends
StatelessWidget
{
@override
Widget
build
(
BuildContext
context
)
{
return
Scaffold
(
appBar:
AppBar
(
title:
Text
(
'page one'
),
leading:
IconButton
(
icon:
Icon
(
Icons
.
more
),
onPressed:
()
{
Get
.
changeTheme
(
context
.
isDarkMode
?
ThemeData
.
light
()
:
ThemeData
.
dark
());
},
),
),
body:
Center
(
child:
Container
(
height:
300
,
width:
300
,
child:
ElevatedButton
(
onPressed:
()
{},
child:
Text
(
'next screen'
),
),
),
),
);
}
}
class
Second
extends
StatelessWidget
{
@override
Widget
build
(
BuildContext
context
)
{
return
Scaffold
(
appBar:
AppBar
(
title:
Text
(
'page two
${Get.parameters["id"]}
'
),
),
body:
Center
(
child:
Container
(
height:
300
,
width:
300
,
child:
ElevatedButton
(
onPressed:
()
{},
child:
Text
(
'next screen'
),
),
),
),
);
}
}
class
Third
extends
StatelessWidget
{
@override
Widget
build
(
BuildContext
context
)
{
return
Scaffold
(
backgroundColor:
Colors
.
red
,
appBar:
AppBar
(
title:
Text
(
'page three'
),
),
body:
Center
(
child:
Container
(
height:
300
,
width:
300
,
child:
ElevatedButton
(
onPressed:
()
{},
child:
Text
(
'go to first screen'
),
),
),
),
);
}
}
...
...
example/lib/pages/home/presentation/views/home_view.dart
View file @
1391c8f
...
...
@@ -80,6 +80,26 @@ class HomeView extends GetView<HomeController> {
color:
Colors
.
black
,
),
),
),
OutlinedButton
(
style:
OutlinedButton
.
styleFrom
(
textStyle:
TextStyle
(
color:
Colors
.
black
),
side:
BorderSide
(
color:
Colors
.
deepPurple
,
width:
3
,
),
shape:
StadiumBorder
(),
),
onPressed:
()
{
Get
.
updateLocale
(
Locale
(
'pt'
,
'BR'
));
},
child:
Text
(
'Update language to Portuguese'
,
style:
TextStyle
(
fontWeight:
FontWeight
.
bold
,
color:
Colors
.
black
,
),
),
)
],
);
...
...
lib/get_navigation/src/extension_navigation.dart
View file @
1391c8f
...
...
@@ -1227,7 +1227,7 @@ extension NavTwoExt on GetInterface {
initialRoute:
initialRoute
,
);
}
else
{
return
route
rDelegate
as
GetInformationParser
;
return
route
InformationParser
as
GetInformationParser
;
}
}
...
...
Please
register
or
login
to post a comment