Skip to content

Commit 31808e9

Browse files
committed
Fix LinkExpander
1 parent 9a0924b commit 31808e9

File tree

1 file changed

+15
-9
lines changed

1 file changed

+15
-9
lines changed

lib/src/widgets/html/link_expander.dart

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
// ignore_for_file: deprecated_member_use
2+
13
part of '../html.dart';
24

35
const kLinkExpanderSquareThumbnailSize = 120.0;
@@ -45,8 +47,11 @@ class LinkExpander {
4547
break;
4648
case 'span':
4749
if (e.classes.contains('host')) {
48-
childMeta.tsb.enqueue((p, dynamic _) =>
49-
p.copyWith(style: p.style.copyWith(color: Colors.grey)));
50+
childMeta.tsb.enqueue(
51+
(p, dynamic _) =>
52+
p.copyWith(style: p.style.copyWith(color: Colors.grey)),
53+
null,
54+
);
5055
}
5156
break;
5257
}
@@ -68,9 +73,10 @@ class LinkExpander {
6873
final a = meta.element.attributes;
6974
final fullUrl = wf.urlFull(a['href'] ?? '');
7075
final onTap = fullUrl != null ? wf.gestureTapCallback(fullUrl) : null;
76+
final recognizer = wf.buildGestureRecognizer(meta, onTap: onTap);
7177

72-
return WidgetPlaceholder<LinkExpander>(this)
73-
..wrapWith((context, previous) {
78+
return WidgetPlaceholder(
79+
builder: (context, previous) {
7480
final decoBox =
7581
wf.buildDecoration(meta, child, color: Theme.of(context).cardColor);
7682
if (decoBox == null) return previous;
@@ -84,12 +90,13 @@ class LinkExpander {
8490
);
8591
}
8692

87-
if (onTap != null) {
88-
built = wf.buildGestureDetector(meta, built, onTap) ?? built;
93+
if (recognizer != null) {
94+
built = wf.buildGestureDetector(meta, built, recognizer) ?? built;
8995
}
9096

9197
return built;
92-
});
98+
},
99+
);
93100
}
94101

95102
Widget _buildSquare(Widget left, Widget right) => _buildBox(
@@ -196,8 +203,7 @@ class _LinkExpanderInfo {
196203
Iterable<Widget> onWidgets(
197204
BuildMetadata _, Iterable<WidgetPlaceholder> widgets) {
198205
final scopedDescription = _description;
199-
final widget = le._info = WidgetPlaceholder<_LinkExpanderInfo>(
200-
this,
206+
final widget = le._info = WidgetPlaceholder(
201207
child: Padding(
202208
padding: const EdgeInsets.symmetric(vertical: kPostBodyPadding),
203209
child: LayoutBuilder(

0 commit comments

Comments
 (0)