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

View File

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

View File

@@ -1,5 +1,12 @@
package org.nsh07.pomodoro.ui.theme 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 import androidx.compose.ui.graphics.Color
val Purple80 = Color(0xFFD0BCFF) val Purple80 = Color(0xFFD0BCFF)
@@ -8,4 +15,18 @@ val Pink80 = Color(0xFFEFB8C8)
val Purple40 = Color(0xFF6650a4) val Purple40 = Color(0xFF6650a4)
val PurpleGrey40 = Color(0xFF625b71) 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)
}