Jonny Borges
Committed by GitHub

Merge pull request #1667 from jonataslaw/router-fix

fix router outlet
## [4.2.4]
- Added anchorRoute and filterPages to
// anchorRoute: '/',
// filterPages:
## [4.2.4]
- Fix Get.offAll removing GetxServices from memory
... ...
... ... @@ -20,9 +20,9 @@ class RootView extends GetView<RootController> {
body: GetRouterOutlet(
initialRoute: Routes.HOME,
// anchorRoute: '/',
filterPages: (afterAnchor) {
return afterAnchor.take(1);
},
// filterPages: (afterAnchor) {
// return afterAnchor.take(1);
// },
),
);
},
... ...
... ... @@ -85,16 +85,14 @@ class GetRouterOutlet extends RouterOutlet<GetDelegate, GetNavConfig> {
pickPages: (config) {
Iterable<GetPage<dynamic>> ret;
if (anchorRoute == null) {
//anchorRoute = initialRoute minus last segment
final parsedUri = Uri.parse(initialRoute);
final replacedUri = parsedUri.replace(
pathSegments: parsedUri.pathSegments.take(
parsedUri.pathSegments.length - 1,
),
);
anchorRoute = '/$replacedUri';
// jump the ancestor path
final length = Uri.parse(initialRoute).pathSegments.length;
return config.currentTreeBranch
.skip(length)
.take(length)
.toList();
}
ret = config.currentTreeBranch.pickAfterRoute(anchorRoute!);
ret = config.currentTreeBranch.pickAfterRoute(anchorRoute);
if (filterPages != null) {
ret = filterPages(ret);
}
... ...