This commit is contained in:
toly
2023-11-26 09:04:44 +08:00
parent 6e8d926693
commit 2ceed8b9b5
20 changed files with 597 additions and 18 deletions

View File

@@ -1,5 +1,7 @@
import 'package:flutter/material.dart';
import 'package:iroute/components/components.dart';
import 'package:provider/provider.dart';
import '../../../pages/sort/provider/state.dart';
import '../router/app_router_delegate.dart';
import '../router/iroute_config.dart';
import '../router/routes.dart';
@@ -37,7 +39,7 @@ class _AppNavigationRailState extends State<AppNavigationRail> {
tail: Padding(
padding: const EdgeInsets.only(bottom: 6.0),
child: Text(
'V0.0.10',
'V0.0.11',
style: TextStyle(color: Colors.white, fontSize: 12),
),
),
@@ -66,6 +68,12 @@ class _AppNavigationRailState extends State<AppNavigationRail> {
router.changePath(path, keepAlive: true,recordHistory: true);
return;
}
if(index ==2){
SortState state = SortStateScope.read(context);
String name = state.config.name;
router.changePath('/app/sort/$name',recordHistory: true);
return;
}
if (index == 4) {
router.changePath(path, style: RouteStyle.push,recordHistory: true);
return;

View File

@@ -1,7 +1,9 @@
import 'package:flutter/material.dart';
import 'package:iroute/components/components.dart';
import '../../../../pages/sort/provider/state.dart';
import '../../router/app_router_delegate.dart';
import '../../router/routes.dart';
import '../../router/utils/path_utils.dart';
import '../../router/views/route_back_indicator.dart';
import 'app_router_editor.dart';
import 'history_view_icon.dart';
@@ -83,6 +85,13 @@ class _RouterIndicatorState extends State<RouterIndicator> {
void _onRouterChange() {
setState(() {});
if(router.path.startsWith('/app/sort/')){
SortState state = SortStateScope.of(context);
String name = router.path.replaceAll('/app/sort/', '');
if(name!='settings'){
state.selectName(name);
}
}
}
List<BreadcrumbItem> pathToBreadcrumbItems(String path) {
@@ -97,7 +106,12 @@ class _RouterIndicatorState extends State<RouterIndicator> {
for (String segment in uri.pathSegments) {
to += '/$segment';
String label = kRouteLabelMap[to] ?? '未知路由';
String label = '';
if(to.startsWith('/app/sort/')){
label = to.replaceAll('/app/sort/', '');
}else{
label = kRouteLabelMap[to] ?? '未知路由';
}
if(label.isNotEmpty){
result.add(BreadcrumbItem(to: to, label: label, active: to == distPath));
}