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

Getting an error "None of the following functions can be called with the arguments supplied."

@Composable
fun MainScreen() {
    Scaffold(topBar = { AppBar() } ) {
        Surface(modifier = Modifier
            .fillMaxSize()
            .padding(it)) {
            Column() {
                ProfileCard()
            }
        }
    }
}

@Composable
fun AppBar(){
    TopAppBar(
        title = { Text(text = "Hi")}
    ) {}
}

I’m getting 2 error

I’m trying to add a TopAppBar but if i give a composable for title or navigationIcon I get this error

>Solution :

it should be

@Composable
fun AppBar(){

 TopAppBar( title = { Text("Hi")},)
}
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