Skip to content

Conversation

@kechuan
Copy link

@kechuan kechuan commented Mar 14, 2025

filter unformat HEXColor to prevent FormatException crash.

my Example:

BBCodeText(
          data: 
          "[color=#ffffff]test[/color] \n" 
          "[color=ffffff]test[/color] \n" 
          "[color=33ffffff]test[/color]" //typo
          "[color=RED]test[/color]", //otherReason
          stylesheet: BBStylesheet(
            tags: [PatchColorTag()],
          )
        )
        
 ...
//colorTag
 if(hexColorRegExp.hasMatch(hexColor)){
    debugPrint("match it: $hexColor");
    return oldStyle.copyWith(color: HexColor.fromHex(hexColor));
  }
        

output:
flutter: match it: #ffffff
flutter: match it: ffffff

kechuan added 2 commits March 14, 2025 19:51
filter unformat HEXColor to prevent FormatException crash.
was edited in Web. no attention on it.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant