flutter_html icon indicating copy to clipboard operation
flutter_html copied to clipboard

[BUG] can't change text decoration color anymore

Open eEQK opened this issue 2 years ago • 6 comments

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

eEQK avatar Aug 18 '23 12:08 eEQK

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

eEQK avatar Aug 22 '23 07:08 eEQK

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

eEQK avatar Aug 31 '23 15:08 eEQK

same question

bytebubbles avatar May 21 '24 05:05 bytebubbles

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.

robzimpulse avatar Jun 12 '24 02:06 robzimpulse

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.

LoadJulz avatar Jul 02 '24 13:07 LoadJulz

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.

  1. 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
  1. 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!

LoadJulz avatar Jul 15 '24 09:07 LoadJulz