79354930

Date: 2025-01-14 12:09:44
Score: 0.5
Natty:
Report link

After discovering through testing that setting text colors in the typography of MaterialTheme would invalidate LocalContentColor, I removed them as shown in the following code. As a result, not only does LocalContentColor work properly now, but the colors parameter of TextField also functions correctly.

If you set colors on Typography, these colors from styles already bound to certain parts of Material components, such as TextField, will take precedence over the colors parameter of TextField or LocalContentColor

    MaterialTheme(
      colorScheme = colorScheme,
      typography = Typography(
        bodyMedium = TextStyle(
          color = Color.Black  // removed
        ),
        // ...
      ),
      content = content
    )
Reasons:
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Self-answer (0.5):
  • Low reputation (1):
Posted by: Inori