Able to open file detail view from lightbox

This commit is contained in:
2025-11-18 21:59:35 +08:00
parent 715ce1a368
commit 1e908502dc
2 changed files with 35 additions and 17 deletions

View File

@@ -170,6 +170,22 @@ final routerProvider = Provider<GoRouter>((ref) {
builder: (context, state) => const AboutScreen(),
),
GoRoute(
name: 'fileDetail',
path: '/files/:id',
builder: (context, state) {
// For now, we'll need to pass the file object through extra
// This will be updated when we modify the file list navigation
final file = state.extra as SnCloudFile?;
if (file != null) {
return FileDetailScreen(item: file);
}
// Fallback - this shouldn't happen in normal flow
Navigator.of(context).pop();
return const SizedBox.shrink();
},
),
// Main tabs with TabsScreen shell
ShellRoute(
navigatorKey: _tabsShellKey,
@@ -427,23 +443,6 @@ final routerProvider = Provider<GoRouter>((ref) {
name: 'files',
path: '/files',
builder: (context, state) => const FileListScreen(),
routes: [
GoRoute(
name: 'fileDetail',
path: ':id',
builder: (context, state) {
// For now, we'll need to pass the file object through extra
// This will be updated when we modify the file list navigation
final file = state.extra as SnCloudFile?;
if (file != null) {
return FileDetailScreen(item: file);
}
// Fallback - this shouldn't happen in normal flow
Navigator.of(context).pop();
return const SizedBox.shrink();
},
),
],
),
// SN-chan tab

View File

@@ -8,6 +8,7 @@ import 'package:flutter/material.dart';
import 'package:flutter_hooks/flutter_hooks.dart';
import 'package:gal/gal.dart';
import 'package:gap/gap.dart';
import 'package:go_router/go_router.dart';
import 'package:hooks_riverpod/hooks_riverpod.dart';
import 'package:island/models/file.dart';
import 'package:island/pods/config.dart';
@@ -171,6 +172,24 @@ class CloudFileLightbox extends HookConsumerWidget {
),
onPressed: showInfoSheet,
),
IconButton(
onPressed: () {
final router = GoRouter.of(context);
Navigator.of(context).pop(context);
Future(() {
router.pushNamed(
'fileDetail',
pathParameters: {'id': item.id},
extra: item,
);
});
},
icon: Icon(
Icons.more_horiz,
color: Colors.white,
shadows: shadow,
),
),
Spacer(),
IconButton(
icon: Icon(