When adding a custom url tag I had to force it a little to get correct link style and alignment with the rest of the text.
- I had to provide modified default style in
tagStyles
MarkupTagStyle.delegate(
tagName: 'a',
styleCreator: (_) => style.copyWith( // Here I needed a copy the `style` because the `DefaultTextStyle` provided above wasn't used for the link span
fontWeight: FontWeight.bold,
color: linkColor ?? colors.primary,
),
),
I would expect to just need to provide empty text style with the desired properties as is the case for bold tag
MarkupTagStyle.delegate(
tagName: 'b',
styleCreator: (_) => const TextStyle(fontWeight: FontWeight.bold),
),
- I had to add some arguments in
WidgetSpan to get proper alignment of the link text. I don't know if we can fix this in the package, maybe we just should include this in the readme/example.
'a': (child, parameter) {
return WidgetSpan(
baseline: TextBaseline.alphabetic, // here
alignment: PlaceholderAlignment.baseline, // and here
child: GestureDetector(
onTap: () async {
if (parameter != null) {
await alxLaunchUrl(url: parameter);
}
},
child: child,
),
);
},
When adding a custom url tag I had to force it a little to get correct link style and alignment with the rest of the text.
tagStylesI would expect to just need to provide empty text style with the desired properties as is the case for bold tag
WidgetSpanto get proper alignment of the link text. I don't know if we can fix this in the package, maybe we just should include this in the readme/example.