chore: position message overlay relative to bottom of the screen instead of the top (#3544)
This commit is contained in:
parent
0f0d221a30
commit
be42203feb
2 changed files with 37 additions and 18 deletions
|
|
@ -267,7 +267,7 @@ class MessageSelectionPositionerState extends State<MessageSelectionPositioner>
|
|||
return messageHeight + reactionsHeight + AppConfig.toolbarMenuHeight + 4.0;
|
||||
}
|
||||
|
||||
double get _overheadContentHeight {
|
||||
double get overheadContentHeight {
|
||||
return (widget.pangeaMessageEvent != null &&
|
||||
widget.overlayController.selectedToken != null
|
||||
? AppConfig.toolbarMaxHeight
|
||||
|
|
@ -287,7 +287,7 @@ class MessageSelectionPositionerState extends State<MessageSelectionPositioner>
|
|||
}
|
||||
|
||||
double get _fullContentHeight {
|
||||
return _contentHeight + _overheadContentHeight;
|
||||
return _contentHeight + overheadContentHeight;
|
||||
}
|
||||
|
||||
double? get _screenHeight {
|
||||
|
|
@ -308,15 +308,24 @@ class MessageSelectionPositionerState extends State<MessageSelectionPositioner>
|
|||
return bottomOffset > _screenHeight!;
|
||||
}
|
||||
|
||||
double get spaceAboveContent {
|
||||
if (shouldScroll) return _overheadContentHeight;
|
||||
if (_hasFooterOverflow) {
|
||||
return _screenHeight! - _fullContentHeight;
|
||||
double get spaceBelowContent {
|
||||
if (shouldScroll) return 0;
|
||||
if (_hasFooterOverflow) return 0;
|
||||
|
||||
final messageHeight = originalMessageSize.height;
|
||||
final originalContentHeight =
|
||||
messageHeight + reactionsHeight + AppConfig.toolbarMenuHeight + 4.0;
|
||||
|
||||
final screenHeight = mediaQuery!.size.height - mediaQuery!.padding.bottom;
|
||||
|
||||
final boxHeight =
|
||||
screenHeight - _originalMessageOffset.dy - originalContentHeight;
|
||||
|
||||
if (boxHeight + _fullContentHeight > screenHeight) {
|
||||
return screenHeight - _fullContentHeight;
|
||||
}
|
||||
|
||||
return _originalMessageOffset.dy -
|
||||
mediaQuery!.padding.top -
|
||||
_overheadContentHeight;
|
||||
return screenHeight - _originalMessageOffset.dy - originalContentHeight;
|
||||
}
|
||||
|
||||
void _onContentSizeChanged(_) {
|
||||
|
|
|
|||
|
|
@ -17,7 +17,8 @@ class OverMessageOverlay extends StatelessWidget {
|
|||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Align(
|
||||
alignment: controller.ownMessage ? Alignment.topRight : Alignment.topLeft,
|
||||
alignment:
|
||||
controller.ownMessage ? Alignment.bottomRight : Alignment.bottomLeft,
|
||||
child: Padding(
|
||||
padding: EdgeInsets.only(
|
||||
left: controller.messageLeftOffset ?? 0.0,
|
||||
|
|
@ -33,17 +34,14 @@ class OverMessageOverlay extends StatelessWidget {
|
|||
: CrossAxisAlignment.start,
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
AnimatedContainer(
|
||||
duration: FluffyThemes.animationDuration,
|
||||
height: max(0, controller.spaceAboveContent),
|
||||
width: controller.mediaQuery!.size.width -
|
||||
controller.columnWidth -
|
||||
(controller.showDetails ? FluffyThemes.columnWidth : 0),
|
||||
),
|
||||
if (!controller.shouldScroll) ...[
|
||||
WordCardSwitcher(controller: controller),
|
||||
const SizedBox(height: 4.0),
|
||||
],
|
||||
] else
|
||||
AnimatedContainer(
|
||||
duration: FluffyThemes.animationDuration,
|
||||
height: controller.overheadContentHeight,
|
||||
),
|
||||
CompositedTransformTarget(
|
||||
link: MatrixState.pAnyState
|
||||
.layerLinkAndKey(
|
||||
|
|
@ -79,6 +77,18 @@ class OverMessageOverlay extends StatelessWidget {
|
|||
ReadingAssistanceMode.practiceMode,
|
||||
),
|
||||
),
|
||||
AnimatedContainer(
|
||||
duration: FluffyThemes.animationDuration,
|
||||
height: max(0, controller.spaceBelowContent),
|
||||
width: controller.mediaQuery!.size.width -
|
||||
controller.columnWidth -
|
||||
(controller.showDetails ? FluffyThemes.columnWidth : 0),
|
||||
decoration: BoxDecoration(
|
||||
border: Border.all(
|
||||
color: Colors.green,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue