@@ -24,6 +24,7 @@ typedef OnPillTap = void Function(String identifier);
24
24
typedef GetMxcUrl = String Function (String mxc, double ? width, double ? height,
25
25
{bool ? animated});
26
26
typedef GetPillInfo = Future <Map <String , dynamic >> Function (String identifier);
27
+ typedef PillBuilder = Widget ? Function (String identifier, String url, OnPillTap ? onTap, GetMxcUrl ? getMxcUrl);
27
28
28
29
const OFFSET_TAGS_FONT_SIZE_FACTOR =
29
30
0.7 ; //The ratio of the parent font for each of the offset tags: sup or sub
@@ -105,6 +106,7 @@ class TextParser extends StatelessWidget {
105
106
this .setCodeLanguage,
106
107
this .getCodeLanguage,
107
108
this .inlineSpanEnd,
109
+ this .pillBuilder,
108
110
});
109
111
110
112
final double indentSize = 10.0 ;
@@ -127,6 +129,7 @@ class TextParser extends StatelessWidget {
127
129
final SetCodeLanguage ? setCodeLanguage;
128
130
final GetCodeLanguage ? getCodeLanguage;
129
131
final InlineSpan ? inlineSpanEnd;
132
+ final PillBuilder ? pillBuilder;
130
133
131
134
TextSpan _parseTextNode (
132
135
BuildContext context, ParseContext parseContext, dom.Text node) {
@@ -449,7 +452,7 @@ class TextParser extends StatelessWidget {
449
452
if (isPill) {
450
453
return WidgetSpan (
451
454
alignment: PlaceholderAlignment .middle,
452
- child: Pill (
455
+ child: pillBuilder ? . call (identifier, url, onPillTap, getMxcUrl) ?? Pill (
453
456
identifier: identifier,
454
457
url: url,
455
458
future: getPillInfo? .call (url),
0 commit comments