Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

I cannot use TextField() in jetpack Compose(Material 3)

@Composable
fun EditNumberField() {
    TextField(value = "", onValueChange = {}){
        
    }
}

It says Unresolved reference: TextField.

I want a TextField so that the user can enter a value but it is showing an error.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

Check your dependencies in the build.gradle file. You have to add the library:

implementation "androidx.compose.material3:material3:$material3_version"

Also check your import statements in your class:

import androidx.compose.material3

If you are using M2 and M3 together avoid this kind of import of both packages together:

import androidx.compose.material.*
import androidx.compose.material3.*
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading