Adjust chip icon sizes

This commit is contained in:
MM20 2023-08-26 22:40:15 +02:00
parent 28384972d5
commit c0ba124ee6
No known key found for this signature in database
GPG Key ID: 0B61A8F2DEAFA389
3 changed files with 39 additions and 12 deletions

View File

@ -3,15 +3,36 @@ package de.mm20.launcher2.ui.component
import androidx.compose.foundation.clickable import androidx.compose.foundation.clickable
import androidx.compose.foundation.horizontalScroll import androidx.compose.foundation.horizontalScroll
import androidx.compose.foundation.interaction.MutableInteractionSource import androidx.compose.foundation.interaction.MutableInteractionSource
import androidx.compose.foundation.layout.* import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.PaddingValues
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.rememberScrollState import androidx.compose.foundation.rememberScrollState
import androidx.compose.foundation.text.BasicTextField import androidx.compose.foundation.text.BasicTextField
import androidx.compose.foundation.text.KeyboardActions import androidx.compose.foundation.text.KeyboardActions
import androidx.compose.material.icons.Icons import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.rounded.Clear import androidx.compose.material.icons.rounded.Clear
import androidx.compose.material.icons.rounded.Tag import androidx.compose.material.icons.rounded.Tag
import androidx.compose.material3.* import androidx.compose.material3.DropdownMenu
import androidx.compose.runtime.* import androidx.compose.material3.DropdownMenuItem
import androidx.compose.material3.Icon
import androidx.compose.material3.InputChip
import androidx.compose.material3.InputChipDefaults
import androidx.compose.material3.LocalContentColor
import androidx.compose.material3.LocalTextStyle
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Text
import androidx.compose.material3.TextFieldDefaults
import androidx.compose.runtime.Composable
import androidx.compose.runtime.CompositionLocalProvider
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.rememberCoroutineScope
import androidx.compose.runtime.setValue
import androidx.compose.ui.Alignment import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier import androidx.compose.ui.Modifier
import androidx.compose.ui.focus.onFocusChanged import androidx.compose.ui.focus.onFocusChanged
@ -118,6 +139,8 @@ fun OutlinedTagsInputField(
onClick = { }, onClick = { },
leadingIcon = { leadingIcon = {
Icon( Icon(
modifier = Modifier
.size(InputChipDefaults.IconSize),
imageVector = Icons.Rounded.Tag, imageVector = Icons.Rounded.Tag,
contentDescription = null contentDescription = null
) )
@ -125,9 +148,11 @@ fun OutlinedTagsInputField(
label = { Text(tag) }, label = { Text(tag) },
trailingIcon = { trailingIcon = {
Icon( Icon(
modifier = Modifier.clickable { modifier = Modifier
onTagsChange(tags.filterIndexed { index, _ -> index != i }) .size(InputChipDefaults.IconSize)
}, .clickable {
onTagsChange(tags.filterIndexed { index, _ -> index != i })
},
imageVector = Icons.Rounded.Clear, imageVector = Icons.Rounded.Clear,
contentDescription = null contentDescription = null
) )

View File

@ -36,6 +36,7 @@ import androidx.compose.material.icons.rounded.Visibility
import androidx.compose.material.icons.rounded.VisibilityOff import androidx.compose.material.icons.rounded.VisibilityOff
import androidx.compose.material3.Icon import androidx.compose.material3.Icon
import androidx.compose.material3.InputChip import androidx.compose.material3.InputChip
import androidx.compose.material3.InputChipDefaults
import androidx.compose.material3.MaterialTheme import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.SnackbarDuration import androidx.compose.material3.SnackbarDuration
import androidx.compose.material3.SnackbarResult import androidx.compose.material3.SnackbarResult
@ -172,8 +173,8 @@ fun AppItem(
Box(modifier = Modifier.background(Color(not.color))) { Box(modifier = Modifier.background(Color(not.color))) {
AsyncImage( AsyncImage(
modifier = Modifier modifier = Modifier
.padding(3.dp) .requiredSize(InputChipDefaults.AvatarSize)
.requiredSize(18.dp), .padding(3.dp),
model = icon, model = icon,
contentDescription = null contentDescription = null
) )
@ -186,7 +187,7 @@ fun AppItem(
null, null,
modifier = Modifier modifier = Modifier
.clip(CircleShape) .clip(CircleShape)
.size(18.dp) .size(InputChipDefaults.IconSize)
.clickable { .clickable {
viewModel.clearNotification(not) viewModel.clearNotification(not)
}, },
@ -242,7 +243,7 @@ fun AppItem(
contentDescription = null, contentDescription = null,
modifier = Modifier modifier = Modifier
.clip(CircleShape) .clip(CircleShape)
.size(24.dp), .size(InputChipDefaults.AvatarSize),
) )
}, },
trailingIcon = if (LocalFavoritesEnabled.current) { trailingIcon = if (LocalFavoritesEnabled.current) {
@ -252,7 +253,7 @@ fun AppItem(
null, null,
modifier = Modifier modifier = Modifier
.clip(CircleShape) .clip(CircleShape)
.requiredSize(18.dp) .requiredSize(InputChipDefaults.IconSize)
.clickable { .clickable {
if (isPinned) { if (isPinned) {

View File

@ -61,7 +61,8 @@ fun ColumnScope.SearchBarActions(
label = { Text(it.label) }, label = { Text(it.label) },
leadingIcon = { leadingIcon = {
SearchActionIcon( SearchActionIcon(
action = it action = it,
size = AssistChipDefaults.IconSize,
) )
} }
) )