File tree Expand file tree Collapse file tree 1 file changed +3
-4
lines changed
compose/snippets/src/main/java/com/example/compose/snippets/layouts Expand file tree Collapse file tree 1 file changed +3
-4
lines changed Original file line number Diff line number Diff line change @@ -28,7 +28,6 @@ import androidx.compose.runtime.mutableStateOf
2828import androidx.compose.runtime.remember
2929import androidx.compose.runtime.setValue
3030import androidx.compose.ui.unit.dp
31- import androidx.window.core.layout.WindowHeightSizeClass
3231import androidx.window.core.layout.WindowSizeClass
3332
3433/*
@@ -51,10 +50,10 @@ import androidx.window.core.layout.WindowSizeClass
5150fun MyApp (
5251 windowSizeClass : WindowSizeClass = currentWindowAdaptiveInfo().windowSizeClass
5352) {
54- // Perform logic on the size class to decide whether to show the top app bar.
55- val showTopAppBar = windowSizeClass.windowHeightSizeClass != WindowHeightSizeClass . COMPACT
53+ // Decide whether to show the top app bar based on window size class .
54+ val showTopAppBar = windowSizeClass.isHeightAtLeastBreakpoint( WindowSizeClass . HEIGHT_DP_MEDIUM_LOWER_BOUND )
5655
57- // MyScreen knows nothing about window sizes, and performs logic based on a Boolean flag.
56+ // MyScreen logic is based on the showTopAppBar boolean flag.
5857 MyScreen (
5958 showTopAppBar = showTopAppBar,
6059 /* ... */
You can’t perform that action at this time.
0 commit comments