rich_text_view 1.0.0-dev-1 rich_text_view: ^1.0.0-dev-1 copied to clipboard
A simple yet powerful rich text view that supports mention, hashtag, emial, url and see more.
rich_text_view #
A simple yet powerful rich text view that supports mention, hashtag, email, url and see more.
Example #
RichTextView as a Text Widget #
RichTextView(
text:
"Who else thinks it's thinks it's just cool to mention @jane when #JaneMustLive is trending without even trying to send a *bold* email to janedoe@gmail.com and verify the facts talkmore of visiting www.janedoe.com",
maxLines: 3,
align: TextAlign.center,
onEmailClicked: (email) => print('$email clicked'),
onHashTagClicked: (hashtag) => print('is $hashtag trending?'),
onMentionClicked: (mention) => print('$mention clicked'),
onUrlClicked: (url) => print('visting $url?'),
style: TextStyle(),
truncate: true,
supportedTypes: [
ParsedType.EMAIL,
ParsedType.HASH,
ParsedType.MENTION,
ParsedType.URL,
ParsedType.BOLD
],
)
RichTextView as a Text Editor #
You can use the RichTextView widget as an input field that supports suggestions when mentioning or using hashtags
RichTextView.editor(
suggestionPosition: SuggestionPosition.bottom,
decoration: InputDecoration(
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(16)),
),
mentionSuggestions: [
Mention(
imageURL: 'imageURL',
subtitle: 'nelly',
title: 'Nelly Gane'),
Mention(
imageURL: 'imageURL',
subtitle: 'gaus',
title: 'Gaus Shell')
],
onSearchMention: (term) async {
return List.generate(
20,
(index) => Mention(
imageURL: 'imageURL',
subtitle: term.toLowerCase(),
title: '$term $index'));
},
onMentionSelected: (suggestion) {
print(suggestion.toString());
},
onSearchTags: (term) async {
return [
HashTag(
hashtag: '#Dart',
subtitle: '30 posts',
trending: true),
HashTag(
hashtag: '#Flutter',
subtitle: '56 posts',
)
];
},
)