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-02-20 11:19:24 -0300
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
41803e45ddebf50cdfe0be858b589a4c0c778927
41803e45
1 parent
32d8c348
inherit-bindings
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
63 additions
and
78 deletions
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
lib/get_navigation/get_navigation.dart
lib/get_navigation/src/root/root_controller.dart
lib/get_navigation/src/routes/get_router_delegate.dart
lib/get_navigation/src/routes/observers/route_observer.dart
lib/get_navigation/src/routes/parse_route.dart
example_nav2/ios/Flutter/Generated.xcconfig
View file @
41803e4
// 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
...
...
example_nav2/ios/Flutter/flutter_export_environment.sh
View file @
41803e4
#!/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"
...
...
example_nav2/lib/app/modules/root/controllers/root_controller.dart
View file @
41803e4
...
...
@@ -10,11 +10,6 @@ class RootController extends GetxController {
}
@override
void
onReady
()
{
super
.
onReady
();
}
@override
void
onClose
()
{}
void
increment
()
=>
count
.
value
++;
}
...
...
example_nav2/lib/app/modules/settings/controllers/settings_controller.dart
View file @
41803e4
...
...
@@ -10,11 +10,6 @@ class SettingsController extends GetxController {
}
@override
void
onReady
()
{
super
.
onReady
();
}
@override
void
onClose
()
{}
void
increment
()
=>
count
.
value
++;
}
...
...
lib/get_navigation/get_navigation.dart
View file @
41803e4
...
...
@@ -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'
;
...
...
lib/get_navigation/src/root/root_controller.dart
deleted
100644 → 0
View file @
32d8c34
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];
// // }
// }
lib/get_navigation/src/routes/get_router_delegate.dart
View file @
41803e4
...
...
@@ -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
)
{
...
...
lib/get_navigation/src/routes/observers/route_observer.dart
View file @
41803e4
...
...
@@ -185,6 +185,7 @@ class GetObserver extends NavigatorObserver {
}
}
//TODO: Use copyWith, and remove mutate variables
class
Routing
{
String
current
;
String
previous
;
...
...
lib/get_navigation/src/routes/parse_route.dart
View file @
41803e4
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:
);
}
...
...
Please
register
or
login
to post a comment