From 1e908502dc091951bdbe36c0a262f1ca9634364b Mon Sep 17 00:00:00 2001 From: LittleSheep Date: Tue, 18 Nov 2025 21:59:35 +0800 Subject: [PATCH] :sparkles: Able to open file detail view from lightbox --- lib/route.dart | 33 ++++++++++---------- lib/widgets/content/cloud_file_lightbox.dart | 19 +++++++++++ 2 files changed, 35 insertions(+), 17 deletions(-) diff --git a/lib/route.dart b/lib/route.dart index b3f1fdee..a8c8e45e 100644 --- a/lib/route.dart +++ b/lib/route.dart @@ -170,6 +170,22 @@ final routerProvider = Provider((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((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 diff --git a/lib/widgets/content/cloud_file_lightbox.dart b/lib/widgets/content/cloud_file_lightbox.dart index dbb9da5e..789c53ca 100644 --- a/lib/widgets/content/cloud_file_lightbox.dart +++ b/lib/widgets/content/cloud_file_lightbox.dart @@ -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(