Fixing some measures
This commit is contained in:
@@ -18,8 +18,12 @@ double calculateReactionsHorizontalAlignmentValue(
|
|||||||
final maxHeight = constraints.maxHeight;
|
final maxHeight = constraints.maxHeight;
|
||||||
|
|
||||||
final roughSentenceSize = message.roughMessageSize(fontSize);
|
final roughSentenceSize = message.roughMessageSize(fontSize);
|
||||||
|
print('roughSentenceSize: $roughSentenceSize');
|
||||||
|
print('maxSize: $maxSize');
|
||||||
final hasAttachments = message.attachments.isNotEmpty;
|
final hasAttachments = message.attachments.isNotEmpty;
|
||||||
final divFactor = hasAttachments
|
final isReply = message.quotedMessageId != null;
|
||||||
|
final isAttachment = hasAttachments && !isReply;
|
||||||
|
final divFactor = isAttachment
|
||||||
? 1
|
? 1
|
||||||
: (roughSentenceSize == 0 ? 1 : (roughSentenceSize / maxSize));
|
: (roughSentenceSize == 0 ? 1 : (roughSentenceSize / maxSize));
|
||||||
|
|
||||||
@@ -31,7 +35,7 @@ double calculateReactionsHorizontalAlignmentValue(
|
|||||||
maxHeight,
|
maxHeight,
|
||||||
shiftFactor,
|
shiftFactor,
|
||||||
divFactor,
|
divFactor,
|
||||||
hasAttachments,
|
isAttachment,
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
return _landScapeAlign(
|
return _landScapeAlign(
|
||||||
@@ -41,7 +45,7 @@ double calculateReactionsHorizontalAlignmentValue(
|
|||||||
maxHeight,
|
maxHeight,
|
||||||
shiftFactor,
|
shiftFactor,
|
||||||
divFactor,
|
divFactor,
|
||||||
hasAttachments,
|
isAttachment,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -53,7 +57,7 @@ double _portraitAlign(
|
|||||||
double maxHeight,
|
double maxHeight,
|
||||||
double shiftFactor,
|
double shiftFactor,
|
||||||
num divFactor,
|
num divFactor,
|
||||||
bool hasAttachments,
|
bool isAttachment,
|
||||||
) {
|
) {
|
||||||
var result = 0.0;
|
var result = 0.0;
|
||||||
|
|
||||||
@@ -63,14 +67,14 @@ double _portraitAlign(
|
|||||||
const constant = 1300;
|
const constant = 1300;
|
||||||
|
|
||||||
if (user?.id == message.user?.id) {
|
if (user?.id == message.user?.id) {
|
||||||
if (divFactor >= 1.0 || hasAttachments) {
|
if (divFactor >= 1.0 || isAttachment) {
|
||||||
result = shiftFactor - maxWidth / constant;
|
result = shiftFactor - maxWidth / constant;
|
||||||
} else {
|
} else {
|
||||||
// Small messages, it is simpler to align then.
|
// Small messages, it is simpler to align then.
|
||||||
result = 1.2 - divFactor;
|
result = 1.2 - divFactor;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (divFactor >= 1.0 || hasAttachments) {
|
if (divFactor >= 1.0 || isAttachment) {
|
||||||
result = shiftFactor + maxWidth / constant;
|
result = shiftFactor + maxWidth / constant;
|
||||||
} else {
|
} else {
|
||||||
result = -(1.2 - divFactor);
|
result = -(1.2 - divFactor);
|
||||||
@@ -87,17 +91,21 @@ double _landScapeAlign(
|
|||||||
double maxHeight,
|
double maxHeight,
|
||||||
double shiftFactor,
|
double shiftFactor,
|
||||||
num divFactor,
|
num divFactor,
|
||||||
bool hasAttachments,
|
bool isAttachment,
|
||||||
) {
|
) {
|
||||||
var result = 0.0;
|
var result = 0.0;
|
||||||
|
|
||||||
|
print('is attachment: $isAttachment');
|
||||||
|
print('shiftFactor: $shiftFactor');
|
||||||
|
print('divFactor: $divFactor');
|
||||||
|
|
||||||
/*
|
/*
|
||||||
This is an empiric value. This number tries to approximate all the
|
This is an empiric value. This number tries to approximate all the
|
||||||
offset necessary for the position of reaction look the best way
|
offset necessary for the position of reaction look the best way
|
||||||
possible.
|
possible.
|
||||||
*/
|
*/
|
||||||
const constant = 3000;
|
const constant = 3000;
|
||||||
if (hasAttachments) {
|
if (isAttachment) {
|
||||||
result = 0;
|
result = 0;
|
||||||
} else if (user?.id == message.user?.id) {
|
} else if (user?.id == message.user?.id) {
|
||||||
if (divFactor >= 1.7) {
|
if (divFactor >= 1.7) {
|
||||||
|
|||||||
@@ -374,7 +374,7 @@ extension MessageX on Message {
|
|||||||
(min(quotedMessage!.text?.biggestLine().length ?? 0, 65)) + 6;
|
(min(quotedMessage!.text?.biggestLine().length ?? 0, 65)) + 6;
|
||||||
|
|
||||||
if (quotedMessage!.attachments.isNotEmpty) {
|
if (quotedMessage!.attachments.isNotEmpty) {
|
||||||
quotedMessageLength += 40;
|
quotedMessageLength += 8;
|
||||||
}
|
}
|
||||||
if (quotedMessageLength > messageTextLength) {
|
if (quotedMessageLength > messageTextLength) {
|
||||||
messageTextLength = quotedMessageLength;
|
messageTextLength = quotedMessageLength;
|
||||||
|
|||||||
Reference in New Issue
Block a user