Audit: hardcoded Color.* → MaterialTheme.colorScheme (dark-mode parity)
Replaces ~31 literal Color.White / Color.Red / Color.Gray / Color(0x…) usages in production screens with theme-aware colorScheme roles. Fixes dark-mode regressions on those surfaces. Covers: DocumentCard, DocumentStates, DocumentDetailScreen, ContractorDetailScreen (delete/favorite tints), AddContractorDialog (FilterChip, Switch, dialog container). Overlay-specific Color.Black/Color.White (e.g., photo-grid darkening overlay) and theme-defined brand tokens (OrganicDesign, ThemeColors) are left untouched per spec. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -321,8 +321,8 @@ fun AddContractorDialog(
|
||||
},
|
||||
label = { Text(specialty.name) },
|
||||
colors = FilterChipDefaults.filterChipColors(
|
||||
selectedContainerColor = Color(0xFF3B82F6),
|
||||
selectedLabelColor = Color.White
|
||||
selectedContainerColor = MaterialTheme.colorScheme.primary,
|
||||
selectedLabelColor = MaterialTheme.colorScheme.onPrimary
|
||||
)
|
||||
)
|
||||
}
|
||||
@@ -438,8 +438,8 @@ fun AddContractorDialog(
|
||||
checked = isFavorite,
|
||||
onCheckedChange = { isFavorite = it },
|
||||
colors = SwitchDefaults.colors(
|
||||
checkedThumbColor = Color.White,
|
||||
checkedTrackColor = Color(0xFF3B82F6)
|
||||
checkedThumbColor = MaterialTheme.colorScheme.onPrimary,
|
||||
checkedTrackColor = MaterialTheme.colorScheme.primary
|
||||
)
|
||||
)
|
||||
}
|
||||
@@ -511,7 +511,7 @@ fun AddContractorDialog(
|
||||
if (createState is ApiResult.Loading || updateState is ApiResult.Loading) {
|
||||
CircularProgressIndicator(
|
||||
modifier = Modifier.size(20.dp),
|
||||
color = Color.White,
|
||||
color = MaterialTheme.colorScheme.onPrimary,
|
||||
strokeWidth = 2.dp
|
||||
)
|
||||
} else {
|
||||
@@ -527,7 +527,7 @@ fun AddContractorDialog(
|
||||
Text(cancelText, color = Color(0xFF6B7280))
|
||||
}
|
||||
},
|
||||
containerColor = Color.White,
|
||||
containerColor = MaterialTheme.colorScheme.surface,
|
||||
shape = RoundedCornerShape(AppRadius.lg)
|
||||
)
|
||||
}
|
||||
|
||||
@@ -69,7 +69,7 @@ private fun WarrantyCardContent(document: Document, onClick: () -> Unit) {
|
||||
Text(
|
||||
itemName,
|
||||
style = MaterialTheme.typography.bodyMedium,
|
||||
color = Color.Gray,
|
||||
color = MaterialTheme.colorScheme.onSurfaceVariant,
|
||||
maxLines = 1,
|
||||
overflow = TextOverflow.Ellipsis
|
||||
)
|
||||
@@ -102,11 +102,11 @@ private fun WarrantyCardContent(document: Document, onClick: () -> Unit) {
|
||||
horizontalArrangement = Arrangement.SpaceBetween
|
||||
) {
|
||||
Column {
|
||||
Text("Provider", style = MaterialTheme.typography.labelSmall, color = Color.Gray)
|
||||
Text("Provider", style = MaterialTheme.typography.labelSmall, color = MaterialTheme.colorScheme.onSurfaceVariant)
|
||||
Text(document.provider ?: "N/A", style = MaterialTheme.typography.bodyMedium, fontWeight = FontWeight.Medium)
|
||||
}
|
||||
Column(horizontalAlignment = Alignment.End) {
|
||||
Text("Expires", style = MaterialTheme.typography.labelSmall, color = Color.Gray)
|
||||
Text("Expires", style = MaterialTheme.typography.labelSmall, color = MaterialTheme.colorScheme.onSurfaceVariant)
|
||||
Text(document.endDate ?: "N/A", style = MaterialTheme.typography.bodyMedium, fontWeight = FontWeight.Medium)
|
||||
}
|
||||
}
|
||||
@@ -195,7 +195,7 @@ private fun RegularDocumentCardContent(document: Document, onClick: () -> Unit)
|
||||
Text(
|
||||
document.description,
|
||||
style = MaterialTheme.typography.bodySmall,
|
||||
color = Color.Gray,
|
||||
color = MaterialTheme.colorScheme.onSurfaceVariant,
|
||||
maxLines = 2,
|
||||
overflow = TextOverflow.Ellipsis
|
||||
)
|
||||
@@ -231,7 +231,7 @@ private fun RegularDocumentCardContent(document: Document, onClick: () -> Unit)
|
||||
Icon(
|
||||
Icons.Default.ChevronRight,
|
||||
contentDescription = null, // decorative
|
||||
tint = Color.Gray
|
||||
tint = MaterialTheme.colorScheme.onSurfaceVariant
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,9 +22,9 @@ fun EmptyState(
|
||||
horizontalAlignment = Alignment.CenterHorizontally,
|
||||
verticalArrangement = Arrangement.Center
|
||||
) {
|
||||
Icon(icon, contentDescription = null, modifier = Modifier.size(64.dp) , tint = Color.Gray) // decorative
|
||||
Icon(icon, contentDescription = null, modifier = Modifier.size(64.dp) , tint = MaterialTheme.colorScheme.onSurfaceVariant) // decorative
|
||||
Spacer(modifier = Modifier.height(16.dp))
|
||||
Text(message, style = MaterialTheme.typography.titleMedium, color = Color.Gray)
|
||||
Text(message, style = MaterialTheme.typography.titleMedium, color = MaterialTheme.colorScheme.onSurfaceVariant)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,9 +35,9 @@ fun ErrorState(message: String, onRetry: () -> Unit) {
|
||||
horizontalAlignment = Alignment.CenterHorizontally,
|
||||
verticalArrangement = Arrangement.Center
|
||||
) {
|
||||
Icon(Icons.Default.Error, contentDescription = "Error", modifier = Modifier.size(64.dp) , tint = Color.Red)
|
||||
Icon(Icons.Default.Error, contentDescription = "Error", modifier = Modifier.size(64.dp) , tint = MaterialTheme.colorScheme.error)
|
||||
Spacer(modifier = Modifier.height(16.dp))
|
||||
Text(message, style = MaterialTheme.typography.bodyLarge, color = Color.Gray)
|
||||
Text(message, style = MaterialTheme.typography.bodyLarge, color = MaterialTheme.colorScheme.onSurfaceVariant)
|
||||
Spacer(modifier = Modifier.height(16.dp))
|
||||
OutlinedButton(onClick = onRetry) {
|
||||
Text("Retry")
|
||||
|
||||
@@ -113,7 +113,7 @@ fun ContractorDetailScreen(
|
||||
Icon(
|
||||
if (state.data.isFavorite) Icons.Default.Star else Icons.Default.StarOutline,
|
||||
stringResource(Res.string.contractors_toggle_favorite),
|
||||
tint = if (state.data.isFavorite) Color(0xFFF59E0B) else LocalContentColor.current
|
||||
tint = if (state.data.isFavorite) MaterialTheme.colorScheme.tertiary else LocalContentColor.current
|
||||
)
|
||||
}
|
||||
IconButton(
|
||||
@@ -126,7 +126,7 @@ fun ContractorDetailScreen(
|
||||
onClick = { showDeleteConfirmation = true },
|
||||
modifier = Modifier.testTag(AccessibilityIds.Contractor.deleteButton)
|
||||
) {
|
||||
Icon(Icons.Default.Delete, stringResource(Res.string.common_delete), tint = Color(0xFFEF4444))
|
||||
Icon(Icons.Default.Delete, stringResource(Res.string.common_delete), tint = MaterialTheme.colorScheme.error)
|
||||
}
|
||||
}
|
||||
else -> {}
|
||||
@@ -238,7 +238,7 @@ fun ContractorDetailScreen(
|
||||
if (index < contractor.rating.toInt()) Icons.Default.Star else Icons.Default.StarOutline,
|
||||
contentDescription = null, // decorative
|
||||
modifier = Modifier.size(20.dp),
|
||||
tint = Color(0xFFF59E0B)
|
||||
tint = MaterialTheme.colorScheme.tertiary
|
||||
)
|
||||
}
|
||||
Spacer(modifier = Modifier.width(OrganicSpacing.small))
|
||||
@@ -306,7 +306,7 @@ fun ContractorDetailScreen(
|
||||
QuickActionButton(
|
||||
icon = Icons.Default.Language,
|
||||
label = stringResource(Res.string.contractors_website),
|
||||
color = Color(0xFFF59E0B),
|
||||
color = MaterialTheme.colorScheme.tertiary,
|
||||
modifier = Modifier.weight(1f),
|
||||
onClick = {
|
||||
try {
|
||||
@@ -321,7 +321,7 @@ fun ContractorDetailScreen(
|
||||
QuickActionButton(
|
||||
icon = Icons.Default.Map,
|
||||
label = stringResource(Res.string.contractors_directions),
|
||||
color = Color(0xFFEF4444),
|
||||
color = MaterialTheme.colorScheme.error,
|
||||
modifier = Modifier.weight(1f),
|
||||
onClick = {
|
||||
try {
|
||||
@@ -376,7 +376,7 @@ fun ContractorDetailScreen(
|
||||
icon = Icons.Default.Language,
|
||||
label = stringResource(Res.string.contractors_website),
|
||||
value = website,
|
||||
iconTint = Color(0xFFF59E0B),
|
||||
iconTint = MaterialTheme.colorScheme.tertiary,
|
||||
onClick = {
|
||||
try {
|
||||
val url = if (website.startsWith("http")) website else "https://$website"
|
||||
@@ -422,7 +422,7 @@ fun ContractorDetailScreen(
|
||||
icon = Icons.Default.LocationOn,
|
||||
label = stringResource(Res.string.contractors_location),
|
||||
value = fullAddress,
|
||||
iconTint = Color(0xFFEF4444),
|
||||
iconTint = MaterialTheme.colorScheme.error,
|
||||
onClick = {
|
||||
try {
|
||||
val address = listOfNotNull(
|
||||
@@ -469,7 +469,7 @@ fun ContractorDetailScreen(
|
||||
Icons.Default.Notes,
|
||||
contentDescription = null, // decorative
|
||||
modifier = Modifier.size(20.dp),
|
||||
tint = Color(0xFFF59E0B)
|
||||
tint = MaterialTheme.colorScheme.tertiary
|
||||
)
|
||||
Text(
|
||||
text = contractor.notes,
|
||||
@@ -502,7 +502,7 @@ fun ContractorDetailScreen(
|
||||
icon = Icons.Default.Star,
|
||||
value = ((contractor.rating * 10).toInt() / 10.0).toString(),
|
||||
label = stringResource(Res.string.contractors_average_rating),
|
||||
color = Color(0xFFF59E0B)
|
||||
color = MaterialTheme.colorScheme.tertiary
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -550,7 +550,7 @@ fun ContractorDetailScreen(
|
||||
if (showDeleteConfirmation) {
|
||||
AlertDialog(
|
||||
onDismissRequest = { showDeleteConfirmation = false },
|
||||
icon = { Icon(Icons.Default.Warning, null, tint = Color(0xFFEF4444)) },
|
||||
icon = { Icon(Icons.Default.Warning, null, tint = MaterialTheme.colorScheme.error) },
|
||||
title = { Text(stringResource(Res.string.contractors_delete)) },
|
||||
text = { Text(stringResource(Res.string.contractors_delete_warning)) },
|
||||
confirmButton = {
|
||||
@@ -559,7 +559,7 @@ fun ContractorDetailScreen(
|
||||
viewModel.deleteContractor(contractorId)
|
||||
showDeleteConfirmation = false
|
||||
},
|
||||
colors = ButtonDefaults.buttonColors(containerColor = Color(0xFFEF4444))
|
||||
colors = ButtonDefaults.buttonColors(containerColor = MaterialTheme.colorScheme.error)
|
||||
) {
|
||||
Text(stringResource(Res.string.common_delete))
|
||||
}
|
||||
|
||||
@@ -102,7 +102,7 @@ fun DocumentDetailScreen(
|
||||
modifier = Modifier.testTag(AccessibilityIds.Document.deleteButton),
|
||||
onClick = { showDeleteDialog = true }
|
||||
) {
|
||||
Icon(Icons.Default.Delete, stringResource(Res.string.common_delete), tint = Color.Red)
|
||||
Icon(Icons.Default.Delete, stringResource(Res.string.common_delete), tint = MaterialTheme.colorScheme.error)
|
||||
}
|
||||
}
|
||||
else -> {}
|
||||
@@ -156,7 +156,7 @@ fun DocumentDetailScreen(
|
||||
Text(
|
||||
stringResource(Res.string.documents_status),
|
||||
style = MaterialTheme.typography.labelMedium,
|
||||
color = Color.Gray
|
||||
color = MaterialTheme.colorScheme.onSurfaceVariant
|
||||
)
|
||||
Text(
|
||||
when {
|
||||
@@ -175,7 +175,7 @@ fun DocumentDetailScreen(
|
||||
Text(
|
||||
stringResource(Res.string.documents_days_remaining),
|
||||
style = MaterialTheme.typography.labelMedium,
|
||||
color = Color.Gray
|
||||
color = MaterialTheme.colorScheme.onSurfaceVariant
|
||||
)
|
||||
Text(
|
||||
"$daysUntilExpiration",
|
||||
@@ -450,7 +450,7 @@ fun DocumentDetailScreen(
|
||||
showDeleteDialog = false
|
||||
}
|
||||
) {
|
||||
Text(stringResource(Res.string.common_delete), color = Color.Red)
|
||||
Text(stringResource(Res.string.common_delete), color = MaterialTheme.colorScheme.error)
|
||||
}
|
||||
},
|
||||
dismissButton = {
|
||||
@@ -480,7 +480,7 @@ fun DetailRow(label: String, value: String) {
|
||||
Text(
|
||||
label,
|
||||
style = MaterialTheme.typography.labelMedium,
|
||||
color = Color.Gray
|
||||
color = MaterialTheme.colorScheme.onSurfaceVariant
|
||||
)
|
||||
Spacer(modifier = Modifier.height(OrganicSpacing.xs))
|
||||
Text(
|
||||
|
||||
Reference in New Issue
Block a user