@Composable
fun PokemonScreen() {
Column(modifier = Modifier.fillMaxSize()) {
Topbar()
Canvas(modifier = Modifier.fillMaxSize()){
drawCircle(color = Color.LightGray, radius = 100.dp.toPx())
drawImage(ImageBitmap.imageResource(id = R.drawable.pokemonimg))
}
}
}
The error which I am facing: under “imageResource” is:
@Composable invocations can only happen from the context of a @Composable function
Screenshot
I followed the instructions shown in android developers website.
https://developer.android.com/develop/ui/compose/graphics/draw/overview#draw-image
Still I am getting the error.