TextStyle textStyle = TextStyle(
color: prefix0.orangeColor,
fontFamily: 'Roboto-Regular',
fontSize: ScreenUtil().setSp(45.0));
Map<String, HighlightedWord> words = Map();
widget.message.messageActionsModel.mentions.mentions?.forEach((user) {
words["@all"] =
HighlightedWord(onTap: () {}, textStyle: textStyle);
});
HighlightMap highlightMap = HighlightMap(words);
return TextHighlight(
text: widget.message.messageActionsModel.msg,
// You need to pass the string you want the highlights
words: highlightMap.getMap,
// Your dictionary words
textStyle: TextStyle(
color: widget.isOwner ? prefix0.white : prefix0.blackColor333,
fontFamily: 'Roboto-Regular',
fontSize: ScreenUtil().setSp(45.0)),
textAlign:
TextAlign.start, // You can use any attribute of the RichText widget
);
=> It's working fine.
But if i use:
TextStyle textStyle = TextStyle(
color: prefix0.orangeColor,
fontFamily: 'Roboto-Regular',
fontSize: ScreenUtil().setSp(45.0));
Map<String, HighlightedWord> words = Map();
widget.message.messageActionsModel.mentions.mentions?.forEach((user) {
words["Nguyễn Hữu Bình"] =
HighlightedWord(onTap: () {}, textStyle: textStyle);
});
HighlightMap highlightMap = HighlightMap(words);
return TextHighlight(
text: widget.message.messageActionsModel.msg,
// You need to pass the string you want the highlights
words: highlightMap.getMap,
// Your dictionary words
textStyle: TextStyle(
color: widget.isOwner ? prefix0.white : prefix0.blackColor333,
fontFamily: 'Roboto-Regular',
fontSize: ScreenUtil().setSp(45.0)),
textAlign:
TextAlign.start, // You can use any attribute of the RichText widget
);
I tried:
=> It's working fine. But if i use:
=> It's not working for me. Flutter doctor -v: