refactor: Migrate lots of old styling
This commit is contained in:
1 parent
d2793a321a
commit
4abd0db893
3 files changed
+29
-31
No files matched your search
+2
-6
@@ -27,13 +27,9 @@ fun PresetsList(
|
||||
PreferenceGroup(
|
||||
heading = stringResource(id = R.string.dynamic),
|
||||
modifier = modifier.padding(top = 12.dp),
|
||||
showDividers = false,
|
||||
) {
|
||||
dynamicEntries.mapIndexed { index, entry ->
|
||||
key(entry) {
|
||||
if (index > 0) {
|
||||
PreferenceDivider(startIndent = 40.dp)
|
||||
}
|
||||
dynamicEntries.forEach { entry ->
|
||||
item(key = entry) {
|
||||
PreferenceTemplate(
|
||||
title = { Text(text = entry.label()) },
|
||||
verticalPadding = 12.dp,
|
||||
|
||||
+25
-24
@@ -51,34 +51,35 @@ fun <T> SwatchGrid(
|
||||
PreferenceGroup(
|
||||
heading = stringResource(id = R.string.swatches),
|
||||
modifier = modifier,
|
||||
showDividers = false,
|
||||
) {
|
||||
Column(modifier = contentModifier) {
|
||||
for (rowNo in 1..rowCount) {
|
||||
val firstIndex = (rowNo - 1) * columnCount
|
||||
val lastIndex = firstIndex + columnCount - 1
|
||||
val indices = firstIndex..lastIndex
|
||||
item {
|
||||
Column(modifier = contentModifier) {
|
||||
for (rowNo in 1..rowCount) {
|
||||
val firstIndex = (rowNo - 1) * columnCount
|
||||
val lastIndex = firstIndex + columnCount - 1
|
||||
val indices = firstIndex..lastIndex
|
||||
|
||||
Row {
|
||||
entries.slice(indices).forEachIndexed { index, colorOption ->
|
||||
Box(
|
||||
modifier = Modifier.weight(1f),
|
||||
contentAlignment = Alignment.Center,
|
||||
) {
|
||||
ColorSwatch(
|
||||
entry = colorOption,
|
||||
onClick = { onSwatchClick(colorOption.value) },
|
||||
modifier = Modifier.widthIn(0.dp, SwatchGridDefaults.SwatchMaxWidth),
|
||||
selected = isSwatchSelected(colorOption.value),
|
||||
)
|
||||
}
|
||||
if (index != columnCount - 1) {
|
||||
Spacer(modifier = Modifier.width(gutter))
|
||||
Row {
|
||||
entries.slice(indices).forEachIndexed { index, colorOption ->
|
||||
Box(
|
||||
modifier = Modifier.weight(1f),
|
||||
contentAlignment = Alignment.Center,
|
||||
) {
|
||||
ColorSwatch(
|
||||
entry = colorOption,
|
||||
onClick = { onSwatchClick(colorOption.value) },
|
||||
modifier = Modifier.widthIn(0.dp, SwatchGridDefaults.SwatchMaxWidth),
|
||||
selected = isSwatchSelected(colorOption.value),
|
||||
)
|
||||
}
|
||||
if (index != columnCount - 1) {
|
||||
Spacer(modifier = Modifier.width(gutter))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (rowNo != rowCount) {
|
||||
Spacer(modifier = Modifier.height(gutter))
|
||||
if (rowNo != rowCount) {
|
||||
Spacer(modifier = Modifier.height(gutter))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,11 +8,12 @@ import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.unit.dp
|
||||
import app.lawnchair.ui.preferences.components.layout.PreferenceGroup
|
||||
import app.lawnchair.ui.preferences.components.layout.PreferenceGroupScope
|
||||
|
||||
@Composable
|
||||
fun PreferenceGroupPreviewContainer(
|
||||
modifier: Modifier = Modifier,
|
||||
content: @Composable () -> Unit,
|
||||
content: @Composable (PreferenceGroupScope.() -> Unit),
|
||||
) {
|
||||
Box(
|
||||
modifier = modifier.background(MaterialTheme.colorScheme.surfaceDim),
|
||||
|
||||
Reference in new issue
Block a user