mirror of
https://github.com/Helium314/HeliBoard.git
synced 2025-04-23 07:39:11 +00:00
adjust some padding/spacing
This commit is contained in:
parent
31b2a36bcc
commit
80172665c0
4 changed files with 40 additions and 45 deletions
|
@ -78,58 +78,49 @@ fun Preference(
|
||||||
@DrawableRes icon: Int? = null,
|
@DrawableRes icon: Int? = null,
|
||||||
value: @Composable (RowScope.() -> Unit)? = null,
|
value: @Composable (RowScope.() -> Unit)? = null,
|
||||||
) {
|
) {
|
||||||
Column(
|
Row(
|
||||||
modifier = modifier
|
modifier = modifier
|
||||||
.fillMaxWidth()
|
.fillMaxWidth()
|
||||||
.clickable { onClick() }
|
.clickable { onClick() }
|
||||||
.heightIn(min = 48.dp)
|
.heightIn(min = 40.dp)
|
||||||
.padding(16.dp),
|
.padding(12.dp),
|
||||||
verticalArrangement = Arrangement.spacedBy(
|
horizontalArrangement = Arrangement.spacedBy(12.dp),
|
||||||
space = 0.dp,
|
verticalAlignment = Alignment.CenterVertically
|
||||||
alignment = Alignment.CenterVertically
|
|
||||||
)
|
|
||||||
) {
|
) {
|
||||||
Row(
|
if (icon != null)
|
||||||
modifier = modifier.fillMaxWidth(),
|
Icon(painterResource(icon), name, modifier = Modifier.size(36.dp))
|
||||||
horizontalArrangement = Arrangement.SpaceBetween,
|
Column(modifier = Modifier.weight(2 / 3f)) {
|
||||||
verticalAlignment = Alignment.CenterVertically
|
Text(text = name)
|
||||||
) {
|
if (description != null) {
|
||||||
if (icon != null)
|
|
||||||
Icon(painterResource(icon), name, modifier = Modifier.size(48.dp).padding(end = 8.dp))
|
|
||||||
Column(modifier = Modifier.weight(2 / 3f)) {
|
|
||||||
Text(text = name,)
|
|
||||||
if (description != null) {
|
|
||||||
CompositionLocalProvider(
|
|
||||||
LocalTextStyle provides MaterialTheme.typography.bodyMedium,
|
|
||||||
LocalContentColor provides MaterialTheme.colorScheme.onSurfaceVariant
|
|
||||||
) {
|
|
||||||
Text(
|
|
||||||
text = description,
|
|
||||||
modifier = Modifier.padding(top = 8.dp)
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
if (value != null) {
|
|
||||||
CompositionLocalProvider(
|
CompositionLocalProvider(
|
||||||
LocalTextStyle provides LocalTextStyle.current.copy(
|
LocalTextStyle provides MaterialTheme.typography.bodyMedium,
|
||||||
textAlign = TextAlign.End,
|
|
||||||
hyphens = Hyphens.Auto
|
|
||||||
),
|
|
||||||
LocalContentColor provides MaterialTheme.colorScheme.onSurfaceVariant
|
LocalContentColor provides MaterialTheme.colorScheme.onSurfaceVariant
|
||||||
) {
|
) {
|
||||||
Row(
|
Text(
|
||||||
horizontalArrangement = Arrangement.spacedBy(
|
text = description,
|
||||||
space = 8.dp,
|
modifier = Modifier.padding(top = 2.dp)
|
||||||
alignment = Alignment.End
|
)
|
||||||
),
|
|
||||||
verticalAlignment = Alignment.CenterVertically,
|
|
||||||
modifier = Modifier.weight(1 / 3f)
|
|
||||||
) { value() }
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (value != null) {
|
||||||
|
CompositionLocalProvider(
|
||||||
|
LocalTextStyle provides LocalTextStyle.current.copy(
|
||||||
|
textAlign = TextAlign.End,
|
||||||
|
hyphens = Hyphens.Auto
|
||||||
|
),
|
||||||
|
LocalContentColor provides MaterialTheme.colorScheme.onSurfaceVariant
|
||||||
|
) {
|
||||||
|
Row(
|
||||||
|
horizontalArrangement = Arrangement.spacedBy(
|
||||||
|
space = 8.dp,
|
||||||
|
alignment = Alignment.End
|
||||||
|
),
|
||||||
|
verticalAlignment = Alignment.CenterVertically,
|
||||||
|
modifier = Modifier.weight(1 / 3f)
|
||||||
|
) { value() }
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -68,7 +68,7 @@ fun <T: Any> ReorderDialog(
|
||||||
text = {
|
text = {
|
||||||
LazyColumn(
|
LazyColumn(
|
||||||
state = listState,
|
state = listState,
|
||||||
verticalArrangement = Arrangement.spacedBy(12.dp),
|
verticalArrangement = Arrangement.spacedBy(4.dp),
|
||||||
) {
|
) {
|
||||||
items(reorderableItems, key = getKey) { item ->
|
items(reorderableItems, key = getKey) { item ->
|
||||||
ReorderableItem(
|
ReorderableItem(
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package helium314.keyboard.settings.dialogs
|
package helium314.keyboard.settings.dialogs
|
||||||
|
|
||||||
import androidx.compose.foundation.clickable
|
import androidx.compose.foundation.clickable
|
||||||
|
import androidx.compose.foundation.layout.Arrangement
|
||||||
import androidx.compose.foundation.layout.Column
|
import androidx.compose.foundation.layout.Column
|
||||||
import androidx.compose.foundation.layout.Row
|
import androidx.compose.foundation.layout.Row
|
||||||
import androidx.compose.foundation.lazy.LazyColumn
|
import androidx.compose.foundation.lazy.LazyColumn
|
||||||
|
@ -24,6 +25,7 @@ import androidx.compose.ui.res.stringResource
|
||||||
import androidx.compose.ui.text.input.KeyboardType
|
import androidx.compose.ui.text.input.KeyboardType
|
||||||
import androidx.compose.ui.text.input.TextFieldValue
|
import androidx.compose.ui.text.input.TextFieldValue
|
||||||
import androidx.compose.ui.tooling.preview.Preview
|
import androidx.compose.ui.tooling.preview.Preview
|
||||||
|
import androidx.compose.ui.unit.dp
|
||||||
import androidx.compose.ui.window.DialogProperties
|
import androidx.compose.ui.window.DialogProperties
|
||||||
import androidx.core.content.edit
|
import androidx.core.content.edit
|
||||||
import helium314.keyboard.keyboard.internal.KeyboardIconsSet
|
import helium314.keyboard.keyboard.internal.KeyboardIconsSet
|
||||||
|
@ -64,7 +66,9 @@ fun ToolbarKeysCustomizer(
|
||||||
},
|
},
|
||||||
title = { Text(stringResource(R.string.customize_toolbar_key_codes)) },
|
title = { Text(stringResource(R.string.customize_toolbar_key_codes)) },
|
||||||
text = {
|
text = {
|
||||||
LazyColumn {
|
LazyColumn(
|
||||||
|
verticalArrangement = Arrangement.spacedBy(4.dp)
|
||||||
|
) {
|
||||||
items(ToolbarKey.entries) {
|
items(ToolbarKey.entries) {
|
||||||
Row(
|
Row(
|
||||||
verticalAlignment = Alignment.CenterVertically,
|
verticalAlignment = Alignment.CenterVertically,
|
||||||
|
|
|
@ -62,7 +62,7 @@ fun createAboutPrefs(context: Context) = listOf(
|
||||||
name = it.title,
|
name = it.title,
|
||||||
description = it.description,
|
description = it.description,
|
||||||
onClick = { },
|
onClick = { },
|
||||||
icon = R.drawable.ic_launcher_foreground
|
icon = R.drawable.ic_launcher_foreground // todo: maybe use the bitmap trick here?
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
PrefDef(context, NonSettingsPrefs.VERSION, R.string.version) {
|
PrefDef(context, NonSettingsPrefs.VERSION, R.string.version) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue