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

When we us special characters in EasyRichText as Target String like ~|[]{}#%^*+=_|<>$£€•.,?!’ it crashes & fires exception. #7

Closed
nirajjoshi opened this issue Oct 8, 2020 · 4 comments
Labels
special character special character like \[]()^*+?

Comments

@nirajjoshi
Copy link

nirajjoshi commented Oct 8, 2020

@2000calories :

When we us special characters in EasyRichText as Target String like ~|[]{}#%^*+=_|<>$£€•.,?!’ it crashes & fires below mentioned exception.
Please refer screenshot from your example app only.

///GestureRecognizer, not working when superscript, subscript, or urlType is set.
              ///TapGestureRecognizer, MultiTapGestureRecognizer, etc.
              EasyRichText(
                "Tap recognizer to print this sentence.~|[]{}#%^*+=_\|<>\$£€•.,?!’",
                patternList: [
                  EasyRichTextPattern(
                    targetString: '~|[]{}#%^*+=_\|<>\$£€•.,?!’',
                    recognizer: TapGestureRecognizer()
                      ..onTap = () {
                        print("Tap recognizer to print this sentence.");
                      },
                    style: TextStyle(
                      decoration: TextDecoration.underline,
                    ),
                  ),
                ],
              ),

════════ Exception caught by widgets library ═══════════════════════════════════
The following FormatException was thrown building EasyRichText(dirty, dependencies: [DefaultTextStyle]):
Lone quantifier brackets((?<!\w)~|[]{}#%^*+=_|<>$£€•.,?!’(?!\w))

Screenshot 2020-10-08 at 3 29 20 PM

@2000calories
Copy link
Owner

2000calories commented Oct 10, 2020

try master branch and set hasSpecialCharacters: true

EasyRichText(
  "Tap recognizer to print this sentence. ~|[]{}#%^*+=_\|<>\$£€•.,?!’",
  patternList: [
    EasyRichTextPattern(
      targetString: '~|[]{}#%^*+=_|<>\$£€•.,?',
      hasSpecialCharacters: true,
      recognizer: TapGestureRecognizer()
        ..onTap = () {
          print("Tap recognizer to print this sentence.");
        },
      style: TextStyle(
        decoration: TextDecoration.underline,
      ),
    ),
  ],
),
  easy_rich_text:
    git:
      url: https://github.com/2000calories/flutter_easy_rich_text.git
      ref: master

@2000calories 2000calories added the special character special character like \[]()^*+? label Oct 10, 2020
@nirajjoshi
Copy link
Author

try master branch and set hasSpecialCharacters: true

EasyRichText(
  "Tap recognizer to print this sentence. ~|[]{}#%^*+=_\|<>\$£€•.,?!’",
  patternList: [
    EasyRichTextPattern(
      targetString: '~|[]{}#%^*+=_|<>\$£€•.,?',
      hasSpecialCharacters: true,
      recognizer: TapGestureRecognizer()
        ..onTap = () {
          print("Tap recognizer to print this sentence.");
        },
      style: TextStyle(
        decoration: TextDecoration.underline,
      ),
    ),
  ],
),
  easy_rich_text:
    git:
      url: https://github.com/2000calories/flutter_easy_rich_text.git
      ref: master

Thanks @2000calories . It worked.
Please update pub version with this fix at https://pub.dev/packages/easy_rich_text as well.

@2000calories
Copy link
Owner

updated

@nirajjoshi
Copy link
Author

updated

Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
special character special character like \[]()^*+?
Projects
None yet
Development

No branches or pull requests

2 participants