Skip to content

Instantly share code, notes, and snippets.

@alexvanyo
Last active January 14, 2022 20:34
Show Gist options
  • Save alexvanyo/67596d255b1d907518d88ac9038cc1bf to your computer and use it in GitHub Desktop.
Save alexvanyo/67596d255b1d907518d88ac9038cc1bf to your computer and use it in GitHub Desktop.
A modal drawer that is window size aware
// Copyright 2022 Google LLC.
// SPDX-License-Identifier: Apache-2.0
val isExpandedScreen = windowSize == WindowSize.Expanded
ModalDrawer(
drawerContent = {
AppDrawer(/* ... */)
},
// Only enable opening the drawer via gestures if the screen is not expanded
gesturesEnabled = !isExpandedScreen
) {
Row(/* ... */) {
if (isExpandedScreen) {
AppNavRail(/* ... */)
}
JetnewsNavGraph(/* ... */)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment