leancodepl / leancodepl/flutter_corelibrary
[leancode_markup] Default text style is lost with `tagFactory`
Open
@pdenert is already working on this.
Since Jun 21, 2024.
p: leancode_markup
- Dominant language
- Dart
- Stars
- 89
- Forks
- 12
- Avg merge
- 2d 7h
- Merged PRs (30d)
- 2
Description
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
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.
'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,
),
);
},
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.