Simplified vertical scrollbar usage
This commit is contained in:
@ -139,11 +139,7 @@ fun AccountsContent(contentPadding: PaddingValues, navController: NavController)
|
||||
.fillMaxWidth()
|
||||
.padding(contentPadding)
|
||||
.padding(start = 16.dp, end = 4.dp, top = 8.dp, bottom = 8.dp)
|
||||
.verticalScrollbar(
|
||||
state = lazyListState,
|
||||
width = 4.dp,
|
||||
color = MaterialTheme.colorScheme.outlineVariant
|
||||
),
|
||||
.verticalScrollbar(state = lazyListState),
|
||||
verticalArrangement = Arrangement.spacedBy(4.dp),
|
||||
) {
|
||||
items(BaresipService.uas.value) { ua ->
|
||||
|
||||
@ -268,11 +268,7 @@ private fun Blocked(ctx: Context, navController: NavController, blocked: Mutable
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.padding(start = 16.dp, end = 4.dp)
|
||||
.verticalScrollbar(
|
||||
state = lazyListState,
|
||||
width = 4.dp,
|
||||
color = MaterialTheme.colorScheme.outlineVariant
|
||||
)
|
||||
.verticalScrollbar(state = lazyListState)
|
||||
.background(MaterialTheme.colorScheme.background),
|
||||
state = lazyListState,
|
||||
verticalArrangement = Arrangement.spacedBy(12.dp),
|
||||
|
||||
@ -200,10 +200,7 @@ private fun Details(ctx: Context, details: SnapshotStateList<Details>, onDelete:
|
||||
LazyColumn(
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.verticalScrollbar(
|
||||
state = lazyListState,
|
||||
width = 4.dp
|
||||
)
|
||||
.verticalScrollbar(state = lazyListState)
|
||||
.background(MaterialTheme.colorScheme.background),
|
||||
state = lazyListState,
|
||||
verticalArrangement = Arrangement.spacedBy(12.dp),
|
||||
|
||||
@ -297,11 +297,7 @@ private fun Calls(
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.padding(start = 16.dp, end = 4.dp)
|
||||
.verticalScrollbar(
|
||||
state = lazyListState,
|
||||
width = 4.dp,
|
||||
color = MaterialTheme.colorScheme.outlineVariant
|
||||
)
|
||||
.verticalScrollbar(state = lazyListState)
|
||||
.background(MaterialTheme.colorScheme.background),
|
||||
state = lazyListState,
|
||||
verticalArrangement = Arrangement.spacedBy(12.dp),
|
||||
|
||||
@ -347,11 +347,7 @@ private fun Messages(
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.padding(start = 16.dp, end = 2.dp)
|
||||
.verticalScrollbar(
|
||||
state = lazyListState,
|
||||
width = 4.dp,
|
||||
color = MaterialTheme.colorScheme.outlineVariant
|
||||
)
|
||||
.verticalScrollbar(state = lazyListState)
|
||||
.background(MaterialTheme.colorScheme.background),
|
||||
reverseLayout = true,
|
||||
state = lazyListState,
|
||||
|
||||
@ -292,11 +292,7 @@ private fun Chats(
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.padding(start = 8.dp, end = 4.dp)
|
||||
.verticalScrollbar(
|
||||
state = lazyListState,
|
||||
width = 4.dp,
|
||||
color = MaterialTheme.colorScheme.outlineVariant
|
||||
)
|
||||
.verticalScrollbar(state = lazyListState)
|
||||
.background(MaterialTheme.colorScheme.background),
|
||||
reverseLayout = true,
|
||||
state = lazyListState,
|
||||
@ -513,10 +509,7 @@ private fun NewChatPeer(ctx: Context, navController: NavController, account: Acc
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.heightIn(max = 180.dp)
|
||||
.verticalScrollbar(
|
||||
state = lazyListState,
|
||||
color = MaterialTheme.colorScheme.outlineVariant
|
||||
),
|
||||
.verticalScrollbar(state = lazyListState, width = 6.dp),
|
||||
horizontalAlignment = Alignment.Start,
|
||||
state = lazyListState
|
||||
) {
|
||||
|
||||
@ -218,10 +218,7 @@ private fun Codecs(codecs: SnapshotStateList<Codec>, onUpdateCodecs: (List<Codec
|
||||
LazyColumn(
|
||||
modifier = Modifier
|
||||
.padding(end = 4.dp)
|
||||
.verticalScrollbar(
|
||||
state = draggableState.listState,
|
||||
width = 4.dp
|
||||
),
|
||||
.verticalScrollbar(state = draggableState.listState),
|
||||
state = draggableState.listState,
|
||||
contentPadding = PaddingValues(start = 12.dp, end = 12.dp),
|
||||
//verticalArrangement = Arrangement.spacedBy(8.dp)
|
||||
|
||||
@ -263,11 +263,7 @@ private fun ContactsContent(
|
||||
.background(MaterialTheme.colorScheme.background)
|
||||
.padding(contentPadding)
|
||||
.padding(start = 16.dp, end = 4.dp, top = 16.dp, bottom = 10.dp)
|
||||
.verticalScrollbar(
|
||||
state = lazyListState,
|
||||
width = 4.dp,
|
||||
color = MaterialTheme.colorScheme.outlineVariant
|
||||
),
|
||||
.verticalScrollbar(state = lazyListState),
|
||||
state = lazyListState,
|
||||
verticalArrangement = Arrangement.spacedBy(10.dp),
|
||||
) {
|
||||
|
||||
@ -200,15 +200,13 @@ object CustomElements {
|
||||
@Composable
|
||||
fun Modifier.verticalScrollbar(
|
||||
state: LazyListState,
|
||||
width: Dp = 8.dp,
|
||||
width: Dp = 4.dp,
|
||||
alwaysShow: Boolean = true,
|
||||
color: Color = MaterialTheme.colorScheme.outlineVariant
|
||||
): Modifier {
|
||||
val targetAlpha = if (state.isScrollInProgress || alwaysShow) 1f else 0f
|
||||
val duration = if (state.isScrollInProgress) 150 else 500
|
||||
val alpha by animateFloatAsState(
|
||||
targetValue = targetAlpha,
|
||||
animationSpec = tween(durationMillis = duration)
|
||||
targetValue = if (state.isScrollInProgress || alwaysShow) 1f else 0f,
|
||||
animationSpec = tween(durationMillis = if (state.isScrollInProgress) 150 else 500)
|
||||
)
|
||||
return drawWithContent {
|
||||
drawContent()
|
||||
|
||||
@ -1289,10 +1289,7 @@ private fun CallUriRow(
|
||||
LazyColumn(
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.verticalScrollbar(
|
||||
state = lazyListState,
|
||||
color = MaterialTheme.colorScheme.outlineVariant
|
||||
),
|
||||
.verticalScrollbar(state = lazyListState, width = 6.dp),
|
||||
horizontalAlignment = Alignment.Start,
|
||||
state = lazyListState
|
||||
) {
|
||||
@ -1684,7 +1681,7 @@ private fun CallRow(
|
||||
.fillMaxWidth()
|
||||
.verticalScrollbar(
|
||||
state = lazyListState,
|
||||
color = MaterialTheme.colorScheme.outlineVariant
|
||||
width = 6.dp,
|
||||
),
|
||||
horizontalAlignment = Alignment.Start,
|
||||
state = lazyListState,
|
||||
|
||||
Reference in New Issue
Block a user