Andrew Rudenko
4 years ago
committed by
GitHub
8 changed files with 93 additions and 76 deletions
@ -1,18 +1,11 @@ |
|||||||
package androidx.ui.examples.jetissues.view.common |
package androidx.ui.examples.jetissues.view.common |
||||||
|
|
||||||
|
import androidx.compose.foundation.ScrollState |
||||||
import androidx.compose.runtime.Composable |
import androidx.compose.runtime.Composable |
||||||
import androidx.compose.runtime.mutableStateOf |
import androidx.compose.ui.Modifier |
||||||
import androidx.compose.runtime.remember |
|
||||||
import androidx.compose.ui.selection.Selection |
|
||||||
import androidx.compose.ui.text.InternalTextApi |
|
||||||
|
|
||||||
@OptIn(InternalTextApi::class) |
|
||||||
@Composable |
@Composable |
||||||
actual fun SelectionContainer(children: @Composable () -> Unit) { |
actual fun VerticalScrollbar( |
||||||
val selection = remember { mutableStateOf<Selection?>(null) } |
modifier: Modifier, |
||||||
androidx.compose.ui.selection.SelectionContainer( |
scrollState: ScrollState |
||||||
selection = selection.value, |
) = Unit |
||||||
onSelectionChange = { selection.value = it }, |
|
||||||
children = children |
|
||||||
) |
|
||||||
} |
|
@ -1,6 +1,11 @@ |
|||||||
package androidx.ui.examples.jetissues.view.common |
package androidx.ui.examples.jetissues.view.common |
||||||
|
|
||||||
|
import androidx.compose.foundation.ScrollState |
||||||
import androidx.compose.runtime.Composable |
import androidx.compose.runtime.Composable |
||||||
|
import androidx.compose.ui.Modifier |
||||||
|
|
||||||
@Composable |
@Composable |
||||||
expect fun SelectionContainer(children: @Composable () -> Unit) |
expect fun VerticalScrollbar( |
||||||
|
modifier: Modifier, |
||||||
|
scrollState: ScrollState |
||||||
|
) |
@ -1,17 +1,15 @@ |
|||||||
package androidx.ui.examples.jetissues.view.common |
package androidx.ui.examples.jetissues.view.common |
||||||
|
|
||||||
|
import androidx.compose.foundation.ScrollState |
||||||
|
import androidx.compose.foundation.rememberScrollbarAdapter |
||||||
import androidx.compose.runtime.Composable |
import androidx.compose.runtime.Composable |
||||||
import androidx.compose.runtime.mutableStateOf |
import androidx.compose.ui.Modifier |
||||||
import androidx.compose.runtime.remember |
|
||||||
import androidx.compose.ui.platform.DesktopSelectionContainer |
|
||||||
import androidx.compose.ui.selection.Selection |
|
||||||
|
|
||||||
@Composable |
@Composable |
||||||
actual fun SelectionContainer(children: @Composable () -> Unit) { |
actual fun VerticalScrollbar( |
||||||
val selection = remember { mutableStateOf<Selection?>(null) } |
modifier: Modifier, |
||||||
DesktopSelectionContainer( |
scrollState: ScrollState |
||||||
selection = selection.value, |
) = androidx.compose.foundation.VerticalScrollbar( |
||||||
onSelectionChange = { selection.value = it }, |
rememberScrollbarAdapter(scrollState), |
||||||
content = children |
modifier |
||||||
) |
) |
||||||
} |
|
Loading…
Reference in new issue