abbic
04/04/2022, 8:55 AMBottomSheetScaffold(
scaffoldState = scaffoldState,
topBar = {
//***
},
content = {
//***
},
sheetContent = {
//***
},
sheetShape = RoundedCornerShape(topStart = 16.dp, topEnd = 16.dp),
sheetElevation = 16.dp
)
andrew
04/04/2022, 3:20 PMfun Modifier.coloredShadow(
color: Color,
shape: Shape,
alpha: Float = 0.2F,
shadowRadius: Dp = 0.dp,
offsetY: Dp = 0.dp,
offsetX: Dp = 0.dp,
) = composed {
val density = LocalDensity.current
val shadowColor = remember(color, alpha) { color.copy(alpha).toArgb() }
val paint = remember(shadowRadius, offsetX, offsetY, shadowColor, density) { Paint().apply {
val frameworkPaint = asFrameworkPaint()
with(density) {
frameworkPaint.color = Color.Transparent.toArgb()
frameworkPaint.setShadowLayer(
shadowRadius.toPx(),
offsetX.toPx(),
offsetY.toPx(),
shadowColor
)
}
}}
drawBehind {
drawIntoCanvas {
it.drawOutline(
shape.createOutline(size, layoutDirection, density),
paint
)
}
}
}
abbic
04/04/2022, 3:30 PMandrew
04/04/2022, 3:30 PMabbic
04/04/2022, 3:30 PMandrew
04/04/2022, 3:32 PMabbic
04/04/2022, 3:32 PMandrew
04/04/2022, 3:33 PMval shadowModifier = Modifier.coloredShadow(
Color.Black, shape, offsetY = (-4).dp, shadowRadius = 2.dp, alpha = 0.12F
)
abbic
04/04/2022, 3:35 PMandrew
04/04/2022, 3:36 PM