Skip to content

Commit

Permalink
Fix PostRow floating attachments ignorePointer
Browse files Browse the repository at this point in the history
  • Loading branch information
moffatman committed May 21, 2023
1 parent e4e1ec9 commit 396178a
Showing 1 changed file with 61 additions and 61 deletions.
122 changes: 61 additions & 61 deletions lib/widgets/post_row.dart
Original file line number Diff line number Diff line change
Expand Up @@ -205,71 +205,70 @@ class PostRow extends StatelessWidget {
postId: latestPost.id,
builder: (ctx) => Padding(
padding: const EdgeInsets.only(top: 8, left: 8, right: 8),
child: IgnorePointer(
ignoring: !allowTappingLinks,
child: ConditionalOnTapUp(
condition: (d) => ctx.read<PostSpanZoneData>().canTap(d.position),
onTapUp: (d) {
if (!ctx.read<PostSpanZoneData>().onTap(d.globalPosition)) {
onTap?.call();
}
},
child: Text.rich(
TextSpan(
children: [
if (attachments != null) WidgetSpan(
child: attachments,
floating: settings.imagesOnRight ? PlaceholderFloating.right : PlaceholderFloating.left,
alignment: PlaceholderAlignment.middle
),
if ((!parentZone.tree || (post.parentId != latestPost.threadId && (baseOptions?.highlightString?.isNotEmpty ?? false))) && !site.explicitIds && post.parentId != null) ...[
PostQuoteLinkSpan(
board: latestPost.board,
threadId: latestPost.threadId,
postId: latestPost.parentId!,
dead: false
).build(
ctx, ctx.watch<PostSpanZoneData>(), settings, (baseOptions ?? PostSpanRenderOptions()).copyWith(
shrinkWrap: shrinkWrap
)
),
const TextSpan(text: '\n'),
],
(translatedPostSnapshot?.data ?? latestPost).span.build(
ctx, ctx.watch<PostSpanZoneData>(), settings,
(baseOptions ?? PostSpanRenderOptions()).copyWith(
showCrossThreadLabel: showCrossThreadLabel,
child: ConditionalOnTapUp(
condition: (d) => allowTappingLinks && ctx.read<PostSpanZoneData>().canTap(d.position),
onTapUp: (d) {
if (!ctx.read<PostSpanZoneData>().onTap(d.globalPosition)) {
onTap?.call();
}
},
child: Text.rich(
TextSpan(
children: [
if (attachments != null) WidgetSpan(
child: attachments,
floating: settings.imagesOnRight ? PlaceholderFloating.right : PlaceholderFloating.left,
alignment: PlaceholderAlignment.middle
),
if ((!parentZone.tree || (post.parentId != latestPost.threadId && (baseOptions?.highlightString?.isNotEmpty ?? false))) && !site.explicitIds && post.parentId != null) ...[
PostQuoteLinkSpan(
board: latestPost.board,
threadId: latestPost.threadId,
postId: latestPost.parentId!,
dead: false
).build(
ctx, ctx.watch<PostSpanZoneData>(), settings, (baseOptions ?? PostSpanRenderOptions()).copyWith(
shrinkWrap: shrinkWrap,
postInject: overrideReplyCount != null ? WidgetSpan(
alignment: PlaceholderAlignment.top,
child: Visibility(
visible: false,
maintainSize: true,
maintainAnimation: true,
maintainState: true,
child: Padding(
padding: const EdgeInsets.only(left: 8, right: 8),
child: overrideReplyCount!
)
)
) : (replyIds.isEmpty ? null : WidgetSpan(
child: Text(
List.filled(replyIds.length.toString().length + 4, '1').join(),
style: const TextStyle(color: Colors.transparent)
),
floating: PlaceholderFloating.right
))
ignorePointer: !allowTappingLinks
)
),
const TextSpan(text: '\n'),
// In practice this is the height of a line of text
const WidgetSpan(
child: SizedBox.shrink()
],
(translatedPostSnapshot?.data ?? latestPost).span.build(
ctx, ctx.watch<PostSpanZoneData>(), settings,
(baseOptions ?? PostSpanRenderOptions()).copyWith(
showCrossThreadLabel: showCrossThreadLabel,
shrinkWrap: shrinkWrap,
ignorePointer: !allowTappingLinks,
postInject: overrideReplyCount != null ? WidgetSpan(
alignment: PlaceholderAlignment.top,
child: Visibility(
visible: false,
maintainSize: true,
maintainAnimation: true,
maintainState: true,
child: Padding(
padding: const EdgeInsets.only(left: 8, right: 8),
child: overrideReplyCount!
)
)
) : (replyIds.isEmpty ? null : WidgetSpan(
child: Text(
List.filled(replyIds.length.toString().length + 4, '1').join(),
style: const TextStyle(color: Colors.transparent)
),
floating: PlaceholderFloating.right
))
)
]
),
overflow: TextOverflow.fade
)
),
const TextSpan(text: '\n'),
// In practice this is the height of a line of text
const WidgetSpan(
child: SizedBox.shrink()
)
]
),
overflow: TextOverflow.fade
)
)
)
Expand Down Expand Up @@ -340,7 +339,8 @@ class PostRow extends StatelessWidget {
).build(ctx, ctx.watch<PostSpanZoneData>(), settings, (baseOptions ?? PostSpanRenderOptions()).copyWith(
showCrossThreadLabel: showCrossThreadLabel,
addExpandingPosts: false,
shrinkWrap: shrinkWrap
shrinkWrap: shrinkWrap,
ignorePointer: !allowTappingLinks
))),
...replyIds.map((id) => WidgetSpan(
child: ExpandingPost(id: id),
Expand Down

0 comments on commit 396178a

Please sign in to comment.