androidxCommonMain.com.huanshankeji.compose.foundation.Scroll.androidxCommon.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of compose-multiplatform-common
Show all versions of compose-multiplatform-common
Common wrappers of components (including layouts) and styles for Compose Multiplatform on (desktop/Android and web)
The newest version!
package com.huanshankeji.compose.foundation
import androidx.compose.foundation.horizontalScroll
import androidx.compose.foundation.rememberScrollState
import androidx.compose.foundation.verticalScroll
import androidx.compose.runtime.Composable
import com.huanshankeji.compose.foundation.layout.Box
import com.huanshankeji.compose.foundation.layout.BoxScope
import com.huanshankeji.compose.ui.Alignment
import com.huanshankeji.compose.ui.Modifier
@Composable
actual fun rememberScrollState(initial: Int): ScrollState =
rememberScrollState(initial)
actual typealias ScrollState = androidx.compose.foundation.ScrollState
actual fun Modifier.verticalScroll(state: ScrollState): Modifier =
platformModify { verticalScroll(state) }
actual fun Modifier.horizontalScroll(state: ScrollState): Modifier =
platformModify { horizontalScroll(state) }
@Composable
actual fun VerticalScrollBox(
boxModifier: Modifier,
contentModifier: Modifier,
contentAlignment: Alignment,
content: @Composable BoxScope.() -> Unit
) =
Box(boxModifier.verticalScroll(rememberScrollState()).then(contentModifier), contentAlignment, content)
@Composable
actual fun HorizontalScrollBox(
boxModifier: Modifier,
contentModifier: Modifier,
contentAlignment: Alignment,
content: @Composable BoxScope.() -> Unit
) =
Box(boxModifier.horizontalScroll(rememberScrollState()).then(contentModifier), contentAlignment, content)
© 2015 - 2025 Weber Informatics LLC | Privacy Policy