Jonny Borges
Committed by GitHub

Merge pull request #2886 from jonataslaw/3.13-updates

fix onClosed is not called. Add onHidden lifecycle
# 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
... ...
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'),
),
),
),
);
}
}
... ...
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
... ...
// 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
... ...
#!/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"
... ...
import 'package:get/get.dart';
class RootController extends GetxController {
//TODO: Implement RootController
final count = 0.obs;
@override
void onInit() {
... ...
import 'package:get/get.dart';
class SettingsController extends GetxController {
//TODO: Implement SettingsController
final count = 0.obs;
@override
void onInit() {
... ...
... ... @@ -182,7 +182,7 @@
isa = PBXProject;
attributes = {
LastSwiftUpdateCheck = 0920;
LastUpgradeCheck = 1300;
LastUpgradeCheck = 1430;
ORGANIZATIONNAME = "";
TargetAttributes = {
33CC10EC2044A3C60003C045 = {
... ...
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1300"
LastUpgradeVersion = "1430"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
... ...
... ... @@ -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);
// });
}
}
... ...
... ... @@ -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,
);
}
... ...
... ... @@ -177,8 +177,9 @@ class MiddlewareRunner {
return page;
}
void runOnPageDispose() =>
_getMiddlewares().forEach((element) => element.onPageDispose());
void runOnPageDispose() {
_getMiddlewares().forEach((element) => element.onPageDispose());
}
}
class PageRedirect {
... ...
... ... @@ -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,
),
);
});
... ...
... ... @@ -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() {}
}
... ...
... ... @@ -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
... ...