
Observable utility determines window size dynamically, addressing current API limitations, especially for non-Android targets, with straightforward integration for responsive design adaptations.
A Compose Multiplatform utility that provides an observable way of knowing the size of the window you are in.
repositories {
mavenCentral()
}
dependencies {
implementation("com.alexstyl:cmpcontainersize:1.0.0")
}Compose Multiplatform has a built-in API for getting the size of the current window
(LocalWindowInfo.current.containerSize). However, this API is not current available on the Android target.
Until this, you can use this library.
@Composable
fun App() {
val containerSize = currentWindowContainerSize()
if (containerSize.width >= 600.dp) {
TabletLayout()
} else {
PhoneLayout()
}
}Created by Alex Styl. Tweet me with a cool thing you built.
A Compose Multiplatform utility that provides an observable way of knowing the size of the window you are in.
repositories {
mavenCentral()
}
dependencies {
implementation("com.alexstyl:cmpcontainersize:1.0.0")
}Compose Multiplatform has a built-in API for getting the size of the current window
(LocalWindowInfo.current.containerSize). However, this API is not current available on the Android target.
Until this, you can use this library.
@Composable
fun App() {
val containerSize = currentWindowContainerSize()
if (containerSize.width >= 600.dp) {
TabletLayout()
} else {
PhoneLayout()
}
}Created by Alex Styl. Tweet me with a cool thing you built.