2000calories / flutter_easy_rich_text

The EasyRichText widget provides an easy way to use RichText.
https://pub.dev/packages/easy_rich_text
MIT License
80 stars 33 forks source link

无法匹配数字 #8

Closed Faith-zq closed 3 years ago

2000calories commented 4 years ago

Screenshot_1604227041-1 可以提供细节吗?我测试是可以的。

  EasyRichText("This is a test number 1", patternList: [
    EasyRichTextPattern(
      targetString: "1",
      style: TextStyle(color: Colors.blue),
    ),
  ]),
CivelXu commented 4 years ago

EasyRichText("哈哈60s未操作", patternList: [ EasyRichTextPattern( targetString: "60", style: TextStyle(color: Colors.blue), ), ]),

试一下

2000calories commented 3 years ago

加上matchWordBoundaries: false, 默认是为英文设计的,会有word boundary,目标词是数字或字母但左右文本是中文的话,需要这样设置。

EasyRichText("哈哈60s未操作", patternList: [
  EasyRichTextPattern(
    targetString: "60",
    matchWordBoundaries: false,
    style: TextStyle(color: Colors.blue),
  ),
]),
2000calories commented 3 years ago

Hi CivelXu, I will close this issue if you have no more feedback. You can re-open it anytime if you still have problem