Add dynamic theme (#159)
This commit is contained in:
@@ -153,9 +153,9 @@ fun TextFieldDialog(
|
||||
)
|
||||
|
||||
ChunkyButton(
|
||||
backgroundColor = colorPalette.primaryContainer,
|
||||
backgroundColor = colorPalette.accent,
|
||||
text = doneText,
|
||||
textStyle = typography.xs.semiBold.color(colorPalette.onPrimaryContainer),
|
||||
textStyle = typography.xs.semiBold.color(colorPalette.onAccent),
|
||||
shape = RoundedCornerShape(36.dp),
|
||||
onClick = {
|
||||
if (isTextInputValid(textFieldValue.text)) {
|
||||
@@ -210,9 +210,9 @@ fun ConfirmationDialog(
|
||||
)
|
||||
|
||||
ChunkyButton(
|
||||
backgroundColor = colorPalette.primaryContainer,
|
||||
backgroundColor = colorPalette.accent,
|
||||
text = confirmText,
|
||||
textStyle = typography.xs.semiBold.color(colorPalette.onPrimaryContainer),
|
||||
textStyle = typography.xs.semiBold.color(colorPalette.onAccent),
|
||||
shape = RoundedCornerShape(36.dp),
|
||||
onClick = {
|
||||
onConfirm()
|
||||
@@ -242,7 +242,7 @@ inline fun DefaultDialog(
|
||||
modifier = modifier
|
||||
.padding(all = 48.dp)
|
||||
.background(
|
||||
color = colorPalette.elevatedBackground,
|
||||
color = colorPalette.background1,
|
||||
shape = RoundedCornerShape(8.dp)
|
||||
)
|
||||
.padding(horizontal = 24.dp, vertical = 16.dp),
|
||||
@@ -268,7 +268,7 @@ inline fun <T> ValueSelectorDialog(
|
||||
modifier = modifier
|
||||
.padding(all = 48.dp)
|
||||
.background(
|
||||
color = colorPalette.elevatedBackground,
|
||||
color = colorPalette.background1,
|
||||
shape = RoundedCornerShape(8.dp)
|
||||
)
|
||||
.padding(vertical = 16.dp),
|
||||
@@ -305,12 +305,12 @@ inline fun <T> ValueSelectorDialog(
|
||||
modifier = Modifier
|
||||
.size(18.dp)
|
||||
.background(
|
||||
color = colorPalette.primaryContainer,
|
||||
color = colorPalette.accent,
|
||||
shape = CircleShape
|
||||
)
|
||||
) {
|
||||
drawCircle(
|
||||
color = colorPalette.onPrimaryContainer,
|
||||
color = colorPalette.onAccent,
|
||||
radius = 4.dp.toPx(),
|
||||
center = size.center,
|
||||
shadow = Shadow(
|
||||
|
||||
@@ -35,7 +35,7 @@ fun DropDownSection(content: @Composable ColumnScope.() -> Unit) {
|
||||
elevation = 2.dp,
|
||||
shape = RoundedCornerShape(16.dp)
|
||||
)
|
||||
.background(colorPalette.elevatedBackground)
|
||||
.background(colorPalette.background1)
|
||||
.width(IntrinsicSize.Max),
|
||||
content = content
|
||||
)
|
||||
@@ -60,14 +60,14 @@ fun DropDownTextItem(
|
||||
DropDownTextItem(
|
||||
text = text,
|
||||
textColor = if (isSelected) {
|
||||
colorPalette.onPrimaryContainer
|
||||
colorPalette.onAccent
|
||||
} else {
|
||||
colorPalette.textSecondary
|
||||
},
|
||||
backgroundColor = if (isSelected) {
|
||||
colorPalette.primaryContainer
|
||||
colorPalette.accent
|
||||
} else {
|
||||
colorPalette.elevatedBackground
|
||||
colorPalette.background1
|
||||
},
|
||||
onClick = onClick
|
||||
)
|
||||
@@ -95,7 +95,7 @@ fun DropDownTextItem(
|
||||
interactionSource = remember { MutableInteractionSource() },
|
||||
onClick = onClick
|
||||
)
|
||||
.background(backgroundColor ?: colorPalette.elevatedBackground)
|
||||
.background(backgroundColor ?: colorPalette.background1)
|
||||
.fillMaxWidth()
|
||||
.widthIn(min = 124.dp, max = 248.dp)
|
||||
.padding(
|
||||
|
||||
@@ -536,9 +536,9 @@ fun MediaItemMenu(
|
||||
)
|
||||
|
||||
ChunkyButton(
|
||||
backgroundColor = colorPalette.primaryContainer,
|
||||
backgroundColor = colorPalette.accent,
|
||||
text = "Set",
|
||||
textStyle = typography.xs.semiBold.color(colorPalette.onPrimaryContainer),
|
||||
textStyle = typography.xs.semiBold.color(colorPalette.onAccent),
|
||||
shape = RoundedCornerShape(36.dp),
|
||||
isEnabled = hours > 0 || minutes > 0,
|
||||
onClick = {
|
||||
|
||||
@@ -44,7 +44,7 @@ inline fun Menu(
|
||||
.verticalScroll(rememberScrollState())
|
||||
.fillMaxWidth()
|
||||
.background(
|
||||
color = colorPalette.elevatedBackground,
|
||||
color = colorPalette.background1,
|
||||
shape = RoundedCornerShape(topStart = 16.dp, topEnd = 16.dp)
|
||||
)
|
||||
.padding(top = 8.dp)
|
||||
|
||||
@@ -26,8 +26,8 @@ fun Switch(
|
||||
) {
|
||||
val (colorPalette) = LocalAppearance.current
|
||||
|
||||
val backgroundColor by animateColorAsState(if (isChecked) colorPalette.primaryContainer else colorPalette.lightBackground)
|
||||
val color by animateColorAsState(if (isChecked) colorPalette.onPrimaryContainer else colorPalette.textDisabled)
|
||||
val backgroundColor by animateColorAsState(if (isChecked) colorPalette.accent else colorPalette.background1)
|
||||
val color by animateColorAsState(if (isChecked) colorPalette.onAccent else colorPalette.textDisabled)
|
||||
val offset by animateDpAsState(if (isChecked) 36.dp else 12.dp)
|
||||
|
||||
Spacer(
|
||||
|
||||
@@ -13,6 +13,7 @@ import androidx.compose.material.ripple.rememberRipple
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.remember
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.graphics.ColorFilter
|
||||
import androidx.compose.ui.res.painterResource
|
||||
import androidx.compose.ui.text.style.TextAlign
|
||||
@@ -41,14 +42,14 @@ fun TextCard(
|
||||
enabled = onClick != null,
|
||||
onClick = onClick ?: {}
|
||||
)
|
||||
.background(colorPalette.lightBackground)
|
||||
.background(colorPalette.background1)
|
||||
.padding(horizontal = 16.dp, vertical = 16.dp)
|
||||
) {
|
||||
icon?.let {
|
||||
Image(
|
||||
painter = painterResource(icon),
|
||||
contentDescription = null,
|
||||
colorFilter = iconColor ?: ColorFilter.tint(colorPalette.red),
|
||||
colorFilter = iconColor ?: ColorFilter.tint(Color.Red),
|
||||
modifier = Modifier
|
||||
.padding(bottom = 16.dp)
|
||||
.size(24.dp)
|
||||
|
||||
@@ -5,23 +5,24 @@ import androidx.compose.foundation.layout.Spacer
|
||||
import androidx.compose.foundation.layout.fillMaxWidth
|
||||
import androidx.compose.foundation.layout.height
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.foundation.shape.RoundedCornerShape
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.remember
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.unit.dp
|
||||
import it.vfsfitvnm.vimusic.ui.styling.LocalAppearance
|
||||
import it.vfsfitvnm.vimusic.ui.styling.shimmer
|
||||
import kotlin.random.Random
|
||||
|
||||
@Composable
|
||||
fun TextPlaceholder(
|
||||
modifier: Modifier = Modifier
|
||||
modifier: Modifier = Modifier,
|
||||
color: Color = LocalAppearance.current.colorPalette.shimmer
|
||||
) {
|
||||
val (colorPalette) = LocalAppearance.current
|
||||
Spacer(
|
||||
modifier = modifier
|
||||
.padding(vertical = 4.dp)
|
||||
.background(color = colorPalette.darkGray, shape = RoundedCornerShape(0.dp))
|
||||
.background(color)
|
||||
.fillMaxWidth(remember { 0.25f + Random.nextFloat() * 0.5f })
|
||||
.height(16.dp)
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user