fix(ui): resolve ColumnScope, Oklab.Lab, and missing layout imports in SettingsComponents.kt
This commit is contained in:
parent
779796f825
commit
8a527451d7
1 changed files with 19 additions and 12 deletions
|
|
@ -8,30 +8,44 @@ import androidx.compose.foundation.isSystemInDarkTheme
|
|||
import androidx.compose.foundation.layout.Arrangement
|
||||
import androidx.compose.foundation.layout.Box
|
||||
import androidx.compose.foundation.layout.Column
|
||||
import androidx.compose.foundation.layout.ColumnScope
|
||||
import androidx.compose.foundation.layout.FlowRow
|
||||
import androidx.compose.foundation.layout.Row
|
||||
import androidx.compose.foundation.layout.Spacer
|
||||
import androidx.compose.foundation.layout.WindowInsets
|
||||
import androidx.compose.foundation.layout.asPaddingValues
|
||||
import androidx.compose.foundation.layout.fillMaxSize
|
||||
import androidx.compose.foundation.layout.fillMaxWidth
|
||||
import androidx.compose.foundation.layout.height
|
||||
import androidx.compose.foundation.layout.heightIn
|
||||
import androidx.compose.foundation.layout.ime
|
||||
import androidx.compose.foundation.layout.isImeVisible
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.foundation.layout.size
|
||||
import androidx.compose.foundation.layout.width
|
||||
import androidx.compose.foundation.layout.widthIn
|
||||
import androidx.compose.foundation.rememberScrollState
|
||||
import androidx.compose.foundation.shape.CircleShape
|
||||
import androidx.compose.foundation.shape.RoundedCornerShape
|
||||
import androidx.compose.foundation.text.BasicTextField
|
||||
import androidx.compose.foundation.verticalScroll
|
||||
import androidx.compose.material.icons.Icons
|
||||
import androidx.compose.material.icons.rounded.Check
|
||||
import androidx.compose.material3.Icon
|
||||
import androidx.compose.material3.MaterialTheme
|
||||
import androidx.compose.material3.Text
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.getValue
|
||||
import androidx.compose.runtime.remember
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.draw.clip
|
||||
import androidx.compose.ui.draw.shadow
|
||||
import androidx.compose.ui.geometry.Offset
|
||||
import androidx.compose.ui.graphics.Brush
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.graphics.SolidColor
|
||||
import androidx.compose.ui.graphics.StrokeCap
|
||||
import androidx.compose.ui.graphics.colorspace.ColorSpaces
|
||||
import androidx.compose.ui.graphics.vector.ImageVector
|
||||
import androidx.compose.ui.text.TextStyle
|
||||
|
|
@ -50,7 +64,7 @@ private fun oklch(l: Float, c: Float, h: Float, alpha: Float = 1.0f): Color {
|
|||
|
||||
// Automatically output in high-gamut Display P3 or standard sRGB depending on system support
|
||||
return with(Oklab) {
|
||||
Lab(l, a, b).toColor(ColorSpaces.DisplayP3).copy(alpha = alpha)
|
||||
Oklab.Lab(l, a, b).toColor(ColorSpaces.DisplayP3).copy(alpha = alpha)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -112,20 +126,13 @@ fun SettingsCard(
|
|||
.border(1.2.dp, glassBorder, RoundedCornerShape(24.dp))
|
||||
.padding(18.dp)
|
||||
) {
|
||||
ColumnScope(this).content()
|
||||
// Standard Column provides standard ColumnScope receiver to the child layout content slot
|
||||
Column(modifier = Modifier.fillMaxWidth()) {
|
||||
content()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Scope helper to enable ColumnScope receiver within SettingsCard
|
||||
class ColumnScope(private val boxScope: BoxScope) : ColumnScopeReceiver {
|
||||
@Composable
|
||||
fun content() {}
|
||||
}
|
||||
interface ColumnScopeReceiver {
|
||||
@Composable
|
||||
fun ColumnScope.content()
|
||||
}
|
||||
|
||||
/** Elegant modular Settings Row for displaying or editing values */
|
||||
@Composable
|
||||
fun SettingsOptionRow(
|
||||
|
|
|
|||
Loading…
Reference in a new issue