simplified code across the app and consolidated duplicated helpers

This commit is contained in:
2026-09-27 17:29:54 +02:00
parent 3e856d0b1c
commit ee1240f71a
155 changed files with 1772 additions and 2546 deletions
+6 -13
View File
@@ -2,10 +2,8 @@ import 'dart:async';
import 'package:flutter/material.dart';
import '../../routing/app_routes.dart';
import '../../utils/downloads/download_job.dart';
import '../../utils/downloads/download_manager.dart';
import '../../utils/haptics.dart';
import '../../view/pages/files/data/file_type_icon.dart';
import '../centered_leading.dart';
import '../details_bottom_sheet.dart';
@@ -90,14 +88,7 @@ class _DownloadsListState extends State<_DownloadsList> {
// Pop the sheet first so a stale-file dialog lands on the underlying
// screen instead of an emptied sheet.
Navigator.of(widget.sheetContext).pop();
if (!ensureDownloadStillExists(widget.rootContext, job)) return;
Haptics.success();
DownloadManager.instance.markOpened(job);
AppRoutes.openFileViewer(
widget.rootContext,
path,
remoteFile: job.remoteFile,
);
openFinishedDownload(widget.rootContext, job, path);
}
}
@@ -140,8 +131,7 @@ class _DownloadRow extends StatelessWidget {
DownloadInProgress() => IconButton(
icon: const Icon(Icons.close),
tooltip: 'Abbrechen',
onPressed: () =>
unawaited(DownloadManager.instance.cancel(job)),
onPressed: () => unawaited(DownloadManager.instance.cancel(job)),
),
DownloadFailed() => IconButton(
icon: const Icon(Icons.refresh),
@@ -167,7 +157,10 @@ class _DownloadRow extends StatelessWidget {
alignment: Alignment.centerRight,
padding: const EdgeInsets.only(right: 24),
color: theme.colorScheme.errorContainer,
child: Icon(Icons.delete_outline, color: theme.colorScheme.onErrorContainer),
child: Icon(
Icons.delete_outline,
color: theme.colorScheme.onErrorContainer,
),
),
onDismissed: (_) => DownloadManager.instance.dismiss(job),
child: tile,