Skip to content

Conversation

@susheel17
Copy link

Summary

  • Adds a new usePopup parameter to FlexibleSheetState that controls whether the bottom sheet renders in a popup window or inline within the composable hierarchy
  • When usePopup = false, the bottom sheet renders inline, properly respecting the z-order of navigation drawers
  • Defaults to true for backward compatibility

Problem

The FlexibleBottomSheet was rendering above navigation drawers because it uses a popup window via WindowManager. Any separate window will always appear above content in the parent window, regardless of the window type.

Solution

Added an inline rendering mode that can be enabled by setting usePopup = false:

rememberFlexibleBottomSheetState(
  isModal = true,
  usePopup = false,  // Renders inline, drawer appears above bottom sheet
  // ... other params
)

Trade-offs

Mode Behavior
usePopup = true (default) Bottom sheet renders above all content, useful for overlaying Google Maps etc.
usePopup = false Bottom sheet renders inline, respects navigation drawer z-order

Test plan

  • Verify bottom sheet with usePopup = true renders above all content (default behavior unchanged)
  • Verify bottom sheet with usePopup = false renders below navigation drawer
  • Test modal and non-modal sheets with both settings
  • Verify swipe gestures and dismiss behavior work correctly in both modes

Fixes #75

This adds a new `usePopup` parameter to FlexibleSheetState that controls
whether the bottom sheet renders in a popup window or inline within the
composable hierarchy.

When usePopup = true (default): The sheet uses a separate window via
WindowManager, which renders above all content including navigation drawers.
This is useful for overlaying content like Google Maps.

When usePopup = false: The sheet renders inline, respecting the z-order
of other components like ModalDrawer. This fixes issue skydoves#75 where the
bottom sheet would appear above navigation drawers.

Changes:
- Add usePopup parameter to FlexibleSheetState (defaults to true for
  backward compatibility)
- Update rememberFlexibleBottomSheetState to accept usePopup parameter
- Update Saver to preserve usePopup across configuration changes
- Modify FlexibleBottomSheet (Material) to conditionally render inline
- Modify FlexibleBottomSheet (Material3) to conditionally render inline

Fixes skydoves#75
Add ModalDrawer to MainActivity to test drawer layering behavior.
Update sample sheets to use usePopup = false to demonstrate how
the bottom sheet properly renders below the navigation drawer.
@susheel17 susheel17 requested a review from skydoves as a code owner January 15, 2026 04:11
Add JVM unit tests that verify:
- usePopup defaults to true for backward compatibility
- usePopup can be explicitly set to false
- usePopup can be explicitly set to true
- usePopup is independent of isModal setting
- FlexibleSheetSize default values are correct

Tests run on JVM without requiring device or emulator.
Regenerate API signatures after adding usePopup parameter:
- flexible-core: Add usePopup to FlexibleSheetState constructor and
  rememberFlexibleBottomSheetState function signature
- app: Update lambda hashes reflecting demo app changes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

FlexibleBottomSheet appears on top of appdrawer in KMP project

1 participant