'Compose Appbar overlaps activity content

see image,Card overlapping the appbar

im still learning compose.in this prototype im buiding,my Column containing the card views,in this case 1 dummy card,is overlapping with the appbar. i have tried using scaffold too,same result

here is the Card code:

@Composable
fun DiaryCard(){
val bs = "filler text,strings,anything "+
        "jadsjjadj adsnjasjd d saasd" +" sadsad asdasd adsasda" +
        "sasdasdas dsa d"



   Column {
   
   Spacer(modifier = Modifier.padding(top = 6.dp))
   Card(modifier = Modifier
       .fillMaxWidth()
       .padding(13.dp),
       shape = MaterialTheme.shapes.small,
       elevation = 5.dp, backgroundColor = Color.White){


       Row(modifier = Modifier.padding(bottom = 2.dp)){

           Text(text = "29 Sept. 2019", modifier = Modifier
               .fillMaxWidth(0.75F)
               .padding(start = 1.5.dp),color = Color.Black)



       }
       Divider()
       Spacer(modifier = Modifier.padding(bottom = 3.dp,top = 2.dp))
       Column(modifier = Modifier.fillMaxWidth()) {
           Text(text = "today was a good day",color = Color.Black)
           Spacer(modifier = Modifier.padding(bottom = 3.dp))
           Text(text = bs, color = Color.Black)
       }

       }
   }
}

The Appbar:

    @Composable
     fun topAppbar(){
       TopAppBar(backgroundColor = Color.DarkGray) {

      }
     }


Solution 1:[1]

You can use innerPadding,

 Scaffold(
    topBar = {
        TopAppBar(
            title = {
                Text(
                    ...
                )
            },
            navigationIcon = {
                IconButton(onClick = { }) {
                    Icon(imageVector = Icons.Default.Menu, contentDescription = "Menu Icon" )
                }
            },
            backgroundColor = colorResource(id = R.color.purple_200),
            contentColor = Color.White,
            elevation = 12.dp
        )
    },

){
    innerPadding ->
    Box(modifier = Modifier.padding(innerPadding)){
        DiaryCard()
    }
}

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1