Fix: Text coloring under MDC

This commit is contained in:
machiav3lli 2022-02-26 03:09:51 +01:00
parent 6a6958b7c3
commit 020a5dc239

View File

@ -4,14 +4,15 @@ import androidx.compose.foundation.background
import androidx.compose.foundation.clickable import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.* import androidx.compose.foundation.layout.*
import androidx.compose.foundation.shape.RoundedCornerShape import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material.ContentAlpha
import androidx.compose.material.LocalContentAlpha
import androidx.compose.material.icons.Icons import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.Favorite import androidx.compose.material.icons.filled.Favorite
import androidx.compose.material.icons.filled.FavoriteBorder import androidx.compose.material.icons.filled.FavoriteBorder
import androidx.compose.material3.* import androidx.compose.material3.*
import androidx.compose.material3.ButtonDefaults.buttonColors import androidx.compose.material3.ButtonDefaults.buttonColors
import androidx.compose.runtime.* import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.ui.Alignment import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip import androidx.compose.ui.draw.clip
@ -83,15 +84,14 @@ fun ProductRow(
style = MaterialTheme.typography.bodySmall style = MaterialTheme.typography.bodySmall
) )
} }
CompositionLocalProvider(LocalContentAlpha provides ContentAlpha.medium) { Text(
Text( modifier = Modifier.fillMaxHeight(),
modifier = Modifier.fillMaxHeight(), text = item.summary,
text = item.summary, style = MaterialTheme.typography.bodySmall,
style = MaterialTheme.typography.bodySmall, overflow = TextOverflow.Ellipsis,
overflow = TextOverflow.Ellipsis, maxLines = 2,
maxLines = 2 color = MaterialTheme.colorScheme.onSurfaceVariant
) )
}
} }
} }
} }
@ -136,17 +136,17 @@ fun ProductColumn(
text = item.name, text = item.name,
style = MaterialTheme.typography.bodySmall, style = MaterialTheme.typography.bodySmall,
overflow = TextOverflow.Ellipsis, overflow = TextOverflow.Ellipsis,
maxLines = 1 maxLines = 1,
color = MaterialTheme.colorScheme.onSurface
)
Text(
modifier = Modifier.padding(4.dp, 1.dp),
text = item.version,
style = MaterialTheme.typography.labelSmall,
overflow = TextOverflow.Ellipsis,
maxLines = 1,
color = MaterialTheme.colorScheme.onSurfaceVariant
) )
CompositionLocalProvider(LocalContentAlpha provides ContentAlpha.medium) {
Text(
modifier = Modifier.padding(4.dp, 1.dp),
text = item.version,
style = MaterialTheme.typography.labelSmall,
overflow = TextOverflow.Ellipsis,
maxLines = 1
)
}
} }
} }