implemented internal file sharing and saving, added server-side file references, refactored share pickers for unified flows, and updated UI branding labels

This commit is contained in:
2026-05-09 20:18:52 +02:00
parent cb2c38aaa1
commit 151678f0fe
15 changed files with 437 additions and 128 deletions
+42 -2
View File
@@ -11,6 +11,7 @@ import 'package:share_plus/share_plus.dart';
import 'package:syncfusion_flutter_pdfviewer/pdfviewer.dart';
import '../routing/app_routes.dart';
import '../share_intent/remote_file_ref.dart';
import '../state/app/modules/settings/bloc/settings_cubit.dart';
import 'info_dialog.dart';
import 'placeholder_view.dart';
@@ -19,13 +20,24 @@ import 'share_position_origin.dart';
class FileViewer extends StatefulWidget {
final String path;
final bool openExternal;
const FileViewer({super.key, required this.path, this.openExternal = false});
/// When set, enables the in-app actions "An Chat senden" and "In Dateien
/// speichern" — these need a server-side reference, not the local cache
/// path. Aufrufer reichen die Referenz durch (siehe AppRoutes.openFileViewer).
final RemoteFileRef? remoteFile;
const FileViewer({
super.key,
required this.path,
this.openExternal = false,
this.remoteFile,
});
@override
State<FileViewer> createState() => _FileViewerState();
}
enum FileViewingActions { openExternal, share, save }
enum FileViewingActions { openExternal, share, save, sendToChat, saveToCloud }
/// Workaround for a Syncfusion PDF viewer race: SfPdfViewer's internal
/// LayoutBuilder calls `localToGlobal` during build, which asserts when an
@@ -110,6 +122,16 @@ class _FileViewerState extends State<FileViewer> {
context,
widget.path,
openExternal: true,
remoteFile: widget.remoteFile,
);
break;
case FileViewingActions.sendToChat:
AppRoutes.openInternalShareToChat(context, widget.remoteFile!);
break;
case FileViewingActions.saveToCloud:
AppRoutes.openInternalSaveToFolder(
context,
widget.remoteFile!,
);
break;
case FileViewingActions.share:
@@ -154,6 +176,24 @@ class _FileViewerState extends State<FileViewer> {
dense: true,
),
),
if (widget.remoteFile != null) ...[
const PopupMenuItem(
value: FileViewingActions.sendToChat,
child: ListTile(
leading: Icon(Icons.chat_bubble_outline),
title: Text('An Talk-Chat senden'),
dense: true,
),
),
const PopupMenuItem(
value: FileViewingActions.saveToCloud,
child: ListTile(
leading: Icon(Icons.cloud_outlined),
title: Text('In Cloud speichern'),
dense: true,
),
),
],
const PopupMenuItem(
value: FileViewingActions.share,
child: ListTile(