Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] can't change text decoration color anymore #1361

Open
eEQK opened this issue Aug 18, 2023 · 6 comments
Open

[BUG] can't change text decoration color anymore #1361

eEQK opened this issue Aug 18, 2023 · 6 comments
Labels
bug Something isn't working

Comments

@eEQK
Copy link

eEQK commented Aug 18, 2023

Similarly to my last comment here: #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 eEQK added the bug Something isn't working label Aug 18, 2023
@eEQK
Copy link
Author

eEQK commented Aug 22, 2023

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
Copy link
Author

eEQK commented Aug 31, 2023

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

@bytebubbles
Copy link

same question

@robzimpulse
Copy link

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.

Style copyOnlyInherited(Style child) {
FontSize? finalFontSize = FontSize.inherit(fontSize, child.fontSize);
LineHeight? finalLineHeight = child.lineHeight != null
? child.lineHeight?.units == "length"
? LineHeight(child.lineHeight!.size! /
(finalFontSize == null ? 14 : finalFontSize.value) *
1.2)
: child.lineHeight
: lineHeight;
return child.copyWith(
backgroundColor: child.backgroundColor != Colors.transparent
? child.backgroundColor
: backgroundColor,
color: child.color ?? color,
direction: child.direction ?? direction,
display: display == Display.none ? display : child.display,
fontFamily: child.fontFamily ?? fontFamily,
fontFamilyFallback: child.fontFamilyFallback ?? fontFamilyFallback,
fontFeatureSettings: child.fontFeatureSettings ?? fontFeatureSettings,
fontSize: finalFontSize,
fontStyle: child.fontStyle ?? fontStyle,
fontWeight: child.fontWeight ?? fontWeight,
lineHeight: finalLineHeight,
letterSpacing: child.letterSpacing ?? letterSpacing,
listStyleImage: child.listStyleImage ?? listStyleImage,
listStyleType: child.listStyleType ?? listStyleType,
listStylePosition: child.listStylePosition ?? listStylePosition,
textAlign: child.textAlign ?? textAlign,
textDecoration: TextDecoration.combine([
child.textDecoration ?? TextDecoration.none,
textDecoration ?? TextDecoration.none,
]),
textShadow: child.textShadow ?? textShadow,
whiteSpace: child.whiteSpace ?? whiteSpace,
wordSpacing: child.wordSpacing ?? wordSpacing,
maxLines: child.maxLines ?? maxLines,
textOverflow: child.textOverflow ?? textOverflow,
textTransform: child.textTransform ?? textTransform,
);
}

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.

@LoadJulz
Copy link

LoadJulz commented Jul 2, 2024

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
Copy link

LoadJulz commented Jul 15, 2024

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: Todo
Development

No branches or pull requests

4 participants