rich_text_widget 0.1.7 copy "rich_text_widget: ^0.1.7" to clipboard
rich_text_widget: ^0.1.7 copied to clipboard

outdated

该库属于富文本组件,补充了Flutter富文本只能拼接组件的功能,该库应用于国际化文本非常便利,不用拆分字符串.

富文本是很多App都需要的,而且Flutter也提供了富文本功能,但是对于做多语言的APP来说,RichText并不好用,或者说不能用, 今天就给大家推荐一个第三方库 rich_text_widget

使用起来简单又方便,不用分割字符串 具体使用方法参考如下

RichTextWidget(
      // default Text
      Text(
        'You have pushed the button this many times:',
        style: TextStyle(color: Colors.black),
      ),
      // rich text list
      richTexts: [
        BaseRichText(
          "pushed",
          style: TextStyle(color: Colors.yellow),
          onTap: () => {print("touch pushed")},
        ),
        BaseRichText(
          "button",
          style: TextStyle(color: Colors.red),
          onTap: () => {print("touch button")},
        ),
      ],
    )

展示效果如下 Simulator Screen Shot - iPhone 11 Pro - 2020-08-10 at 10.52.06.png

参数说明

RichTextWidget:

Name type
defaultText Text
richTexts List <BaseRichText>

BaseRichText:

Name type
data String
style TextStyle
onTap Function
5
likes
0
pub points
83%
popularity

Publisher

unverified uploader

该库属于富文本组件,补充了Flutter富文本只能拼接组件的功能,该库应用于国际化文本非常便利,不用拆分字符串.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

flutter

More

Packages that depend on rich_text_widget