Type mismatch: inferred type is Dp but CardElevation was expected in Jetpack Compose

2.1k views Asked by At

Started learning Jetpack Compose. An error occurred: Type mismatch: inferred type is Dp but CardElevation was expected, I can't understand what the problem is, tell me how to solve it. enter image description here

import androidx.compose.ui.unit.dp library imported, and updated versions of Jetpack Compose, expected to help

1

There are 1 answers

0
Code Poet On

If you are using Material 3, then you need to use CardElevation in this way:

elevation = CardDefaults.cardElevation(defaultElevation = 5.dp) 

More details here