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 |
||||
|
||||
import androidx.compose.foundation.ScrollState |
||||
import androidx.compose.runtime.Composable |
||||
import androidx.compose.runtime.mutableStateOf |
||||
import androidx.compose.runtime.remember |
||||
import androidx.compose.ui.selection.Selection |
||||
import androidx.compose.ui.text.InternalTextApi |
||||
import androidx.compose.ui.Modifier |
||||
|
||||
@OptIn(InternalTextApi::class) |
||||
@Composable |
||||
actual fun SelectionContainer(children: @Composable () -> Unit) { |
||||
val selection = remember { mutableStateOf<Selection?>(null) } |
||||
androidx.compose.ui.selection.SelectionContainer( |
||||
selection = selection.value, |
||||
onSelectionChange = { selection.value = it }, |
||||
children = children |
||||
) |
||||
} |
||||
actual fun VerticalScrollbar( |
||||
modifier: Modifier, |
||||
scrollState: ScrollState |
||||
) = Unit |
@ -1,6 +1,11 @@
|
||||
package androidx.ui.examples.jetissues.view.common |
||||
|
||||
import androidx.compose.foundation.ScrollState |
||||
import androidx.compose.runtime.Composable |
||||
import androidx.compose.ui.Modifier |
||||
|
||||
@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 |
||||
|
||||
import androidx.compose.foundation.ScrollState |
||||
import androidx.compose.foundation.rememberScrollbarAdapter |
||||
import androidx.compose.runtime.Composable |
||||
import androidx.compose.runtime.mutableStateOf |
||||
import androidx.compose.runtime.remember |
||||
import androidx.compose.ui.platform.DesktopSelectionContainer |
||||
import androidx.compose.ui.selection.Selection |
||||
import androidx.compose.ui.Modifier |
||||
|
||||
@Composable |
||||
actual fun SelectionContainer(children: @Composable () -> Unit) { |
||||
val selection = remember { mutableStateOf<Selection?>(null) } |
||||
DesktopSelectionContainer( |
||||
selection = selection.value, |
||||
onSelectionChange = { selection.value = it }, |
||||
content = children |
||||
) |
||||
} |
||||
actual fun VerticalScrollbar( |
||||
modifier: Modifier, |
||||
scrollState: ScrollState |
||||
) = androidx.compose.foundation.VerticalScrollbar( |
||||
rememberScrollbarAdapter(scrollState), |
||||
modifier |
||||
) |
Loading…
Reference in new issue