Home > Software design >  Getting an error "None of the following functions can be called with the arguments supplied.&qu
Getting an error "None of the following functions can be called with the arguments supplied.&qu

Time:01-04

@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

CodePudding user response:

it should be

@Composable
fun AppBar(){

 TopAppBar( title = { Text("Hi")},)
}
  • Related