From f3de0bc165912eb9381b83477a74b996c92fd5d9 Mon Sep 17 00:00:00 2001 From: lars Date: Tue, 24 Jun 2025 15:09:37 +0200 Subject: [PATCH] centered file preview, made text copyable --- .../pages/talk/components/chatBubble.dart | 2 +- .../pages/talk/components/chatMessage.dart | 40 +++++++++++-------- 2 files changed, 24 insertions(+), 18 deletions(-) diff --git a/lib/view/pages/talk/components/chatBubble.dart b/lib/view/pages/talk/components/chatBubble.dart index 6e72b52..c4f5b56 100644 --- a/lib/view/pages/talk/components/chatBubble.dart +++ b/lib/view/pages/talk/components/chatBubble.dart @@ -206,7 +206,7 @@ class _ChatBubbleState extends State with SingleTickerProviderStateM ), ), Visibility( - visible: !message.containsFile, + visible: widget.bubbleData.message != '{file}', child: ListTile( leading: const Icon(Icons.copy), title: const Text('Nachricht kopieren'), diff --git a/lib/view/pages/talk/components/chatMessage.dart b/lib/view/pages/talk/components/chatMessage.dart index 5f9b397..c5bc379 100644 --- a/lib/view/pages/talk/components/chatMessage.dart +++ b/lib/view/pages/talk/components/chatMessage.dart @@ -39,23 +39,29 @@ class ChatMessage { child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - CachedNetworkImage( - errorWidget: (context, url, error) => Row( - mainAxisSize: MainAxisSize.min, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - const Icon(Icons.file_open_outlined, size: 35), - const SizedBox(width: 10), - Flexible(child: Text(file!.name, maxLines: 2, overflow: TextOverflow.ellipsis, style: const TextStyle(fontWeight: FontWeight.bold))), - const SizedBox(width: 10), - ], - ), - alignment: Alignment.center, - placeholder: (context, url) => const Padding(padding: EdgeInsets.all(15), child: SizedBox(width: 50, child: LinearProgressIndicator())), - fadeInDuration: Duration.zero, - fadeOutDuration: Duration.zero, - errorListener: (value) {}, - imageUrl: 'https://${AccountData().buildHttpAuthString()}@${EndpointData().nextcloud().full()}/index.php/core/preview?fileId=${file!.id}&x=100&y=-1&a=1', + Row( + mainAxisSize: MainAxisSize.max, + mainAxisAlignment: MainAxisAlignment.center, + children: [ + CachedNetworkImage( + errorWidget: (context, url, error) => Row( + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + const Icon(Icons.file_open_outlined, size: 35), + const SizedBox(width: 10), + Flexible(child: Text(file!.name, maxLines: 2, overflow: TextOverflow.ellipsis, style: const TextStyle(fontWeight: FontWeight.bold))), + const SizedBox(width: 10), + ], + ), + alignment: Alignment.center, + placeholder: (context, url) => const Padding(padding: EdgeInsets.all(15), child: SizedBox(width: 50, child: LinearProgressIndicator())), + fadeInDuration: Duration.zero, + fadeOutDuration: Duration.zero, + errorListener: (value) {}, + imageUrl: 'https://${AccountData().buildHttpAuthString()}@${EndpointData().nextcloud().full()}/index.php/core/preview?fileId=${file!.id}&x=100&y=-1&a=1', + ) + ], ), SizedBox(height: 5), contentWidget