mikehearn
04/05/2023, 1:20 PMVerticalScrollbar
and syncing them via a scrollState
but it doesn't seem to work properly.Kirill Grouchnikov
04/05/2023, 1:41 PMIgor Demin
04/05/2023, 1:49 PMimport androidx.compose.foundation.ExperimentalFoundationApi
import androidx.compose.foundation.VerticalScrollbar
import androidx.compose.foundation.gestures.Orientation
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.fillMaxHeight
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.rememberScrollbarAdapter
import androidx.compose.foundation.text.BasicTextField
import androidx.compose.foundation.text.TextFieldScrollState
import androidx.compose.runtime.remember
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.window.singleWindowApplication
@OptIn(ExperimentalFoundationApi::class)
fun main() = singleWindowApplication {
val scrollState = remember { TextFieldScrollState(Orientation.Vertical) }
Box(Modifier.fillMaxSize()) {
BasicTextField(
value = (1..10000).joinToString { "a " },
{},
modifier = Modifier.fillMaxSize(),
scrollState = scrollState
)
VerticalScrollbar(
rememberScrollbarAdapter(scrollState),
modifier = Modifier.fillMaxHeight().align(Alignment.CenterEnd)
)
}
}
(it doesn't exist for TextField)mikehearn
04/05/2023, 3:12 PM