Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replaced deprecated WindowHeightSizeClass with isHeightAtLeastBreakpoint(). #419

Merged
merged 7 commits into from
Jan 7, 2025
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
import androidx.compose.ui.unit.dp
import androidx.window.core.layout.WindowHeightSizeClass
import androidx.window.core.layout.WindowSizeClass

/*
Expand All @@ -52,9 +51,9 @@ fun MyApp(
windowSizeClass: WindowSizeClass = currentWindowAdaptiveInfo().windowSizeClass
) {
// Perform logic on the size class to decide whether to show the top app bar.
val showTopAppBar = windowSizeClass.windowHeightSizeClass != WindowHeightSizeClass.COMPACT
val showTopAppBar = windowSizeClass.isHeightAtLeastBreakpoint(480)
JonEckenrode marked this conversation as resolved.
Show resolved Hide resolved

// MyScreen knows nothing about window sizes, and performs logic based on a Boolean flag.
// MyScreen knows nothing about window sizes, and performs logic based on a boolean flag.
MyScreen(
showTopAppBar = showTopAppBar,
/* ... */
Expand Down
Loading