Closed Erfa closed 4 years ago
This is due to DefaultTextStyle
not overriding body1
.
Doing this does fix it:
Theme(
data: ThemeData(
textTheme: TextTheme(
body1: TextStyle(decoration: TextDecoration.lineThrough),
),
),
child: Linkify(
text: 'Testing https://github.com',
),
)
Doing does the same but is much simpler:
Linkify(
text: 'Testing https://github.com',
style: TextStyle(decoration: TextDecoration.lineThrough),
)
To change the link to also have lineThrough
, pass it in the linkStyle
:
Linkify(
text: 'Testing https://github.com',
style: TextStyle(decoration: TextDecoration.lineThrough),
linkStyle: TextStyle(
decoration: TextDecoration.combine(
[TextDecoration.lineThrough, TextDecoration.underline],
),
),
)
I noticed that if you have a TextStyle as a parent Widget to Linkify, that styling is overriden by whatever style you set in Linkify.
Here's an example:
This will correctly identify the link, but it will lose the
TextDecoration.lineThrough
defined by the parent. Seems like the desired behavior would be to merge them? I'm fairly new to Flutter so I'm not sure if it's possible.