fix viewport not resetting when keyboard dismisses

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Fabian Freund
2026-02-14 20:38:10 +01:00
co-authored by Claude Opus 4.6
parent 24b8eb7057
commit fbbf331057
@@ -418,19 +418,15 @@ class BrowserScreen extends HookConsumerWidget {
useOnStreamChange( useOnStreamChange(
viewportService.keyboardEvents, viewportService.keyboardEvents,
onData: (event) { onData: (event) {
if (event.isVisible && event.heightPx > 0) { // When keyboard is visible, use keyboard height for viewport adjustment.
// When keyboard is visible, notify GeckoView to adjust viewport // When hidden, restore normal toolbar height to avoid stale viewport size.
// This uses the native API to handle keyboard without Flutter resize final findInPageHeightPx = findInPageVisible
// If find-in-page is also visible, add its height to the keyboard height ? (FindInPageWidget.findInPageHeight * pixelRatio).round()
final findInPageHeightPx = findInPageVisible : 0;
? (FindInPageWidget.findInPageHeight * pixelRatio).round() final targetHeightPx = event.isVisible && event.heightPx > 0
: 0; ? event.heightPx + findInPageHeightPx
unawaited( : toolbarHeightPx;
viewportService.setDynamicToolbarMaxHeight( unawaited(viewportService.setDynamicToolbarMaxHeight(targetHeightPx));
event.heightPx + findInPageHeightPx,
),
);
}
}, },
); );