This commit is contained in:
toly
2023-11-08 09:35:29 +08:00
parent 88cd6fb3b4
commit 8fb4bf57d6
78 changed files with 4344 additions and 544 deletions

View File

@@ -44,6 +44,7 @@ class AppRouterDelegate extends RouterDelegate<Object> with ChangeNotifier {
final List<String> keepAlivePath = [] ;
void setPathKeepLive(String value){
if(keepAlivePath.contains(value)){
keepAlivePath.remove(value);
@@ -52,6 +53,8 @@ class AppRouterDelegate extends RouterDelegate<Object> with ChangeNotifier {
path = value;
}
void setPathForData(String value,dynamic data){
_pathExtraMap[value] = data;
path = value;
@@ -82,6 +85,17 @@ class AppRouterDelegate extends RouterDelegate<Object> with ChangeNotifier {
List<Page> pages = [];
List<Page> topPages = _buildPageByPath(path);
if(keepAlivePath.isNotEmpty){
for (String alivePath in keepAlivePath) {
if(alivePath!=path){
pages.addAll(_buildPageByPath(alivePath)) ;
}
}
/// 去除和 topPages 中重复的界面
pages.removeWhere((element) => topPages.map((e) => e.key).contains(element.key));
}
if(keepAlivePath.isNotEmpty){
for (String alivePath in keepAlivePath) {
if(alivePath!=path){
@@ -171,7 +185,6 @@ class AppRouterDelegate extends RouterDelegate<Object> with ChangeNotifier {
_completerMap[path]?.complete(result);
_completerMap.remove(path);
}
path = backPath(path);
return route.didPop(result);
}