apply save area when toolabr is dismissed

This commit is contained in:
Fabian Freund
2026-04-28 12:47:03 +02:00
parent 8fe34158ff
commit af426bc9b0
@@ -634,6 +634,17 @@ class BrowserScreen extends HookConsumerWidget {
? topAppBarTotalHeight ? topAppBarTotalHeight
: 0.0; : 0.0;
// Only fall back to the system bottom inset when the bottom
// toolbar was explicitly dismissed. The normal auto-hide
// hidden state is still handled by GeckoView's dynamic
// toolbar/clipping logic.
final applyBottomSafeArea =
!tabInFullScreen &&
!isSmallWebActive &&
!sheetDisplayed &&
bottomOffset == 0 &&
toolbarState == ToolbarVisibility.dismissed;
return Positioned( return Positioned(
left: 0, left: 0,
right: 0, right: 0,
@@ -647,6 +658,7 @@ class BrowserScreen extends HookConsumerWidget {
: null, : null,
sheetDisplayed: sheetDisplayed, sheetDisplayed: sheetDisplayed,
hasTopBarOffset: topOffset > 0, hasTopBarOffset: topOffset > 0,
applyBottomSafeArea: applyBottomSafeArea,
), ),
); );
}, },
@@ -933,6 +945,7 @@ class _Browser extends HookConsumerWidget {
final bool tabInFullScreen; final bool tabInFullScreen;
final bool sheetDisplayed; final bool sheetDisplayed;
final bool hasTopBarOffset; final bool hasTopBarOffset;
final bool applyBottomSafeArea;
const _Browser({ const _Browser({
required this.overlayController, required this.overlayController,
@@ -940,6 +953,7 @@ class _Browser extends HookConsumerWidget {
required this.pointerMoveEventSink, required this.pointerMoveEventSink,
required this.sheetDisplayed, required this.sheetDisplayed,
required this.hasTopBarOffset, required this.hasTopBarOffset,
required this.applyBottomSafeArea,
}); });
@override @override
@@ -1159,6 +1173,7 @@ class _Browser extends HookConsumerWidget {
isFullscreen: tabInFullScreen, isFullscreen: tabInFullScreen,
pointerMoveEventSink: pointerMoveEventSink, pointerMoveEventSink: pointerMoveEventSink,
hasTopBarOffset: hasTopBarOffset, hasTopBarOffset: hasTopBarOffset,
applyBottomSafeArea: applyBottomSafeArea,
), ),
), ),
), ),
@@ -1172,10 +1187,12 @@ class _BrowserView extends StatelessWidget {
final bool isFullscreen; final bool isFullscreen;
final StreamSink<Offset>? pointerMoveEventSink; final StreamSink<Offset>? pointerMoveEventSink;
final bool hasTopBarOffset; final bool hasTopBarOffset;
final bool applyBottomSafeArea;
const _BrowserView({ const _BrowserView({
required this.isFullscreen, required this.isFullscreen,
required this.hasTopBarOffset, required this.hasTopBarOffset,
required this.applyBottomSafeArea,
this.pointerMoveEventSink, this.pointerMoveEventSink,
}); });
@@ -1185,8 +1202,10 @@ class _BrowserView extends StatelessWidget {
// Disable top SafeArea when top bar handles it (has offset applied) // Disable top SafeArea when top bar handles it (has offset applied)
top: !isFullscreen && !hasTopBarOffset, top: !isFullscreen && !hasTopBarOffset,
right: !isFullscreen, right: !isFullscreen,
// Bottom SafeArea is handled by the overlay toolbar (BottomAppBar) // Apply bottom SafeArea only when no toolbar/overlay is rendered at the
bottom: false, // bottom (and not in fullscreen). Otherwise the toolbar handles its own
// safe-area inset and the platform view extends behind it.
bottom: applyBottomSafeArea,
left: !isFullscreen, left: !isFullscreen,
child: Stack( child: Stack(
children: [BrowserView(pointerMoveEventSink: pointerMoveEventSink)], children: [BrowserView(pointerMoveEventSink: pointerMoveEventSink)],