roughMessageSize method
Returns an approximation of message size
Implementation
double roughMessageSize(double? fontSize) {
var messageTextLength = min(text?.biggestLine().length ?? 0, 65);
if (quotedMessage != null) {
var quotedMessageLength =
(min(quotedMessage!.text?.biggestLine().length ?? 0, 65)) + 8;
if (quotedMessage!.attachments.isNotEmpty) {
quotedMessageLength += 8;
}
if (quotedMessageLength > messageTextLength * 1.2) {
messageTextLength = quotedMessageLength;
}
}
// Quoted message have a smaller font, so it is necessary to reduce the
// size of the multiplier to count for the smaller font.
var multiplier = 0.55;
if (quotedMessage != null) {
multiplier = 0.45;
}
return messageTextLength * (fontSize ?? 1) * multiplier;
}