This commit is contained in:
toly
2023-10-21 10:10:48 +08:00
parent 689e8d9fdb
commit bcba7ebae2
268 changed files with 83 additions and 13102 deletions

View File

@@ -1,46 +1,46 @@
import 'package:iroute/13/04/app/navigation/router/iroute.dart';
void main() {
String path = '/color/detail/a';
// List<String> parts = path.split('/');
// print(parts);
// print(parserPath(path));
Uri uri = Uri.parse(path);
print(uri.fragment);
print(uri.pathSegments);
List<String> parts = uri.pathSegments;
parts = List.of(parts)..removeLast();
String result = parts.join('/');
print(result);
}
IRoute? parserPath(String path){
List<String> parts = path.split('/');
String lever1 = '/${parts[1]}';
List<IRoute> iRoutes = kDestinationsIRoutes.where((e) => e.path == lever1).toList();
int counter = 2;
IRoute? result;
String check = lever1;
List<IRoute> children = iRoutes.first.children;
check = check +"/" + parts[counter];
for(int i = 0;i<children.length;i++){
String path = children[i].path;
if(path == check){
result = children[i];
break;
}
// String path =
// result.children.add(IRoute(path: parts[i]);
}
return result;
}
// import 'package:iroute/13/04/app/navigation/router/iroute.dart';
//
// void main() {
// String path = '/color/detail/a';
// // List<String> parts = path.split('/');
// // print(parts);
// // print(parserPath(path));
//
// Uri uri = Uri.parse(path);
// print(uri.fragment);
// print(uri.pathSegments);
//
// List<String> parts = uri.pathSegments;
//
// parts = List.of(parts)..removeLast();
// String result = parts.join('/');
// print(result);
// }
//
//
// IRoute? parserPath(String path){
//
// List<String> parts = path.split('/');
// String lever1 = '/${parts[1]}';
// List<IRoute> iRoutes = kDestinationsIRoutes.where((e) => e.path == lever1).toList();
//
// int counter = 2;
//
// IRoute? result;
// String check = lever1;
// List<IRoute> children = iRoutes.first.children;
//
// check = check +"/" + parts[counter];
//
// for(int i = 0;i<children.length;i++){
//
// String path = children[i].path;
// if(path == check){
// result = children[i];
// break;
// }
// // String path =
// // result.children.add(IRoute(path: parts[i]);
// }
// return result;
// }