diff --git a/lib/view/pages/talk/components/chatBubble.dart b/lib/view/pages/talk/components/chatBubble.dart index 226555d..15338dc 100644 --- a/lib/view/pages/talk/components/chatBubble.dart +++ b/lib/view/pages/talk/components/chatBubble.dart @@ -91,9 +91,9 @@ class _ChatBubbleState extends State { BubbleStyle getStyle() { if(widget.bubbleData.messageType == GetRoomResponseObjectMessageType.comment) { if(widget.isSender) { - return getSelfStyle(message.containsFile); + return getSelfStyle(false); } else { - return getRemoteStyle(message.containsFile); + return getRemoteStyle(false); } } else { return getSystemStyle(); @@ -117,61 +117,53 @@ class _ChatBubbleState extends State { children: [ GestureDetector( child: Bubble( - style: getStyle(), child: Container( constraints: BoxConstraints( maxWidth: MediaQuery.of(context).size.width * 0.9, minWidth: showActorDisplayName ? _textSize(widget.bubbleData.actorDisplayName, actorTextStyle).width : 30, ), - child: Stack( + child: Column( + mainAxisSize: MainAxisSize.min, children: [ - Padding( - padding: EdgeInsets.only(bottom: showBubbleTime ? 18 : 0, top: showActorDisplayName ? 18 : 0), - child: message.getWidget() - ), - Visibility( - visible: showActorDisplayName, - child: Positioned( - top: 0, - left: 0, - child: Text( - widget.bubbleData.actorDisplayName, - textAlign: TextAlign.start, - style: actorTextStyle, + Stack( + children: [ + Padding( + padding: EdgeInsets.only(bottom: showBubbleTime ? 18 : 0, top: showActorDisplayName ? 18 : 0), + child: message.getWidget() ), - ), - ), - Visibility( - visible: showBubbleTime, - child: Positioned( - bottom: 0, - right: 0, - child: Text( - Jiffy.parseFromMillisecondsSinceEpoch(widget.bubbleData.timestamp * 1000).format(pattern: "HH:mm"), - textAlign: TextAlign.end, - style: const TextStyle(color: Colors.grey, fontSize: 12), + Visibility( + visible: showActorDisplayName, + child: Positioned( + top: 0, + left: 0, + child: Text( + widget.bubbleData.actorDisplayName, + textAlign: TextAlign.start, + style: actorTextStyle, + ), + ), ), - ), + Visibility( + visible: showBubbleTime, + child: Positioned( + bottom: 0, + right: 0, + child: Text( + Jiffy.parseFromMillisecondsSinceEpoch(widget.bubbleData.timestamp * 1000).format(pattern: "HH:mm"), + textAlign: TextAlign.end, + style: const TextStyle(color: Colors.grey, fontSize: 12), + ), + ), + ), + ], ), Visibility( visible: downloadProgress > 0, - child: Positioned( - top: 0, - left: 0, - right: 0, - bottom: 0, - child: Stack( - children: [ - const Center(child: Icon(Icons.download)), - const Center(child: CircularProgressIndicator(color: Colors.white)), - Center(child: CircularProgressIndicator(value: downloadProgress/100)), - ], - ) - ), + child: LinearProgressIndicator(value: downloadProgress/100) ), ], - ), + ) ), ), onLongPress: () { diff --git a/lib/view/pages/talk/components/chatMessage.dart b/lib/view/pages/talk/components/chatMessage.dart index 4b220c8..c18d2d1 100644 --- a/lib/view/pages/talk/components/chatMessage.dart +++ b/lib/view/pages/talk/components/chatMessage.dart @@ -38,17 +38,22 @@ class ChatMessage { return CachedNetworkImage( errorWidget: (context, url, error) { - return Column( + return Padding(padding: const EdgeInsets.only(top: 10), child: Row( + crossAxisAlignment: CrossAxisAlignment.center, children: [ - const Icon(Icons.image_not_supported_outlined, size: 35), - Text("Keine Dateivorschau:\n${file!.name}", style: const TextStyle(fontWeight: FontWeight.bold)) + const Icon(Icons.file_open_outlined, size: 35), + const SizedBox(width: 10), + Expanded(child: Text(file!.name, style: const TextStyle(fontWeight: FontWeight.bold))) ], - ); + )); }, alignment: Alignment.center, placeholder: (context, url) { return const Padding(padding: EdgeInsets.all(10), child: CircularProgressIndicator()); }, + 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", ); } @@ -56,8 +61,6 @@ class ChatMessage { void onOpen(LinkableElement link) async { if(await canLaunchUrlString(link.url)) { await launchUrlString(link.url); - } else { - } } } \ No newline at end of file