fix: add some spacing between the post author and it's title

This commit is contained in:
Bart Ribbers 2025-04-22 11:14:20 +02:00
parent 13ba6ada07
commit 5abc859c24
2 changed files with 35 additions and 38 deletions

View file

@ -1,3 +1,7 @@
## Next
- Add minimal spacing between a post author and title in the post widget
## 5.1.1 ## 5.1.1
- Be honest about which Dart and Flutter versions we support - Be honest about which Dart and Flutter versions we support

View file

@ -97,7 +97,7 @@ class _TimelinePostWidgetState extends State<TimelinePostWidget> {
), ),
), ),
], ],
const SizedBox(width: 10), const SizedBox(width: 10.0),
Text( Text(
widget.options.nameBuilder?.call(widget.post.creator) ?? widget.options.nameBuilder?.call(widget.post.creator) ??
widget.post.creator?.fullName ?? widget.post.creator?.fullName ??
@ -137,7 +137,7 @@ class _TimelinePostWidgetState extends State<TimelinePostWidget> {
.options.theme.textStyles.deletePostStyle ?? .options.theme.textStyles.deletePostStyle ??
theme.textTheme.bodyMedium, theme.textTheme.bodyMedium,
), ),
const SizedBox(width: 8), const SizedBox(width: 8.0),
widget.options.theme.deleteIcon ?? widget.options.theme.deleteIcon ??
Icon( Icon(
Icons.delete, Icons.delete,
@ -158,7 +158,7 @@ class _TimelinePostWidgetState extends State<TimelinePostWidget> {
), ),
// image of the post // image of the post
if (widget.post.imageUrl != null || widget.post.image != null) ...[ if (widget.post.imageUrl != null || widget.post.image != null) ...[
const SizedBox(height: 8), const SizedBox(height: 8.0),
Flexible( Flexible(
flex: widget.options.postWidgetHeight != null ? 1 : 0, flex: widget.options.postWidgetHeight != null ? 1 : 0,
child: ClipRRect( child: ClipRRect(
@ -204,9 +204,7 @@ class _TimelinePostWidgetState extends State<TimelinePostWidget> {
), ),
), ),
], ],
const SizedBox( const SizedBox(height: 8.0),
height: 8,
),
// post information // post information
if (widget.options.iconsWithValues) ...[ if (widget.options.iconsWithValues) ...[
Row( Row(
@ -238,14 +236,10 @@ class _TimelinePostWidgetState extends State<TimelinePostWidget> {
size: widget.options.iconSize, size: widget.options.iconSize,
), ),
), ),
const SizedBox( const SizedBox(width: 4.0),
width: 4,
),
Text('${widget.post.likes}'), Text('${widget.post.likes}'),
if (widget.post.reactionEnabled) ...[ if (widget.post.reactionEnabled) ...[
const SizedBox( const SizedBox(width: 8.0),
width: 8,
),
IconButton( IconButton(
padding: EdgeInsets.zero, padding: EdgeInsets.zero,
constraints: const BoxConstraints(), constraints: const BoxConstraints(),
@ -260,9 +254,7 @@ class _TimelinePostWidgetState extends State<TimelinePostWidget> {
height: widget.options.iconSize, height: widget.options.iconSize,
), ),
), ),
const SizedBox( const SizedBox(width: 4.0),
width: 4,
),
Text('${widget.post.reaction}'), Text('${widget.post.reaction}'),
], ],
], ],
@ -286,7 +278,7 @@ class _TimelinePostWidgetState extends State<TimelinePostWidget> {
size: widget.options.iconSize, size: widget.options.iconSize,
), ),
), ),
const SizedBox(width: 8), const SizedBox(width: 8.0),
if (widget.post.reactionEnabled) ...[ if (widget.post.reactionEnabled) ...[
IconButton( IconButton(
padding: EdgeInsets.zero, padding: EdgeInsets.zero,
@ -307,9 +299,7 @@ class _TimelinePostWidgetState extends State<TimelinePostWidget> {
), ),
], ],
const SizedBox( const SizedBox(height: 8),
height: 8,
),
if (widget.options.itemInfoBuilder != null) ...[ if (widget.options.itemInfoBuilder != null) ...[
widget.options.itemInfoBuilder!( widget.options.itemInfoBuilder!(
@ -320,25 +310,27 @@ class _TimelinePostWidgetState extends State<TimelinePostWidget> {
post: widget.post, post: widget.post,
options: widget.options, options: widget.options,
), ),
Text.rich( const SizedBox(height: 4.0),
TextSpan( Row(
text: widget.options.nameBuilder?.call(widget.post.creator) ?? children: [
widget.post.creator?.fullName ?? Text(
widget.options.translations.anonymousUser, widget.options.nameBuilder?.call(widget.post.creator) ??
style: widget.options.theme.textStyles.listCreatorNameStyle ?? widget.post.creator?.fullName ??
theme.textTheme.titleSmall!.copyWith( widget.options.translations.anonymousUser,
color: Colors.black, style: widget.options.theme.textStyles.listCreatorNameStyle ??
), theme.textTheme.titleSmall!.copyWith(
children: [ color: Colors.black,
TextSpan( ),
text: widget.post.title, ),
style: widget.options.theme.textStyles.listPostTitleStyle ?? const SizedBox(width: 4.0),
theme.textTheme.bodySmall, Text(
), widget.post.title,
], style: widget.options.theme.textStyles.listPostTitleStyle ??
), theme.textTheme.bodySmall,
),
],
), ),
const SizedBox(height: 4), const SizedBox(height: 4.0),
InkWell( InkWell(
onTap: widget.onTap, onTap: widget.onTap,
child: Text( child: Text(
@ -350,8 +342,9 @@ class _TimelinePostWidgetState extends State<TimelinePostWidget> {
), ),
), ),
], ],
if (widget.options.dividerBuilder != null) if (widget.options.dividerBuilder != null) ...[
widget.options.dividerBuilder!(), widget.options.dividerBuilder!(),
],
], ],
), ),
); );