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-08-24 12:31:48 -0300
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
aecbd2081a0a13ba25bb80f3a1ad10f9b3674411
aecbd208
1 parent
20c66a29
fix onClosed is not called. Add onHidden lifecycle
Hide whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
170 additions
and
159 deletions
example/.metadata
example/lib/main.dart
example_nav2/android/local.properties
example_nav2/ios/Flutter/Generated.xcconfig
example_nav2/ios/Flutter/flutter_export_environment.sh
example_nav2/lib/app/modules/root/controllers/root_controller.dart
example_nav2/lib/app/modules/settings/controllers/settings_controller.dart
example_nav2/macos/Runner.xcodeproj/project.pbxproj
example_nav2/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme
lib/get_navigation/src/router_report.dart
lib/get_navigation/src/routes/get_information_parser.dart
lib/get_navigation/src/routes/route_middleware.dart
lib/get_navigation/src/snackbar/snackbar_controller.dart
lib/get_state_manager/src/simple/get_controllers.dart
pubspec.yaml
example/.metadata
View file @
aecbd20
# This file tracks properties of this Flutter project.
# Used by Flutter tool to assess capabilities and perform upgrades etc.
#
# This file should be version controlled.
# This file should be version controlled
and should not be manually edited
.
version:
revision: c07f7888888435fd9df505aa2efc38d3cf65681b
channel: stable
revision: "e1e47221e86272429674bec4f1bd36acc4fc7b77"
channel: "stable"
project_type: app
...
...
@@ -13,26 +13,11 @@ project_type: app
migration:
platforms:
- platform: root
create_revision: c07f7888888435fd9df505aa2efc38d3cf65681b
base_revision: c07f7888888435fd9df505aa2efc38d3cf65681b
- platform: android
create_revision: c07f7888888435fd9df505aa2efc38d3cf65681b
base_revision: c07f7888888435fd9df505aa2efc38d3cf65681b
create_revision: e1e47221e86272429674bec4f1bd36acc4fc7b77
base_revision: e1e47221e86272429674bec4f1bd36acc4fc7b77
- platform: ios
create_revision: c07f7888888435fd9df505aa2efc38d3cf65681b
base_revision: c07f7888888435fd9df505aa2efc38d3cf65681b
- platform: linux
create_revision: c07f7888888435fd9df505aa2efc38d3cf65681b
base_revision: c07f7888888435fd9df505aa2efc38d3cf65681b
- platform: macos
create_revision: c07f7888888435fd9df505aa2efc38d3cf65681b
base_revision: c07f7888888435fd9df505aa2efc38d3cf65681b
- platform: web
create_revision: c07f7888888435fd9df505aa2efc38d3cf65681b
base_revision: c07f7888888435fd9df505aa2efc38d3cf65681b
- platform: windows
create_revision: c07f7888888435fd9df505aa2efc38d3cf65681b
base_revision: c07f7888888435fd9df505aa2efc38d3cf65681b
create_revision: e1e47221e86272429674bec4f1bd36acc4fc7b77
base_revision: e1e47221e86272429674bec4f1bd36acc4fc7b77
# User provided section
...
...
example/lib/main.dart
View file @
aecbd20
import
'package:flutter/material.dart'
;
import
'package:get/get.dart'
;
import
'lang/translation_service.dart'
;
import
'routes/app_pages.dart'
;
import
'shared/logger/logger_utils.dart'
;
// void main() {
// runApp(const MyApp());
// }
// class MyApp extends StatelessWidget {
// const MyApp({Key? key}) : super(key: key);
// @override
// Widget build(BuildContext context) {
// return GetMaterialApp(
// theme: ThemeData(useMaterial3: true),
// 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
(
const
MyApp
());
}
...
...
@@ -15,127 +35,131 @@ class MyApp extends StatelessWidget {
@override
Widget
build
(
BuildContext
context
)
{
return
GetMaterialApp
(
theme:
ThemeData
(
useMaterial3:
true
),
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
(),
);
}
}
/// Nav 2 snippet
// void main() {
// runApp(const MyApp());
// }
// class MyApp extends StatelessWidget {
// const MyApp({Key? key}) : super(key: key);
class
FirstController
extends
GetxController
{
@override
void
onClose
()
{
print
(
'on close first'
);
super
.
onClose
();
}
}
// @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,
// );
// }
// }
class
First
extends
StatelessWidget
{
const
First
({
Key
?
key
})
:
super
(
key:
key
);
// class First extends StatelessWidget {
// const First({Key? key}) : super(key: key);
@override
Widget
build
(
BuildContext
context
)
{
print
(
'First rebuild'
);
Get
.
put
(
FirstController
());
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) {
// 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
SecondController
extends
GetxController
{
final
textEdit
=
TextEditingController
();
@override
void
onClose
()
{
print
(
'on close second'
);
textEdit
.
dispose
();
super
.
onClose
();
}
}
// class Second extends StatelessWidget {
// const Second({Key? key}) : super(key: key);
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'),
// ),
// ),
// ),
// );
// }
// }
@override
Widget
build
(
BuildContext
context
)
{
final
controller
=
Get
.
put
(
SecondController
());
print
(
'second rebuild'
);
return
Scaffold
(
appBar:
AppBar
(
title:
Text
(
'page two
${Get.parameters["id"]}
'
),
),
body:
Center
(
child:
Column
(
children:
[
Expanded
(
child:
TextField
(
controller:
controller
.
textEdit
,
)),
SizedBox
(
height:
300
,
width:
300
,
child:
ElevatedButton
(
onPressed:
()
{},
child:
const
Text
(
'next screen'
),
),
),
],
),
),
);
}
}
// class Third extends StatelessWidget {
// const Third({Key? key}) : super(key: key);
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'),
// ),
// ),
// ),
// );
// }
// }
@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'
),
),
),
),
);
}
}
...
...
example_nav2/android/local.properties
View file @
aecbd20
sdk.dir
=
/home/sumit/Android/Sdk
flutter.sdk
=
/home/sumit/softwares/flutter
\ No newline at end of file
sdk.dir
=
/Users/jonatasborges/Library/Android/sdk
flutter.sdk
=
/Users/jonatasborges/flutter
\ No newline at end of file
...
...
example_nav2/ios/Flutter/Generated.xcconfig
View file @
aecbd20
// This is a generated file; do not edit or check into version control.
FLUTTER_ROOT=/home/sumit/softwares/flutter
FLUTTER_APPLICATION_PATH=/home/sumit/StudioProjects/getx/example_nav2
FLUTTER_ROOT=/Users/jonatasborges/flutter
FLUTTER_APPLICATION_PATH=/Users/jonatasborges/getx5/getx/example_nav2
COCOAPODS_PARALLEL_CODE_SIGN=true
FLUTTER_TARGET=lib/main.dart
FLUTTER_BUILD_DIR=build
...
...
example_nav2/ios/Flutter/flutter_export_environment.sh
View file @
aecbd20
#!/bin/sh
# This is a generated file; do not edit or check into version control.
export
"FLUTTER_ROOT=/home/sumit/softwares/flutter"
export
"FLUTTER_APPLICATION_PATH=/home/sumit/StudioProjects/getx/example_nav2"
export
"FLUTTER_ROOT=/Users/jonatasborges/flutter"
export
"FLUTTER_APPLICATION_PATH=/Users/jonatasborges/getx5/getx/example_nav2"
export
"COCOAPODS_PARALLEL_CODE_SIGN=true"
export
"FLUTTER_TARGET=lib/main.dart"
export
"FLUTTER_BUILD_DIR=build"
...
...
example_nav2/lib/app/modules/root/controllers/root_controller.dart
View file @
aecbd20
import
'package:get/get.dart'
;
class
RootController
extends
GetxController
{
//TODO: Implement RootController
final
count
=
0
.
obs
;
@override
void
onInit
()
{
...
...
example_nav2/lib/app/modules/settings/controllers/settings_controller.dart
View file @
aecbd20
import
'package:get/get.dart'
;
class
SettingsController
extends
GetxController
{
//TODO: Implement SettingsController
final
count
=
0
.
obs
;
@override
void
onInit
()
{
...
...
example_nav2/macos/Runner.xcodeproj/project.pbxproj
View file @
aecbd20
...
...
@@ -182,7 +182,7 @@
isa = PBXProject;
attributes = {
LastSwiftUpdateCheck = 0920;
LastUpgradeCheck = 1
30
0;
LastUpgradeCheck = 1
43
0;
ORGANIZATIONNAME = "";
TargetAttributes = {
33CC10EC2044A3C60003C045 = {
...
...
example_nav2/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme
View file @
aecbd20
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion =
"1
30
0"
LastUpgradeVersion =
"1
43
0"
version =
"1.3"
>
<BuildAction
parallelizeBuildables =
"YES"
...
...
lib/get_navigation/src/router_report.dart
View file @
aecbd20
...
...
@@ -59,9 +59,10 @@ class RouterReportManager<T> {
void
reportRouteDispose
(
T
disposed
)
{
if
(
Get
.
smartManagement
!=
SmartManagement
.
onlyBuilder
)
{
ambiguate
(
Engine
.
instance
)!.
addPostFrameCallback
((
_
)
{
_removeDependencyByRoute
(
disposed
);
});
// ambiguate(Engine.instance)!.addPostFrameCallback((_) {
// Future.microtask(() {
_removeDependencyByRoute
(
disposed
);
// });
}
}
...
...
lib/get_navigation/src/routes/get_information_parser.dart
View file @
aecbd20
...
...
@@ -20,7 +20,8 @@ class GetInformationParser extends RouteInformationParser<RouteDecoder> {
SynchronousFuture
<
RouteDecoder
>
parseRouteInformation
(
RouteInformation
routeInformation
,
)
{
var
location
=
routeInformation
.
location
;
final
uri
=
routeInformation
.
uri
;
var
location
=
uri
.
toString
();
if
(
location
==
'/'
)
{
//check if there is a corresponding page
//if not, relocate to initialRoute
...
...
@@ -41,7 +42,7 @@ class GetInformationParser extends RouteInformationParser<RouteDecoder> {
@override
RouteInformation
restoreRouteInformation
(
RouteDecoder
configuration
)
{
return
RouteInformation
(
location:
configuration
.
pageSettings
?.
name
,
uri:
Uri
.
tryParse
(
configuration
.
pageSettings
?.
name
??
''
)
,
state:
null
,
);
}
...
...
lib/get_navigation/src/routes/route_middleware.dart
View file @
aecbd20
...
...
@@ -177,8 +177,9 @@ class MiddlewareRunner {
return
page
;
}
void
runOnPageDispose
()
=>
_getMiddlewares
().
forEach
((
element
)
=>
element
.
onPageDispose
());
void
runOnPageDispose
()
{
_getMiddlewares
().
forEach
((
element
)
=>
element
.
onPageDispose
());
}
}
class
PageRedirect
{
...
...
lib/get_navigation/src/snackbar/snackbar_controller.dart
View file @
aecbd20
...
...
@@ -242,10 +242,10 @@ class SnackbarController {
onEnter:
(
_
)
=>
snackbar
.
onHover
?.
call
(
snackbar
,
SnackHoverState
.
entered
),
onExit:
(
_
)
=>
snackbar
.
onHover
?.
call
(
snackbar
,
SnackHoverState
.
exited
),
child:
GestureDetector
(
child:
snackbar
,
onTap:
snackbar
.
onTap
!=
null
?
()
=>
snackbar
.
onTap
?.
call
(
snackbar
)
:
null
,
child:
snackbar
,
),
);
});
...
...
lib/get_state_manager/src/simple/get_controllers.dart
View file @
aecbd20
...
...
@@ -122,6 +122,9 @@ mixin FullLifeCycleMixin on FullLifeCycleController {
case
AppLifecycleState
.
detached
:
onDetached
();
break
;
case
AppLifecycleState
.
hidden
:
onHidden
();
break
;
}
}
...
...
@@ -129,4 +132,5 @@ mixin FullLifeCycleMixin on FullLifeCycleController {
void
onPaused
()
{}
void
onInactive
()
{}
void
onDetached
()
{}
void
onHidden
()
{}
}
...
...
pubspec.yaml
View file @
aecbd20
...
...
@@ -4,7 +4,7 @@ version: 5.0.0-release-candidate-4
homepage
:
https://github.com/jonataslaw/getx
environment
:
sdk
:
'
>=2.17.0
<4.0.0'
sdk
:
"
>=2.17.0
<4.0.0"
dependencies
:
flutter
:
...
...
@@ -16,7 +16,6 @@ dev_dependencies:
flutter_test
:
sdk
:
flutter
flutter_lints
:
^2.0.2
# For information on the generic Dart part of this file, see the
# following page: https://dart.dev/tools/pub/pubspec
...
...
Please
register
or
login
to post a comment