MaterialTheme() was declared twice. This was the reason for the duplication.
val colorScheme = when {
useDynamicColors && Build.VERSION.SDK_INT >= Build.VERSION_CODES.S -> {
if (useDarkTheme) dynamicDarkColorScheme(context = LocalContext.current)
else dynamicLightColorScheme(context = LocalContext.current)
}
useDarkTheme -> DarkColorScheme
else -> LightColorScheme
}
// superfluous code :
// MaterialTheme(
// colorScheme = colorScheme,
// content = content
// )
//
CompositionLocalProvider(
value = LocalRippleConfiguration provides RippleConfiguration(
rippleAlpha = RippleAlpha(
pressedAlpha = 0.5f,
focusedAlpha = 0.4f,
draggedAlpha = 0.4f,
hoveredAlpha = 0.4f
),
color = LACE
)
) {
MaterialTheme(
colorScheme = colorScheme,
content = content
)
}