🐛 Bug fixes on attachments and related things

This commit is contained in:
LittleSheep 2024-09-17 20:59:01 +08:00
parent 358677ade0
commit dec34e297d
3 changed files with 17 additions and 10 deletions

View File

@ -233,6 +233,7 @@ class _AttachmentItemVideoState extends State<_AttachmentItemVideo> {
final ratio = widget.item.metadata?['ratio'] ?? 16 / 9; final ratio = widget.item.metadata?['ratio'] ?? 16 / 9;
if (!_showContent) { if (!_showContent) {
return GestureDetector( return GestureDetector(
behavior: HitTestBehavior.opaque,
child: Stack( child: Stack(
children: [ children: [
if (widget.item.metadata?['thumbnail'] != null) if (widget.item.metadata?['thumbnail'] != null)
@ -400,6 +401,7 @@ class _AttachmentItemAudioState extends State<_AttachmentItemAudio> {
const ratio = 16 / 9; const ratio = 16 / 9;
if (!_showContent) { if (!_showContent) {
return GestureDetector( return GestureDetector(
behavior: HitTestBehavior.opaque,
child: Stack( child: Stack(
children: [ children: [
if (widget.item.metadata?['thumbnail'] != null) if (widget.item.metadata?['thumbnail'] != null)

View File

@ -10,6 +10,7 @@ class AutoCacheImage extends StatelessWidget {
final BoxFit? fit; final BoxFit? fit;
final bool noProgressIndicator; final bool noProgressIndicator;
final bool noErrorWidget; final bool noErrorWidget;
final bool isDense;
const AutoCacheImage( const AutoCacheImage(
this.url, { this.url, {
@ -19,6 +20,7 @@ class AutoCacheImage extends StatelessWidget {
this.fit, this.fit,
this.noProgressIndicator = false, this.noProgressIndicator = false,
this.noErrorWidget = false, this.noErrorWidget = false,
this.isDense = false,
}); });
@override @override
@ -46,13 +48,14 @@ class AutoCacheImage extends StatelessWidget {
child: Column( child: Column(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
children: [ children: [
const Icon(Icons.close, size: 32) Icon(Icons.close, size: isDense ? 24 : 32)
.animate(onPlay: (e) => e.repeat(reverse: true)) .animate(onPlay: (e) => e.repeat(reverse: true))
.fade(duration: 500.ms), .fade(duration: 500.ms),
Text( if (!isDense)
error.toString(), Text(
textAlign: TextAlign.center, error.toString(),
), textAlign: TextAlign.center,
),
], ],
), ),
), ),
@ -89,13 +92,14 @@ class AutoCacheImage extends StatelessWidget {
child: Column( child: Column(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
children: [ children: [
const Icon(Icons.close, size: 32) Icon(Icons.close, size: isDense ? 24 : 32)
.animate(onPlay: (e) => e.repeat(reverse: true)) .animate(onPlay: (e) => e.repeat(reverse: true))
.fade(duration: 500.ms), .fade(duration: 500.ms),
Text( if (!isDense)
error.toString(), Text(
textAlign: TextAlign.center, error.toString(),
), textAlign: TextAlign.center,
),
], ],
), ),
), ),

View File

@ -415,6 +415,7 @@ class _ChatMessageInputState extends State<ChatMessageInput> {
x.imageUrl, x.imageUrl,
width: 28, width: 28,
height: 28, height: 28,
isDense: true,
), ),
display: x.name, display: x.name,
content: x.textWarpedPlaceholder, content: x.textWarpedPlaceholder,