Arkadii Ivanov
4 years ago
committed by
GitHub
5 changed files with 152 additions and 26 deletions
@ -0,0 +1,26 @@
|
||||
package example.todo.common.utils.compose |
||||
|
||||
import androidx.compose.foundation.lazy.LazyListState |
||||
import androidx.compose.runtime.Composable |
||||
import androidx.compose.ui.Modifier |
||||
import androidx.compose.ui.unit.Dp |
||||
import androidx.compose.ui.unit.dp |
||||
|
||||
actual val MARGIN_SCROLLBAR: Dp = 0.dp |
||||
|
||||
actual interface ScrollbarAdapter |
||||
|
||||
@Composable |
||||
actual fun rememberScrollbarAdapter( |
||||
scrollState: LazyListState, |
||||
itemCount: Int, |
||||
averageItemSize: Dp |
||||
): ScrollbarAdapter = |
||||
object : ScrollbarAdapter {} |
||||
|
||||
@Composable |
||||
actual fun VerticalScrollbar( |
||||
modifier: Modifier, |
||||
adapter: ScrollbarAdapter |
||||
) { |
||||
} |
@ -0,0 +1,23 @@
|
||||
package example.todo.common.utils.compose |
||||
|
||||
import androidx.compose.foundation.lazy.LazyListState |
||||
import androidx.compose.runtime.Composable |
||||
import androidx.compose.ui.Modifier |
||||
import androidx.compose.ui.unit.Dp |
||||
|
||||
expect val MARGIN_SCROLLBAR: Dp |
||||
|
||||
expect interface ScrollbarAdapter |
||||
|
||||
@Composable |
||||
expect fun rememberScrollbarAdapter( |
||||
scrollState: LazyListState, |
||||
itemCount: Int, |
||||
averageItemSize: Dp |
||||
): ScrollbarAdapter |
||||
|
||||
@Composable |
||||
expect fun VerticalScrollbar( |
||||
modifier: Modifier, |
||||
adapter: ScrollbarAdapter |
||||
) |
@ -0,0 +1,36 @@
|
||||
package example.todo.common.utils.compose |
||||
|
||||
import androidx.compose.foundation.ExperimentalFoundationApi |
||||
import androidx.compose.foundation.lazy.LazyListState |
||||
import androidx.compose.runtime.Composable |
||||
import androidx.compose.ui.Modifier |
||||
import androidx.compose.ui.unit.Dp |
||||
import androidx.compose.ui.unit.dp |
||||
|
||||
actual val MARGIN_SCROLLBAR: Dp = 8.dp |
||||
|
||||
actual typealias ScrollbarAdapter = androidx.compose.foundation.ScrollbarAdapter |
||||
|
||||
@OptIn(ExperimentalFoundationApi::class) |
||||
@Composable |
||||
actual fun rememberScrollbarAdapter( |
||||
scrollState: LazyListState, |
||||
itemCount: Int, |
||||
averageItemSize: Dp |
||||
): ScrollbarAdapter = |
||||
androidx.compose.foundation.rememberScrollbarAdapter( |
||||
scrollState = scrollState, |
||||
itemCount = itemCount, |
||||
averageItemSize = averageItemSize |
||||
) |
||||
|
||||
@Composable |
||||
actual fun VerticalScrollbar( |
||||
modifier: Modifier, |
||||
adapter: ScrollbarAdapter |
||||
) { |
||||
androidx.compose.foundation.VerticalScrollbar( |
||||
modifier = modifier, |
||||
adapter = adapter |
||||
) |
||||
} |
Loading…
Reference in new issue