onlyEmotes property
bool
get
onlyEmotes
Returns if a given event only has emotes, emojis or whitespace as content. If the body contains a reply then it is stripped. This is useful to determine if stand-alone emotes should be displayed bigger.
Implementation
bool get onlyEmotes {
if (isRichMessage) {
// calcUnlocalizedBody strips out the <img /> tags in favor of a :placeholder:
final formattedTextStripped = formattedText.replaceAll(
RegExp(
'<mx-reply>.*</mx-reply>',
caseSensitive: false,
multiLine: false,
dotAll: true,
),
'',
);
return _onlyEmojiEmoteRegex.hasMatch(formattedTextStripped);
} else {
return _onlyEmojiRegex.hasMatch(plaintextBody);
}
}