b02daf1448
- 文件管理器分页加载、排序偏好、桌面表头排序、移动端排序菜单、Ctrl/Cmd+F搜索、Esc 关闭搜索、鼠标右滑返回上级。 - 移动端同步状态页、同步统计卡片、同步任务/累计统计事件、同步页布局更新。 - Android 相册同步默认路径改为 DCIM/Camera,下载路径改用 external_path。 - Rust sync-core 更新:Android 日志依赖、AlbumUpload/AlbumDownload、MirrorWcf 统计修复、Linux FUSE镜像挂载与读写同步支持。 - 依赖更新:external_path、fl_chart、pdfrx 升级,并修了 pdfrx 新版本的deprecated API。 - 新增文件包括:sort_options.dart、sync_page_android.dart、sync_stats_card.dart、platform/fuse.rs、sync_engine/fuse.rs。
279 lines
9.2 KiB
Dart
279 lines
9.2 KiB
Dart
import 'package:flutter/material.dart';
|
|
import '../presentation/pages/auth/login_page.dart';
|
|
import '../presentation/pages/shell/app_shell.dart';
|
|
import '../presentation/pages/splash/splash_page.dart';
|
|
import '../presentation/pages/shares/shares_page.dart';
|
|
import '../presentation/pages/recycle_bin/recycle_bin_page.dart';
|
|
import '../presentation/pages/webdav/webdav_page.dart';
|
|
import '../presentation/pages/remote_download/remote_download_page.dart';
|
|
import '../presentation/pages/settings/settings_page.dart';
|
|
import '../presentation/pages/sync/sync_page_android.dart';
|
|
import '../presentation/pages/sync/sync_settings_page.dart';
|
|
import '../presentation/pages/preview/image_preview_page.dart';
|
|
import '../presentation/pages/preview/pdf_preview_page.dart';
|
|
import '../presentation/pages/preview/video_preview_page.dart';
|
|
import '../presentation/pages/preview/audio_preview_page.dart';
|
|
import '../presentation/pages/preview/document_preview_page.dart';
|
|
import '../presentation/pages/preview/markdown_preview_page.dart';
|
|
import '../presentation/pages/files/category_files_page.dart';
|
|
import '../presentation/pages/share/share_link_page.dart';
|
|
import '../presentation/pages/preview/cloudreve_file_app_page.dart';
|
|
import '../services/share_link_service.dart';
|
|
import '../data/models/file_model.dart';
|
|
|
|
/// 路由名称
|
|
class RouteNames {
|
|
static const String splash = '/';
|
|
static const String login = '/login';
|
|
static const String home = '/home';
|
|
static const String settings = '/settings';
|
|
static const String profile = '/profile';
|
|
static const String share = '/share';
|
|
static const String fileDetail = '/file-detail';
|
|
static const String recycleBin = '/recycle-bin';
|
|
static const String webdav = '/webdav';
|
|
static const String remoteDownload = '/remote-download';
|
|
static const String imagePreview = '/image-preview';
|
|
static const String pdfPreview = '/pdf-preview';
|
|
static const String videoPreview = '/video-preview';
|
|
static const String audioPreview = '/audio-preview';
|
|
static const String documentPreview = '/document-preview';
|
|
static const String markdownPreview = '/markdown-preview';
|
|
static const String categoryFiles = '/category-files';
|
|
static const String syncStatus = '/sync-status';
|
|
static const String syncSettings = '/sync-settings';
|
|
static const String shareLink = '/share-link';
|
|
static const String cloudreveFileApp = '/cloudreve-file-app';
|
|
}
|
|
|
|
/// 应用路由
|
|
class AppRouter {
|
|
static Route<dynamic> generateRoute(RouteSettings settings) {
|
|
switch (settings.name) {
|
|
case RouteNames.splash:
|
|
return MaterialPageRoute(
|
|
settings: settings,
|
|
builder: (context) => const SplashPage(),
|
|
);
|
|
|
|
case RouteNames.login:
|
|
return MaterialPageRoute(
|
|
settings: settings,
|
|
builder: (context) => const LoginPage(),
|
|
);
|
|
|
|
case RouteNames.home:
|
|
return MaterialPageRoute(
|
|
settings: settings,
|
|
builder: (context) => const AppShell(),
|
|
);
|
|
|
|
case RouteNames.share:
|
|
return MaterialPageRoute(
|
|
settings: settings,
|
|
builder: (context) => const SharesPage(),
|
|
);
|
|
|
|
case RouteNames.recycleBin:
|
|
return MaterialPageRoute(
|
|
settings: settings,
|
|
builder: (context) => const RecycleBinPage(),
|
|
);
|
|
|
|
case RouteNames.webdav:
|
|
return MaterialPageRoute(
|
|
settings: settings,
|
|
builder: (context) => const WebdavPage(),
|
|
);
|
|
|
|
case RouteNames.remoteDownload:
|
|
return MaterialPageRoute(
|
|
settings: settings,
|
|
builder: (context) => const RemoteDownloadPage(),
|
|
);
|
|
|
|
case RouteNames.settings:
|
|
return MaterialPageRoute(
|
|
settings: settings,
|
|
builder: (context) => const SettingsPage(),
|
|
);
|
|
|
|
case RouteNames.imagePreview:
|
|
final args = settings.arguments;
|
|
if (args is Map<String, dynamic>) {
|
|
return MaterialPageRoute(
|
|
settings: settings,
|
|
builder: (context) => ImagePreviewPage(
|
|
file: args['file'] as FileModel,
|
|
entityId: args['entityId'] as String?,
|
|
),
|
|
);
|
|
}
|
|
final file = args as FileModel;
|
|
return MaterialPageRoute(
|
|
settings: settings,
|
|
builder: (context) => ImagePreviewPage(file: file),
|
|
);
|
|
|
|
case RouteNames.pdfPreview:
|
|
final args = settings.arguments;
|
|
if (args is Map<String, dynamic>) {
|
|
return MaterialPageRoute(
|
|
settings: settings,
|
|
builder: (context) => PdfPreviewPage(
|
|
file: args['file'] as FileModel,
|
|
entityId: args['entityId'] as String?,
|
|
),
|
|
);
|
|
}
|
|
final file = args as FileModel;
|
|
return MaterialPageRoute(
|
|
settings: settings,
|
|
builder: (context) => PdfPreviewPage(file: file),
|
|
);
|
|
|
|
case RouteNames.videoPreview:
|
|
final args = settings.arguments;
|
|
if (args is Map<String, dynamic>) {
|
|
return MaterialPageRoute(
|
|
settings: settings,
|
|
builder: (context) => VideoPreviewPage(
|
|
file: args['file'] as FileModel,
|
|
entityId: args['entityId'] as String?,
|
|
),
|
|
);
|
|
}
|
|
final file = args as FileModel;
|
|
return MaterialPageRoute(
|
|
settings: settings,
|
|
builder: (context) => VideoPreviewPage(file: file),
|
|
);
|
|
|
|
case RouteNames.audioPreview:
|
|
final args = settings.arguments;
|
|
if (args is Map<String, dynamic>) {
|
|
return MaterialPageRoute(
|
|
settings: settings,
|
|
builder: (context) => AudioPreviewPage(
|
|
file: args['file'] as FileModel,
|
|
entityId: args['entityId'] as String?,
|
|
),
|
|
);
|
|
}
|
|
final file = args as FileModel;
|
|
return MaterialPageRoute(
|
|
settings: settings,
|
|
builder: (context) => AudioPreviewPage(file: file),
|
|
);
|
|
|
|
case RouteNames.documentPreview:
|
|
final args = settings.arguments;
|
|
if (args is Map<String, dynamic>) {
|
|
return MaterialPageRoute(
|
|
settings: settings,
|
|
builder: (context) => DocumentPreviewPage(
|
|
file: args['file'] as FileModel,
|
|
entityId: args['entityId'] as String?,
|
|
),
|
|
);
|
|
}
|
|
final file = args as FileModel;
|
|
return MaterialPageRoute(
|
|
settings: settings,
|
|
builder: (context) => DocumentPreviewPage(file: file),
|
|
);
|
|
|
|
case RouteNames.markdownPreview:
|
|
final args = settings.arguments;
|
|
if (args is Map<String, dynamic>) {
|
|
return MaterialPageRoute(
|
|
settings: settings,
|
|
builder: (context) => MarkdownPreviewPage(
|
|
file: args['file'] as FileModel,
|
|
entityId: args['entityId'] as String?,
|
|
),
|
|
);
|
|
}
|
|
final file = args as FileModel;
|
|
return MaterialPageRoute(
|
|
settings: settings,
|
|
builder: (context) => MarkdownPreviewPage(file: file),
|
|
);
|
|
|
|
case RouteNames.categoryFiles:
|
|
final args = settings.arguments;
|
|
if (args is CategoryFilesPageArgs) {
|
|
return MaterialPageRoute(
|
|
settings: settings,
|
|
builder: (context) => CategoryFilesPage(args: args),
|
|
);
|
|
}
|
|
if (args is Map<String, dynamic>) {
|
|
return MaterialPageRoute(
|
|
settings: settings,
|
|
builder: (context) =>
|
|
CategoryFilesPage(args: CategoryFilesPageArgs.fromMap(args)),
|
|
);
|
|
}
|
|
return MaterialPageRoute(
|
|
settings: settings,
|
|
builder: (context) => const CategoryFilesPage(
|
|
args: CategoryFilesPageArgs(
|
|
category: 'image',
|
|
title: '图片',
|
|
icon: Icons.image,
|
|
color: Color(0xFFF0ABFC),
|
|
),
|
|
),
|
|
);
|
|
|
|
case RouteNames.syncSettings:
|
|
return MaterialPageRoute(
|
|
settings: settings,
|
|
builder: (context) => const SyncSettingsPage(),
|
|
);
|
|
|
|
case RouteNames.syncStatus:
|
|
return MaterialPageRoute(
|
|
settings: settings,
|
|
builder: (context) => const SyncPageAndroid(),
|
|
);
|
|
|
|
case RouteNames.shareLink:
|
|
final args = settings.arguments;
|
|
if (args is ShareLinkCandidate) {
|
|
return MaterialPageRoute(
|
|
settings: settings,
|
|
builder: (context) => ShareLinkPage(candidate: args),
|
|
);
|
|
}
|
|
return MaterialPageRoute(
|
|
settings: settings,
|
|
builder: (context) => const SplashPage(),
|
|
);
|
|
|
|
case RouteNames.cloudreveFileApp:
|
|
final args = settings.arguments;
|
|
if (args is Map<String, dynamic>) {
|
|
return MaterialPageRoute(
|
|
settings: settings,
|
|
builder: (context) => CloudreveFileAppPage(
|
|
file: args['file'] as FileModel,
|
|
preferredAction: args['preferredAction'] as String?,
|
|
),
|
|
);
|
|
}
|
|
return MaterialPageRoute(
|
|
settings: settings,
|
|
builder: (context) => const SplashPage(),
|
|
);
|
|
|
|
default:
|
|
return MaterialPageRoute(
|
|
settings: settings,
|
|
builder: (context) => const SplashPage(),
|
|
);
|
|
}
|
|
}
|
|
}
|