rich_text_widget 0.2.2 rich_text_widget: ^0.2.2 copied to clipboard
The library is very convenient to apply to internationalized text without splitting strings.
README of English #
富文本是很多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")},
),
],
)
展示效果如下
参数说明
RichTextWidget:
Name | type |
---|---|
defaultText | Text |
richTexts | List <BaseRichText> |
BaseRichText:
Name | type |
---|---|
data | String |
style | TextStyle |
onTap | Function |