Merge the reviewed shell from main
This commit is contained in:
commit
5a0497c9ec
6 changed files with 58 additions and 8 deletions
|
|
@ -24,8 +24,10 @@ import androidx.compose.runtime.Composable
|
|||
import androidx.compose.runtime.LaunchedEffect
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.draw.drawBehind
|
||||
import androidx.compose.ui.draw.drawWithCache
|
||||
import androidx.compose.ui.geometry.CornerRadius
|
||||
import androidx.compose.ui.geometry.Offset
|
||||
import androidx.compose.ui.geometry.Size
|
||||
import androidx.compose.ui.graphics.PathEffect
|
||||
import androidx.compose.ui.graphics.drawscope.Stroke
|
||||
import androidx.compose.ui.platform.LocalDensity
|
||||
|
|
@ -108,10 +110,19 @@ fun SettingsRow(group: SettingsGroup, focused: Boolean, openRequests: Int?, modi
|
|||
@Composable
|
||||
private fun SettingsPill(label: String, focused: Boolean) {
|
||||
val foreground = if (focused) C.onFocus else C.dim
|
||||
Box(Modifier.height(S.settingsPillHeight).drawBehind {
|
||||
val stroke = WolfskinTokens.Focus.ringButtonRing.toPx()
|
||||
drawRoundRect(foreground.copy(alpha = .4f), cornerRadius = CornerRadius(WolfskinTokens.Radius.pill.toPx()), style = Stroke(stroke, pathEffect = PathEffect.dashPathEffect(floatArrayOf(stroke * 2, stroke * 2))))
|
||||
}.padding(horizontal = S.settingsPillPadding), contentAlignment = Alignment.Center) {
|
||||
val border = if (focused) S.settingsPillFocusedBorder else S.settingsPillBorder
|
||||
Box(Modifier.height(S.settingsPillHeight).drawWithCache {
|
||||
val stroke = S.settingsPillStroke.toPx()
|
||||
val inset = Offset(stroke / 2, stroke / 2)
|
||||
val bounds = Size(size.width - stroke, size.height - stroke)
|
||||
val outline = Stroke(stroke, pathEffect = PathEffect.dashPathEffect(
|
||||
floatArrayOf(stroke * S.settingsPillDashRatio, stroke * S.settingsPillDashGapRatio),
|
||||
))
|
||||
val radius = CornerRadius(WolfskinTokens.Radius.pill.toPx())
|
||||
onDrawBehind {
|
||||
drawRoundRect(border, topLeft = inset, size = bounds, cornerRadius = radius, style = outline)
|
||||
}
|
||||
}.padding(horizontal = S.settingsPillPadding + S.settingsPillStroke), contentAlignment = Alignment.Center) {
|
||||
Text(label, color = foreground, style = WolfskinTokens.Type.caption.copy(fontWeight = WolfskinTokens.Type.label.fontWeight))
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -266,6 +266,11 @@ object WolfskinTokens {
|
|||
val settingsRowGap = 12.0.dp
|
||||
val settingsIcon = 18.0.dp
|
||||
val settingsPillHeight = 20.0.dp
|
||||
val settingsPillStroke = 1.0.dp
|
||||
const val settingsPillDashRatio = 3.0f
|
||||
const val settingsPillDashGapRatio = 2.0f
|
||||
val settingsPillBorder = ComposeColor(0x38FFFFFF)
|
||||
val settingsPillFocusedBorder = ComposeColor(0x660B0B10)
|
||||
val settingsPillPadding = 8.0.dp
|
||||
val settingsPillGap = 6.0.dp
|
||||
val settingsChevron = 15.0.dp
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue