Skip to content

Commit

Permalink
UI fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
CTalvio committed Jul 22, 2023
1 parent f6de722 commit 2c34150
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 25 deletions.
2 changes: 1 addition & 1 deletion lib/community/widgets/community_sidebar.dart
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ class _CommunitySidebarState extends State<CommunitySidebar> with TickerProvider
child: widget.subscribedType != SubscribedType.subscribed
? Padding(
padding: EdgeInsets.only(
top: isBlocked ? 10 : 8,
top: isBlocked ? 10 : 4,
left: 12,
right: 12,
bottom: 4,
Expand Down
49 changes: 33 additions & 16 deletions lib/community/widgets/post_card_metadata.dart
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,8 @@ class PostCommunityAndAuthor extends StatelessWidget {

@override
Widget build(BuildContext context) {
final theme = Theme.of(context);

return BlocBuilder<ThunderBloc, ThunderState>(builder: (context, state) {
final String? creatorName = postView.creator.displayName != null && state.useDisplayNames ? postView.creator.displayName : postView.creator.name;

Expand All @@ -231,23 +233,38 @@ class PostCommunityAndAuthor extends StatelessWidget {
onTap: () => onTapCommunityName(context, postView.community.id),
),
Expanded(
child: Wrap(
direction: Axis.horizontal,
alignment: WrapAlignment.start,
crossAxisAlignment: WrapCrossAlignment.end,
spacing: 1.0,
children: [
if (state.showPostAuthor)
GestureDetector(
child: Text('$creatorName to ', textScaleFactor: state.contentFontSizeScale.textScaleFactor, style: textStyleAuthor), onTap: () => onTapUserName(context, postView.creator.id)),
GestureDetector(
child: Text(
'${postView.community.name}${showInstanceName ? ' · ${fetchInstanceNameFromUrl(postView.community.actorId)}' : ''}',
textScaleFactor: state.contentFontSizeScale.textScaleFactor,
style: textStyleCommunity,
child: Padding(
padding: const EdgeInsets.only(right: 6.0),
child: Wrap(
direction: Axis.horizontal,
alignment: WrapAlignment.start,
crossAxisAlignment: WrapCrossAlignment.end,
spacing: 0.0,
children: [
if (state.showPostAuthor)
Row(
mainAxisSize: MainAxisSize.min,
children: [
GestureDetector(
child: Text('$creatorName', textScaleFactor: state.contentFontSizeScale.textScaleFactor, style: textStyleAuthor), onTap: () => onTapUserName(context, postView.creator.id)),
Text(
' to ',
textScaleFactor: state.contentFontSizeScale.textScaleFactor,
style: theme.textTheme.bodyMedium?.copyWith(
color: theme.textTheme.bodyMedium?.color?.withOpacity(0.4),
),
),
],
),
onTap: () => onTapCommunityName(context, postView.community.id)),
],
GestureDetector(
child: Text(
'${postView.community.name}${showInstanceName ? ' · ${fetchInstanceNameFromUrl(postView.community.actorId)}' : ''}',
textScaleFactor: state.contentFontSizeScale.textScaleFactor,
style: textStyleCommunity,
),
onTap: () => onTapCommunityName(context, postView.community.id)),
],
),
),
),
],
Expand Down
17 changes: 9 additions & 8 deletions lib/community/widgets/post_card_view_comfortable.dart
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,9 @@ class PostCardViewComfortable extends StatelessWidget {
final ThunderState state = context.read<ThunderBloc>().state;

final String textContent = postViewMedia.postView.post.body ?? "";
final TextStyle? textStyleCommunityAndAuthor = theme.textTheme.bodyMedium?.copyWith(
color: postViewMedia.postView.read ? theme.textTheme.bodyMedium?.color?.withOpacity(0.4) : theme.textTheme.bodyMedium?.color?.withOpacity(0.75),
);

var mediaView = MediaView(
showLinkPreview: state.showLinkPreviews,
Expand Down Expand Up @@ -124,14 +127,12 @@ class PostCardViewComfortable extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.start,
children: [
PostCommunityAndAuthor(
showCommunityIcons: showCommunityIcons,
showInstanceName: showInstanceName,
postView: postViewMedia.postView,
textStyleAuthor: theme.textTheme.bodyMedium?.copyWith(color: theme.textTheme.bodyMedium?.color?.withOpacity(0.4)),
textStyleCommunity: theme.textTheme.titleSmall?.copyWith(
fontSize: theme.textTheme.titleSmall!.fontSize! * 1.05,
color: postViewMedia.postView.read ? theme.textTheme.titleSmall?.color?.withOpacity(0.4) : theme.textTheme.titleSmall?.color?.withOpacity(0.75),
)),
showCommunityIcons: false,
showInstanceName: showInstanceName,
postView: postViewMedia.postView,
textStyleCommunity: textStyleCommunityAndAuthor,
textStyleAuthor: textStyleCommunityAndAuthor,
),
const SizedBox(height: 8.0),
PostCardMetaData(
score: postViewMedia.postView.counts.score,
Expand Down

0 comments on commit 2c34150

Please sign in to comment.