Jonny Borges

inherit-bindings

// This is a generated file; do not edit or check into version control.
FLUTTER_ROOT=/Users/jonatasborges/flutter
FLUTTER_APPLICATION_PATH=/Users/jonatasborges/consertar/getx/example_nav2
FLUTTER_APPLICATION_PATH=/Users/jonatasborges/getx-parse/getx/example_nav2
COCOAPODS_PARALLEL_CODE_SIGN=true
FLUTTER_TARGET=/Users/jonatasborges/consertar/getx/example_nav2/lib/main.dart
FLUTTER_TARGET=lib/main.dart
FLUTTER_BUILD_DIR=build
FLUTTER_BUILD_NAME=1.0.0
FLUTTER_BUILD_NUMBER=1
EXCLUDED_ARCHS[sdk=iphonesimulator*]=i386
EXCLUDED_ARCHS[sdk=iphoneos*]=armv7
DART_DEFINES=RkxVVFRFUl9XRUJfQVVUT19ERVRFQ1Q9dHJ1ZQ==
DART_OBFUSCATION=false
TRACK_WIDGET_CREATION=true
TREE_SHAKE_ICONS=false
PACKAGE_CONFIG=/Users/jonatasborges/consertar/getx/example_nav2/.dart_tool/package_config.json
PACKAGE_CONFIG=.dart_tool/package_config.json
... ...
#!/bin/sh
# This is a generated file; do not edit or check into version control.
export "FLUTTER_ROOT=/Users/jonatasborges/flutter"
export "FLUTTER_APPLICATION_PATH=/Users/jonatasborges/consertar/getx/example_nav2"
export "FLUTTER_APPLICATION_PATH=/Users/jonatasborges/getx-parse/getx/example_nav2"
export "COCOAPODS_PARALLEL_CODE_SIGN=true"
export "FLUTTER_TARGET=/Users/jonatasborges/consertar/getx/example_nav2/lib/main.dart"
export "FLUTTER_TARGET=lib/main.dart"
export "FLUTTER_BUILD_DIR=build"
export "FLUTTER_BUILD_NAME=1.0.0"
export "FLUTTER_BUILD_NUMBER=1"
export "DART_DEFINES=RkxVVFRFUl9XRUJfQVVUT19ERVRFQ1Q9dHJ1ZQ=="
export "DART_OBFUSCATION=false"
export "TRACK_WIDGET_CREATION=true"
export "TREE_SHAKE_ICONS=false"
export "PACKAGE_CONFIG=/Users/jonatasborges/consertar/getx/example_nav2/.dart_tool/package_config.json"
export "PACKAGE_CONFIG=.dart_tool/package_config.json"
... ...
... ... @@ -10,11 +10,6 @@ class RootController extends GetxController {
}
@override
void onReady() {
super.onReady();
}
@override
void onClose() {}
void increment() => count.value++;
}
... ...
... ... @@ -10,11 +10,6 @@ class SettingsController extends GetxController {
}
@override
void onReady() {
super.onReady();
}
@override
void onClose() {}
void increment() => count.value++;
}
... ...
... ... @@ -5,7 +5,6 @@ export 'src/extension_navigation.dart';
export 'src/root/get_cupertino_app.dart';
export 'src/root/get_material_app.dart';
export 'src/root/internacionalization.dart';
export 'src/root/root_controller.dart';
export 'src/routes/custom_transition.dart';
export 'src/routes/default_route.dart';
export 'src/routes/get_route.dart';
... ...
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import '../../../get.dart';
// class GetMaterialController extends FullLifeCycleController {
// GetMaterialController(this.config);
// // late final RouterDelegate<Object> routerDelegate;
// // late final RouteInformationParser<Object> routeInformationParser;
// final ConfigData config;
// // bool testMode = false;
// // Key? unikey;
// // ThemeData? theme;
// // ThemeData? darkTheme;
// // ThemeMode? themeMode;
// // final scaffoldMessengerKey = GlobalKey<ScaffoldMessengerState>();
// // bool defaultPopGesture = GetPlatform.isIOS;
// // bool defaultOpaqueRoute = true;
// // Transition? defaultTransition;
// // Duration defaultTransitionDuration = Duration(milliseconds: 300);
// // Curve defaultTransitionCurve = Curves.easeOutQuad;
// // Curve defaultDialogTransitionCurve = Curves.easeOutQuad;
// // Duration defaultDialogTransitionDuration = Duration(milliseconds: 300);
// // final routing = Routing();
// // Map<String, String?> parameters = {};
// // CustomTransition? customTransition;
// // Map<dynamic, GetDelegate> keys = {};
// // GetDelegate? nestedKey(String? key) {
// // if (key == null) {
// // return routerDelegate as GetDelegate;
// // }
// // keys.putIfAbsent(
// // key,
// // () => GetDelegate(
// // showHashOnUrl: true,
// // //debugLabel: 'Getx nested key: ${key.toString()}',
// // pages: RouteDecoder.fromRoute(key).currentChildrens ?? [],
// // ),
// // );
// // return keys[key];
// // }
// }
... ... @@ -133,11 +133,11 @@ class GetDelegate extends RouterDelegate<RouteDecoder>
_activePages.add(res);
}
Future<T?> _unsafeHistoryRemove<T>(RouteDecoder config, T result) async {
var index = _activePages.indexOf(config);
if (index >= 0) return _unsafeHistoryRemoveAt(index, result);
return null;
}
// Future<T?> _unsafeHistoryRemove<T>(RouteDecoder config, T result) async {
// var index = _activePages.indexOf(config);
// if (index >= 0) return _unsafeHistoryRemoveAt(index, result);
// return null;
// }
Future<T?> _unsafeHistoryRemoveAt<T>(int index, T result) async {
if (index == _activePages.length - 1 && _activePages.length > 1) {
... ...
... ... @@ -185,6 +185,7 @@ class GetObserver extends NavigatorObserver {
}
}
//TODO: Use copyWith, and remove mutate variables
class Routing {
String current;
String previous;
... ...
import 'package:flutter/foundation.dart';
import '../../../route_manager.dart';
import '../../../get.dart';
@immutable
class RouteDecoder {
... ... @@ -174,6 +174,22 @@ class ParseRouteTree {
}
}
void handleChild(GetPage route) {
final children = route.children;
for (var child in children) {
final middlewares = List.of(route.middlewares);
final bindings = List.of(route.bindings);
middlewares.addAll(child.middlewares);
bindings.addAll(child.bindings);
child = child.copyWith(middlewares: middlewares, bindings: bindings);
if (child.inheritParentPath) {
child = child.copyWith(
name: ('${route.path}/${child.path}').replaceAll(r'//', '/'));
}
addRoute(child);
}
}
List<GetPage> _flattenPage(GetPage route) {
final result = <GetPage>[];
if (route.children.isEmpty) {
... ... @@ -187,11 +203,25 @@ class ParseRouteTree {
if (page.middlewares.isNotEmpty) ...page.middlewares,
if (route.middlewares.isNotEmpty) ...route.middlewares
];
final parentBindings = [
if (page.binding != null) page.binding!,
if (page.bindings.isNotEmpty) ...page.bindings,
if (route.bindings.isNotEmpty) ...route.bindings
];
final parentBinds = [
if (page.binds.isNotEmpty) ...page.binds,
if (route.binds.isNotEmpty) ...route.binds
];
result.add(
_addChild(
page,
parentPath,
parentMiddlewares,
parentBindings,
parentBinds,
),
);
... ... @@ -204,6 +234,15 @@ class ParseRouteTree {
...parentMiddlewares,
if (child.middlewares.isNotEmpty) ...child.middlewares,
],
[
...parentBindings,
if (child.binding != null) child.binding!,
if (child.bindings.isNotEmpty) ...child.bindings,
],
[
...parentBinds,
if (child.binds.isNotEmpty) ...child.binds,
],
));
}
}
... ... @@ -212,10 +251,19 @@ class ParseRouteTree {
/// Change the Path for a [GetPage]
GetPage _addChild(
GetPage origin, String parentPath, List<GetMiddleware> middlewares) {
GetPage origin,
String parentPath,
List<GetMiddleware> middlewares,
List<BindingsInterface> bindings,
List<Bind> binds,
) {
return origin.copyWith(
middlewares: middlewares,
name: (parentPath + origin.name).replaceAll(r'//', '/'),
name: origin.inheritParentPath
? (parentPath + origin.name).replaceAll(r'//', '/')
: origin.name,
bindings: bindings,
binds: binds,
// key:
);
}
... ...