feat: Update list item colors to more closely match M3 expressive spec

This commit is contained in:
Nishant Mishra
2025-09-02 20:31:18 +05:30
parent d37c26c778
commit 1023fd53d8
3 changed files with 29 additions and 4 deletions

View File

@@ -24,6 +24,7 @@ import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import org.nsh07.pomodoro.ui.theme.AppFonts.openRundeClock
import org.nsh07.pomodoro.ui.theme.CustomColors.listItemColors
@OptIn(ExperimentalMaterial3ExpressiveApi::class)
@Composable
@@ -59,7 +60,7 @@ fun MinuteInputField(
.background(
animateColorAsState(
if (state.text.isNotEmpty())
colorScheme.surface
listItemColors.containerColor
else colorScheme.errorContainer,
motionScheme.defaultEffectsSpec()
).value,

View File

@@ -60,6 +60,8 @@ import androidx.lifecycle.viewmodel.compose.viewModel
import org.nsh07.pomodoro.R
import org.nsh07.pomodoro.ui.settingsScreen.viewModel.SettingsViewModel
import org.nsh07.pomodoro.ui.theme.AppFonts.robotoFlexTopBar
import org.nsh07.pomodoro.ui.theme.CustomColors.listItemColors
import org.nsh07.pomodoro.ui.theme.CustomColors.topBarColors
import org.nsh07.pomodoro.ui.theme.TomatoTheme
@OptIn(ExperimentalMaterial3Api::class)
@@ -120,7 +122,7 @@ private fun SettingsScreen(
)
},
subtitle = {},
colors = TopAppBarDefaults.topAppBarColors(containerColor = colorScheme.surfaceContainer),
colors = topBarColors,
titleHorizontalAlignment = Alignment.CenterHorizontally,
scrollBehavior = scrollBehavior
)
@@ -128,7 +130,7 @@ private fun SettingsScreen(
LazyColumn(
verticalArrangement = Arrangement.spacedBy(2.dp),
modifier = Modifier
.background(colorScheme.surfaceContainer)
.background(topBarColors.containerColor)
.fillMaxSize()
.padding(horizontal = 16.dp)
) {
@@ -221,6 +223,7 @@ private fun SettingsScreen(
)
}
},
colors = listItemColors,
modifier = Modifier.clip(shapes.large)
)
}

View File

@@ -1,5 +1,12 @@
package org.nsh07.pomodoro.ui.theme
import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.ListItemColors
import androidx.compose.material3.ListItemDefaults
import androidx.compose.material3.MaterialTheme.colorScheme
import androidx.compose.material3.TopAppBarColors
import androidx.compose.material3.TopAppBarDefaults
import androidx.compose.runtime.Composable
import androidx.compose.ui.graphics.Color
val Purple80 = Color(0xFFD0BCFF)
@@ -8,4 +15,18 @@ val Pink80 = Color(0xFFEFB8C8)
val Purple40 = Color(0xFF6650a4)
val PurpleGrey40 = Color(0xFF625b71)
val Pink40 = Color(0xFF7D5260)
val Pink40 = Color(0xFF7D5260)
object CustomColors {
@OptIn(ExperimentalMaterial3Api::class)
val topBarColors: TopAppBarColors
@Composable get() {
return TopAppBarDefaults.topAppBarColors(
containerColor = colorScheme.surfaceContainer,
scrolledContainerColor = colorScheme.surfaceContainer
)
}
val listItemColors: ListItemColors
@Composable get() = ListItemDefaults.colors(containerColor = colorScheme.surfaceBright)
}