Display Scribe modals correctly when a keyboard is opened

This commit is contained in:
Théo Poizat
2026-02-10 14:18:50 +01:00
committed by Dat H. Pham
parent 7b3e3e1b16
commit 269ca7116c
2 changed files with 10 additions and 4 deletions
@@ -72,6 +72,10 @@ class AiScribeModalWidget extends StatelessWidget {
);
if (buttonPosition != null && buttonSize != null) {
final keyboardHeight = MediaQuery.of(context).viewInsets.bottom;
final screenSize = MediaQuery.of(context).size;
final availableHeight = screenSize.height - keyboardHeight;
final maxHeightModal = hasContent
? AIScribeSizes.searchBarMinHeight +
AIScribeSizes.fieldSpacing +
@@ -81,7 +85,7 @@ class AiScribeModalWidget extends StatelessWidget {
final layoutResult = AnchoredModalLayoutCalculator.calculate(
input: AnchoredModalLayoutInput(
screenSize: MediaQuery.of(context).size,
screenSize: Size(screenSize.width, availableHeight),
anchorPosition: buttonPosition!,
anchorSize: buttonSize!,
menuSize: Size(
@@ -49,7 +49,9 @@ class _AiScribeSuggestionWidgetState extends State<AiScribeSuggestionWidget>
@override
Widget build(BuildContext context) {
final screenSize = MediaQuery.sizeOf(context);
final keyboardHeight = MediaQuery.of(context).viewInsets.bottom;
final screenSize = MediaQuery.of(context).size;
final availableHeight = screenSize.height - keyboardHeight;
final modalWidth = min(
screenSize.width * AIScribeSizes.mobileFactor,
@@ -57,7 +59,7 @@ class _AiScribeSuggestionWidgetState extends State<AiScribeSuggestionWidget>
);
final modalMaxHeight = min(
screenSize.height * AIScribeSizes.mobileFactor,
availableHeight * AIScribeSizes.mobileFactor,
AIScribeSizes.suggestionModalMaxHeight,
);
@@ -76,7 +78,7 @@ class _AiScribeSuggestionWidgetState extends State<AiScribeSuggestionWidget>
}
final layout = AnchoredModalLayoutCalculator.calculateAnchoredSuggestLayout(
screenSize: screenSize,
screenSize: Size(screenSize.width, availableHeight),
anchorPosition: widget.buttonPosition!,
anchorSize: widget.buttonSize!,
menuSize: Size(modalWidth, modalMaxHeight),