## Summary - Tapping a row in the Undo Log list opens a new `UndoLogDetailScreen` - Detail screen shows: account ID, action type (with icon/colour), timestamp, source folder, destination folder (move only), and a list of all emails in the transaction (subject + sender) - Navigation uses go_router nested route `/accounts/undo-log/:actionId` with `state.extra` to pass the `UndoAction` object - AppBar has an **Undo** button that calls the existing undo service and pops back ## Also fixed - `flake.nix`: replaced the broken dagger/nix 0.20.8 Nix wrapper (infinite self-exec loop) with a direct 0.21.4 `fetchurl` derivation; wired `DAGGER_HOST` so the pre-commit `dart-check` hook can reach the running engine - `pubspec.lock`: bumped `meta` 1.17→1.18 and `test` 1.30→1.31 to match what the CI resolver picks up (eliminates spurious generated-files drift in CI) ## Verification - `task test` — all 492 unit/widget tests pass - `dart analyze --fatal-infos` — clean (no warnings or infos) - Pre-commit hooks (including `dart-check` via Dagger) — all passed on commit Closes #450 Co-authored-by: Thomas SharedInbox <sharedinbox@thomas-guettler.de> Reviewed-on: https://codeberg.org/guettli/sharedinbox/pulls/461
200 lines
7.6 KiB
Dart
200 lines
7.6 KiB
Dart
import 'package:go_router/go_router.dart';
|
|
|
|
import 'package:sharedinbox/core/models/sieve_script.dart';
|
|
import 'package:sharedinbox/core/models/undo_action.dart';
|
|
|
|
import 'package:sharedinbox/ui/screens/about_screen.dart';
|
|
import 'package:sharedinbox/ui/screens/account_list_screen.dart';
|
|
import 'package:sharedinbox/ui/screens/account_receive_screen.dart';
|
|
import 'package:sharedinbox/ui/screens/account_send_screen.dart';
|
|
import 'package:sharedinbox/ui/screens/add_account_screen.dart';
|
|
import 'package:sharedinbox/ui/screens/address_emails_screen.dart';
|
|
import 'package:sharedinbox/ui/screens/bug_report_screen.dart';
|
|
import 'package:sharedinbox/ui/screens/changelog_screen.dart';
|
|
import 'package:sharedinbox/ui/screens/combined_inbox_screen.dart';
|
|
import 'package:sharedinbox/ui/screens/compose_screen.dart';
|
|
import 'package:sharedinbox/ui/screens/edit_account_screen.dart';
|
|
import 'package:sharedinbox/ui/screens/email_detail_screen.dart';
|
|
import 'package:sharedinbox/ui/screens/email_list_screen.dart';
|
|
import 'package:sharedinbox/ui/screens/mailbox_list_screen.dart';
|
|
import 'package:sharedinbox/ui/screens/search_screen.dart';
|
|
import 'package:sharedinbox/ui/screens/sieve_script_edit_screen.dart';
|
|
import 'package:sharedinbox/ui/screens/sieve_scripts_screen.dart';
|
|
import 'package:sharedinbox/ui/screens/sync_log_screen.dart';
|
|
import 'package:sharedinbox/ui/screens/thread_detail_screen.dart';
|
|
import 'package:sharedinbox/ui/screens/trusted_image_senders_screen.dart';
|
|
import 'package:sharedinbox/ui/screens/undo_log_detail_screen.dart';
|
|
import 'package:sharedinbox/ui/screens/undo_log_screen.dart';
|
|
import 'package:sharedinbox/ui/screens/user_preferences_screen.dart';
|
|
import 'package:sharedinbox/ui/widgets/undo_shell.dart';
|
|
|
|
final router = GoRouter(
|
|
initialLocation: '/inbox',
|
|
routes: [
|
|
ShellRoute(
|
|
builder: (ctx, state, child) => UndoShell(child: child),
|
|
routes: [
|
|
GoRoute(
|
|
path: '/inbox',
|
|
builder: (ctx, state) => const CombinedInboxScreen(),
|
|
),
|
|
GoRoute(
|
|
path: '/accounts',
|
|
builder: (ctx, state) => const AccountListScreen(),
|
|
routes: [
|
|
GoRoute(
|
|
path: 'add',
|
|
builder: (ctx, state) => const AddAccountScreen(),
|
|
),
|
|
GoRoute(
|
|
path: 'receive',
|
|
builder: (ctx, state) => const AccountReceiveScreen(),
|
|
),
|
|
GoRoute(
|
|
path: 'send',
|
|
builder: (ctx, state) => const AccountSendScreen(),
|
|
),
|
|
GoRoute(
|
|
path: 'undo-log',
|
|
builder: (ctx, state) => const UndoLogScreen(),
|
|
routes: [
|
|
GoRoute(
|
|
path: ':actionId',
|
|
builder: (ctx, state) => UndoLogDetailScreen(
|
|
action: state.extra as UndoAction,
|
|
),
|
|
),
|
|
],
|
|
),
|
|
GoRoute(
|
|
path: 'changelog',
|
|
builder: (ctx, state) => const ChangeLogScreen(),
|
|
),
|
|
GoRoute(
|
|
path: 'about',
|
|
builder: (ctx, state) => const AboutScreen(),
|
|
),
|
|
GoRoute(
|
|
path: 'preferences',
|
|
builder: (ctx, state) => const UserPreferencesScreen(),
|
|
),
|
|
GoRoute(
|
|
path: 'trusted-senders',
|
|
builder: (ctx, state) => TrustedImageSendersScreen(
|
|
highlightedSender: state.extra as String?,
|
|
),
|
|
),
|
|
GoRoute(
|
|
path: ':accountId/edit',
|
|
builder: (ctx, state) => EditAccountScreen(
|
|
accountId: state.pathParameters['accountId']!,
|
|
),
|
|
),
|
|
GoRoute(
|
|
path: ':accountId/sync-log',
|
|
builder: (ctx, state) =>
|
|
SyncLogScreen(accountId: state.pathParameters['accountId']!),
|
|
),
|
|
GoRoute(
|
|
path: ':accountId/sieve',
|
|
builder: (ctx, state) => SieveScriptsScreen(
|
|
accountId: state.pathParameters['accountId']!,
|
|
),
|
|
),
|
|
GoRoute(
|
|
path: ':accountId/sieve/edit',
|
|
builder: (ctx, state) => SieveScriptEditScreen(
|
|
accountId: state.pathParameters['accountId']!,
|
|
script: state.extra as SieveScript?,
|
|
),
|
|
),
|
|
GoRoute(
|
|
path: ':accountId/sieve/local',
|
|
builder: (ctx, state) => SieveScriptsScreen(
|
|
accountId: state.pathParameters['accountId']!,
|
|
isLocal: true,
|
|
),
|
|
),
|
|
GoRoute(
|
|
path: ':accountId/sieve/local/edit',
|
|
builder: (ctx, state) => SieveScriptEditScreen(
|
|
accountId: state.pathParameters['accountId']!,
|
|
script: state.extra as SieveScript?,
|
|
isLocal: true,
|
|
),
|
|
),
|
|
GoRoute(
|
|
path: ':accountId/search',
|
|
builder: (ctx, state) =>
|
|
SearchScreen(accountId: state.pathParameters['accountId']!),
|
|
),
|
|
GoRoute(
|
|
path: ':accountId/emails/by-address/:address',
|
|
builder: (ctx, state) => AddressEmailsScreen(
|
|
accountId: state.pathParameters['accountId']!,
|
|
address: state.pathParameters['address']!,
|
|
),
|
|
),
|
|
GoRoute(
|
|
path: ':accountId/mailboxes',
|
|
builder: (ctx, state) => MailboxListScreen(
|
|
accountId: state.pathParameters['accountId']!,
|
|
),
|
|
routes: [
|
|
GoRoute(
|
|
path: ':mailboxPath/emails',
|
|
builder: (ctx, state) => EmailListScreen(
|
|
accountId: state.pathParameters['accountId']!,
|
|
mailboxPath: state.pathParameters['mailboxPath']!,
|
|
),
|
|
routes: [
|
|
GoRoute(
|
|
path: ':emailId',
|
|
builder: (ctx, state) => EmailDetailScreen(
|
|
emailId: state.pathParameters['emailId']!,
|
|
),
|
|
),
|
|
],
|
|
),
|
|
GoRoute(
|
|
path: ':mailboxPath/threads/:threadId',
|
|
builder: (ctx, state) => ThreadDetailScreen(
|
|
accountId: state.pathParameters['accountId']!,
|
|
mailboxPath: Uri.decodeComponent(
|
|
state.pathParameters['mailboxPath']!,
|
|
),
|
|
threadId: Uri.decodeComponent(
|
|
state.pathParameters['threadId']!,
|
|
),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
],
|
|
),
|
|
GoRoute(path: '/search', builder: (ctx, state) => const SearchScreen()),
|
|
GoRoute(
|
|
path: '/compose',
|
|
builder: (ctx, state) {
|
|
final extra = state.extra as Map<String, dynamic>?;
|
|
return ComposeScreen(
|
|
accountId: extra?['accountId'] as String?,
|
|
replyToEmailId: extra?['replyToEmailId'] as String?,
|
|
prefillTo: extra?['prefillTo'] as String?,
|
|
prefillCc: extra?['prefillCc'] as String?,
|
|
prefillSubject: extra?['prefillSubject'] as String?,
|
|
prefillBody: extra?['prefillBody'] as String?,
|
|
);
|
|
},
|
|
),
|
|
GoRoute(
|
|
path: '/bug-report',
|
|
builder: (ctx, state) => BugReportScreen(
|
|
emailId: state.uri.queryParameters['emailId'],
|
|
),
|
|
),
|
|
],
|
|
),
|
|
],
|
|
);
|