flutter_html
flutter_html copied to clipboard
[BUG] can't change text decoration color anymore
Similarly to my last comment here: https://github.com/Sub6Resources/flutter_html/issues/1357
I think I've found a regression in regard to text decoration
After upgrading from alpha6 to beta2 it's not possible to change text decoration color anymore
alpha6:
'a': Style.fromTextStyle(
const TextStyle(
color: AppColors.link,
decorationColor: AppColors.link,
decoration: TextDecoration.underline,
),
),
beta2, code unchanged but also tried using style directly, same result:
'a': Style(
color: AppColors.link,
textDecorationColor: AppColors.link,
textDecoration: TextDecoration.underline,
),
❯ flutter --version
Flutter 3.13.0 • channel stable • https://github.com/flutter/flutter.git
Framework • revision efbf63d9c6 (2 days ago) • 2023-08-15 21:05:06 -0500
Engine • revision 1ac611c64e
Tools • Dart 3.1.0 • DevTools 2.25.0
As a temporary fix, overriding flutter_layout_grid for alpha6 release, although not perfect for sure, does make it runnable with the newest flutter version
dependency_overrides:
flutter_layout_grid: 2.0.4
For whatever setting the decoration color for a tag does not work, and you have to set it via other tags (in my case body works but in other places I had to set h1 - didn't investigate far enough to know what's the rule behind it)
'body': Style(
textDecorationColor: Colors.blue,
),
keeping this open though
same question
this issue also happened on my side when we upgraded flutter version from 3.7.12 to 3.16.9. it might be related to this line of code.
https://github.com/Sub6Resources/flutter_html/blob/46a11b110284f3be59c9c2cc6b0f92fd8cb1da9b/lib/src/style.dart#L369-L410
as you can see when passing style from parent to child, it's missing some parameters such as textDecorationColor, textDecorationStyle, textDecorationThickness
not sure what side effect will occur when adding that parameters.
Is it planned to fix this issue? Downgrading and using a later version of flutter_layout_grid doesn't work anymore with the latest version of flutter.
I have created a fix for this issue with a forked version by enabling the alpha-6 version for the current Flutter version after migrating to Material 3.
- Use the forked flutter_html package of the alpha-6 release, which is compatible with Material 3:
flutter_html:
git:
url: https://github.com/LoadJulz/flutter_html
ref: master
- As @eEQK mentioned, use this dependency override:
dependency_overrides:
flutter_layout_grid: 2.0.4
Now you should be able to see the TextDecorations as before, after you have changed the code so it aligns with alpha-6 again!