FIxing attachments
This commit is contained in:
+20
-18
@@ -16,8 +16,8 @@ double calculateReactionsHorizontalAlignmentValue(
|
|||||||
final maxHeight = constraints.maxHeight;
|
final maxHeight = constraints.maxHeight;
|
||||||
|
|
||||||
final roughSentenceSize = message.roughMessageSize(fontSize);
|
final roughSentenceSize = message.roughMessageSize(fontSize);
|
||||||
|
final hasAttachments = message.attachments.isNotEmpty;
|
||||||
final divFactor = message.attachments.isNotEmpty
|
final divFactor = hasAttachments
|
||||||
? 1
|
? 1
|
||||||
: (roughSentenceSize == 0 ? 1 : (roughSentenceSize / maxSize));
|
: (roughSentenceSize == 0 ? 1 : (roughSentenceSize / maxSize));
|
||||||
|
|
||||||
@@ -29,6 +29,7 @@ double calculateReactionsHorizontalAlignmentValue(
|
|||||||
maxHeight,
|
maxHeight,
|
||||||
shiftFactor,
|
shiftFactor,
|
||||||
divFactor,
|
divFactor,
|
||||||
|
hasAttachments,
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
return _landScapeAlign(
|
return _landScapeAlign(
|
||||||
@@ -38,6 +39,7 @@ double calculateReactionsHorizontalAlignmentValue(
|
|||||||
maxHeight,
|
maxHeight,
|
||||||
shiftFactor,
|
shiftFactor,
|
||||||
divFactor,
|
divFactor,
|
||||||
|
hasAttachments,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -49,6 +51,7 @@ double _portraitAlign(
|
|||||||
double maxHeight,
|
double maxHeight,
|
||||||
double shiftFactor,
|
double shiftFactor,
|
||||||
num divFactor,
|
num divFactor,
|
||||||
|
bool hasAttachments,
|
||||||
) {
|
) {
|
||||||
print('INFO - max width: $maxWidth. '
|
print('INFO - max width: $maxWidth. '
|
||||||
'maxHeight: $maxHeight '
|
'maxHeight: $maxHeight '
|
||||||
@@ -57,23 +60,21 @@ double _portraitAlign(
|
|||||||
|
|
||||||
var result = 0.0;
|
var result = 0.0;
|
||||||
|
|
||||||
if (user?.id == message.user?.id) {
|
// This is an empiric value. This number tries to approximate all the
|
||||||
if (divFactor >= 1.0) {
|
// offset necessary for the position of reaction look the best way
|
||||||
/*
|
// possible.
|
||||||
This is an empiric value. This number tries to approximate all the
|
const constant = 1300;
|
||||||
offset necessary for the position of reaction look the best way
|
|
||||||
possible.
|
|
||||||
*/
|
|
||||||
const constant = 1300;
|
|
||||||
|
|
||||||
|
if (user?.id == message.user?.id) {
|
||||||
|
if (divFactor >= 1.0 || hasAttachments) {
|
||||||
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) {
|
if (divFactor >= 1.0 || hasAttachments) {
|
||||||
result = shiftFactor + 0.2;
|
result = shiftFactor + maxWidth / constant;
|
||||||
} else {
|
} else {
|
||||||
result = -(1.2 - divFactor);
|
result = -(1.2 - divFactor);
|
||||||
}
|
}
|
||||||
@@ -101,6 +102,7 @@ double _landScapeAlign(
|
|||||||
double maxHeight,
|
double maxHeight,
|
||||||
double shiftFactor,
|
double shiftFactor,
|
||||||
num divFactor,
|
num divFactor,
|
||||||
|
bool hasAttachments,
|
||||||
) {
|
) {
|
||||||
var result = 0.0;
|
var result = 0.0;
|
||||||
|
|
||||||
@@ -109,15 +111,15 @@ double _landScapeAlign(
|
|||||||
'shiftFactor: $shiftFactor '
|
'shiftFactor: $shiftFactor '
|
||||||
'divFactor: $divFactor');
|
'divFactor: $divFactor');
|
||||||
|
|
||||||
if (user?.id == message.user?.id) {
|
/*
|
||||||
if (divFactor >= 1.7) {
|
|
||||||
/*
|
|
||||||
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 (user?.id == message.user?.id) {
|
||||||
|
if (divFactor >= 1.7) {
|
||||||
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.
|
||||||
@@ -125,9 +127,9 @@ double _landScapeAlign(
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (divFactor >= 1.7) {
|
if (divFactor >= 1.7) {
|
||||||
result = shiftFactor + 0.2;
|
result = shiftFactor + maxWidth / constant;
|
||||||
} else {
|
} else {
|
||||||
result = -(1.2 - divFactor);
|
result = -(1.2 - divFactor * 0.6);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user