Complete the code to create a rounded corner shape with 16.dp radius.
val shape = RoundedCornerShape([1])dp causes errors.The RoundedCornerShape constructor takes a corner radius. Using 16.dp creates a shape with 16 density-independent pixels rounded corners.
Complete the code to set a background color and shape to a Box composable.
Box(modifier = Modifier.background(color = Color.Blue, shape = [1]))CircleShape creates a circular shape for the background of the Box.
Fix the error in the code to clip a composable with a rounded shape.
Modifier.[1](RoundedCornerShape(12.dp))
background only sets color but does not clip.padding or border does not clip the shape.The clip modifier is used to apply a shape mask to a composable, clipping its content to that shape.
Fill both blanks to create a Box with a red background and a cut corner shape of 10.dp.
Box(modifier = Modifier.background(color = [1], shape = [2]))
Using Color.Red sets the background color to red, and CutCornerShape(10.dp) creates a shape with cut corners of 10.dp size.
Fill all three blanks to create a Surface with a blue color, rounded corners of 20.dp, and elevation of 8.dp.
Surface(color = [1], shape = [2], elevation = [3]) { // content here }
The Surface composable uses Color.Blue for background color, RoundedCornerShape(20.dp) for smooth corners, and 8.dp for elevation to cast a shadow.