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