From dec34e297dc14a129ed5c0ea7058aa7b809a3bfc Mon Sep 17 00:00:00 2001 From: LittleSheep Date: Tue, 17 Sep 2024 20:59:01 +0800 Subject: [PATCH] :bug: Bug fixes on attachments and related things --- lib/widgets/attachments/attachment_item.dart | 2 ++ lib/widgets/auto_cache_image.dart | 24 ++++++++++++-------- lib/widgets/chat/chat_message_input.dart | 1 + 3 files changed, 17 insertions(+), 10 deletions(-) diff --git a/lib/widgets/attachments/attachment_item.dart b/lib/widgets/attachments/attachment_item.dart index b9d2483..f164a5a 100644 --- a/lib/widgets/attachments/attachment_item.dart +++ b/lib/widgets/attachments/attachment_item.dart @@ -233,6 +233,7 @@ class _AttachmentItemVideoState extends State<_AttachmentItemVideo> { final ratio = widget.item.metadata?['ratio'] ?? 16 / 9; if (!_showContent) { return GestureDetector( + behavior: HitTestBehavior.opaque, child: Stack( children: [ if (widget.item.metadata?['thumbnail'] != null) @@ -400,6 +401,7 @@ class _AttachmentItemAudioState extends State<_AttachmentItemAudio> { const ratio = 16 / 9; if (!_showContent) { return GestureDetector( + behavior: HitTestBehavior.opaque, child: Stack( children: [ if (widget.item.metadata?['thumbnail'] != null) diff --git a/lib/widgets/auto_cache_image.dart b/lib/widgets/auto_cache_image.dart index 01ac12e..c8e9697 100644 --- a/lib/widgets/auto_cache_image.dart +++ b/lib/widgets/auto_cache_image.dart @@ -10,6 +10,7 @@ class AutoCacheImage extends StatelessWidget { final BoxFit? fit; final bool noProgressIndicator; final bool noErrorWidget; + final bool isDense; const AutoCacheImage( this.url, { @@ -19,6 +20,7 @@ class AutoCacheImage extends StatelessWidget { this.fit, this.noProgressIndicator = false, this.noErrorWidget = false, + this.isDense = false, }); @override @@ -46,13 +48,14 @@ class AutoCacheImage extends StatelessWidget { child: Column( mainAxisAlignment: MainAxisAlignment.center, children: [ - const Icon(Icons.close, size: 32) + Icon(Icons.close, size: isDense ? 24 : 32) .animate(onPlay: (e) => e.repeat(reverse: true)) .fade(duration: 500.ms), - Text( - error.toString(), - textAlign: TextAlign.center, - ), + if (!isDense) + Text( + error.toString(), + textAlign: TextAlign.center, + ), ], ), ), @@ -89,13 +92,14 @@ class AutoCacheImage extends StatelessWidget { child: Column( mainAxisAlignment: MainAxisAlignment.center, children: [ - const Icon(Icons.close, size: 32) + Icon(Icons.close, size: isDense ? 24 : 32) .animate(onPlay: (e) => e.repeat(reverse: true)) .fade(duration: 500.ms), - Text( - error.toString(), - textAlign: TextAlign.center, - ), + if (!isDense) + Text( + error.toString(), + textAlign: TextAlign.center, + ), ], ), ), diff --git a/lib/widgets/chat/chat_message_input.dart b/lib/widgets/chat/chat_message_input.dart index bab789c..64f3d3b 100644 --- a/lib/widgets/chat/chat_message_input.dart +++ b/lib/widgets/chat/chat_message_input.dart @@ -415,6 +415,7 @@ class _ChatMessageInputState extends State { x.imageUrl, width: 28, height: 28, + isDense: true, ), display: x.name, content: x.textWarpedPlaceholder,