From 2ea7c2e3b261f11583c281b49ce087276231c489 Mon Sep 17 00:00:00 2001 From: Hamlet Jiang Su Date: Mon, 25 Nov 2024 16:53:15 -0800 Subject: [PATCH 1/2] feat: add url to condensed post view --- lib/post/widgets/post_view.dart | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/lib/post/widgets/post_view.dart b/lib/post/widgets/post_view.dart index eae132ea2..0760991c5 100644 --- a/lib/post/widgets/post_view.dart +++ b/lib/post/widgets/post_view.dart @@ -143,10 +143,22 @@ class _PostSubviewState extends State with SingleTickerProviderStat if (thunderState.postBodyViewType == PostBodyViewType.condensed && !thunderState.showThumbnailPreviewOnRight && postViewMedia.media.first.mediaType != MediaType.text) _getMediaPreview(thunderState, hideNsfwPreviews, markPostReadOnMediaView, isUserLoggedIn), Expanded( - child: ScalableText( - HtmlUnescape().convert(post.name), - fontScale: thunderState.titleFontSizeScale, - style: theme.textTheme.titleMedium, + child: Column( + mainAxisSize: MainAxisSize.min, + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + ScalableText( + HtmlUnescape().convert(post.name), + fontScale: thunderState.titleFontSizeScale, + style: theme.textTheme.titleMedium, + ), + if (postViewMedia.media.first.mediaType == MediaType.link && thunderState.postBodyViewType == PostBodyViewType.condensed) + Text( + Uri.tryParse(post.url ?? '')?.host ?? '', + style: theme.textTheme.bodyMedium?.copyWith(color: theme.colorScheme.onSurface.withOpacity(0.6)), + ) + ], ), ), if (thunderState.postBodyViewType == PostBodyViewType.condensed && thunderState.showThumbnailPreviewOnRight && postViewMedia.media.first.mediaType != MediaType.text) From 4ec561fcb9dfb74e9c3f994183a10bc2451247b5 Mon Sep 17 00:00:00 2001 From: Hamlet Jiang Su Date: Tue, 26 Nov 2024 19:27:07 -0800 Subject: [PATCH 2/2] feat: remove www from host in URL --- lib/post/widgets/post_view.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/post/widgets/post_view.dart b/lib/post/widgets/post_view.dart index 0760991c5..e502362d7 100644 --- a/lib/post/widgets/post_view.dart +++ b/lib/post/widgets/post_view.dart @@ -155,7 +155,7 @@ class _PostSubviewState extends State with SingleTickerProviderStat ), if (postViewMedia.media.first.mediaType == MediaType.link && thunderState.postBodyViewType == PostBodyViewType.condensed) Text( - Uri.tryParse(post.url ?? '')?.host ?? '', + Uri.tryParse(post.url ?? '')?.host.replaceFirst('www.', '') ?? '', style: theme.textTheme.bodyMedium?.copyWith(color: theme.colorScheme.onSurface.withOpacity(0.6)), ) ],