v3
This commit is contained in:
@@ -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;
|
||||
// }
|
||||
@@ -1,30 +0,0 @@
|
||||
// This is a basic Flutter widget test.
|
||||
//
|
||||
// To perform an interaction with a widget in your test, use the WidgetTester
|
||||
// utility in the flutter_test package. For example, you can send tap and scroll
|
||||
// gestures. You can also use WidgetTester to find child widgets in the widget
|
||||
// tree, read text, and verify that the values of widget properties are correct.
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
import 'package:iroute/main.dart';
|
||||
|
||||
void main() {
|
||||
testWidgets('Counter increments smoke test', (WidgetTester tester) async {
|
||||
// Build our app and trigger a frame.
|
||||
await tester.pumpWidget(const MyApp());
|
||||
|
||||
// Verify that our counter starts at 0.
|
||||
expect(find.text('0'), findsOneWidget);
|
||||
expect(find.text('1'), findsNothing);
|
||||
|
||||
// Tap the '+' icon and trigger a frame.
|
||||
await tester.tap(find.byIcon(Icons.add));
|
||||
await tester.pump();
|
||||
|
||||
// Verify that our counter has incremented.
|
||||
expect(find.text('0'), findsNothing);
|
||||
expect(find.text('1'), findsOneWidget);
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user