changed file messages to show their text or their file name
This commit is contained in:
parent
9d0cf8e313
commit
da772f17cc
@ -21,22 +21,24 @@ class ChatMessage {
|
||||
ChatMessage({required this.originalMessage, this.originalData}) {
|
||||
if(originalData?.containsKey('file') ?? false) {
|
||||
file = originalData?['file'];
|
||||
content = file?.name ?? 'Datei';
|
||||
} else {
|
||||
content = RichObjectStringProcessor.parseToString(originalMessage, originalData);
|
||||
}
|
||||
content = RichObjectStringProcessor.parseToString(originalMessage, originalData);
|
||||
}
|
||||
|
||||
Widget getWidget() {
|
||||
|
||||
if(file == null) {
|
||||
return Linkify(
|
||||
var contentWidget = Linkify(
|
||||
text: content,
|
||||
onOpen: onOpen,
|
||||
);
|
||||
}
|
||||
|
||||
return Padding(padding: const EdgeInsets.only(top: 5), child: CachedNetworkImage(
|
||||
if(file == null) return contentWidget;
|
||||
|
||||
return Padding(
|
||||
padding: const EdgeInsets.only(top: 5),
|
||||
child: Column(
|
||||
children: [
|
||||
CachedNetworkImage(
|
||||
errorWidget: (context, url, error) => Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
@ -53,7 +55,12 @@ class ChatMessage {
|
||||
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
|
||||
],
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
Future<void> onOpen(LinkableElement link) async {
|
||||
|
Loading…
x
Reference in New Issue
Block a user