🐛 Fix markdown image in chat close #167
This commit is contained in:
@@ -57,11 +57,11 @@ class EmbedLinkWidget extends StatelessWidget {
|
||||
Row(
|
||||
children: [
|
||||
// Favicon
|
||||
if (link.faviconUrl.isNotEmpty) ...[
|
||||
if (link.faviconUrl?.isNotEmpty ?? false) ...[
|
||||
ClipRRect(
|
||||
borderRadius: BorderRadius.circular(4),
|
||||
child: UniversalImage(
|
||||
uri: link.faviconUrl,
|
||||
uri: link.faviconUrl!,
|
||||
width: 16,
|
||||
height: 16,
|
||||
fit: BoxFit.cover,
|
||||
@@ -80,8 +80,8 @@ class EmbedLinkWidget extends StatelessWidget {
|
||||
// Site name
|
||||
Expanded(
|
||||
child: Text(
|
||||
link.siteName.isNotEmpty
|
||||
? link.siteName
|
||||
(link.siteName?.isNotEmpty ?? false)
|
||||
? link.siteName!
|
||||
: Uri.parse(link.url).host,
|
||||
style: theme.textTheme.bodySmall?.copyWith(
|
||||
color: colorScheme.onSurfaceVariant,
|
||||
|
@@ -183,9 +183,15 @@ class MarkdownTextContent extends HookConsumerWidget {
|
||||
);
|
||||
}
|
||||
}
|
||||
final content = ConstrainedBox(
|
||||
constraints: BoxConstraints(maxHeight: 360),
|
||||
child: UniversalImage(uri: uri.toString(), fit: BoxFit.contain),
|
||||
final content = ClipRRect(
|
||||
borderRadius: const BorderRadius.all(Radius.circular(8)),
|
||||
child: ConstrainedBox(
|
||||
constraints: BoxConstraints(maxHeight: 360),
|
||||
child: UniversalImage(
|
||||
uri: uri.toString(),
|
||||
fit: BoxFit.contain,
|
||||
),
|
||||
),
|
||||
);
|
||||
return content;
|
||||
},
|
||||
|
@@ -879,7 +879,8 @@ class _LinkPreview extends ConsumerWidget {
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
// Favicon and image
|
||||
if (embed.imageUrl != null || embed.faviconUrl.isNotEmpty)
|
||||
if (embed.imageUrl != null ||
|
||||
(embed.faviconUrl?.isNotEmpty ?? false))
|
||||
Container(
|
||||
width: 60,
|
||||
height: 60,
|
||||
@@ -899,11 +900,14 @@ class _LinkPreview extends ConsumerWidget {
|
||||
errorBuilder: (context, error, stackTrace) {
|
||||
return _buildFaviconFallback(
|
||||
context,
|
||||
embed.faviconUrl,
|
||||
embed.faviconUrl ?? '',
|
||||
);
|
||||
},
|
||||
)
|
||||
: _buildFaviconFallback(context, embed.faviconUrl),
|
||||
: _buildFaviconFallback(
|
||||
context,
|
||||
embed.faviconUrl ?? '',
|
||||
),
|
||||
),
|
||||
),
|
||||
// Content
|
||||
@@ -912,9 +916,9 @@ class _LinkPreview extends ConsumerWidget {
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
// Site name
|
||||
if (embed.siteName.isNotEmpty)
|
||||
if (embed.siteName?.isNotEmpty ?? false)
|
||||
Text(
|
||||
embed.siteName,
|
||||
embed.siteName!,
|
||||
style: Theme.of(context).textTheme.labelSmall?.copyWith(
|
||||
color: Theme.of(context).colorScheme.primary,
|
||||
),
|
||||
|
Reference in New Issue
Block a user