inspectable
Functions summary
inline Modifier |
Modifier.This function is deprecated. This API will create more invalidations of your modifier than necessary, so it's use is discouraged. |
Cmn
|
Functions
Modifier.inspectable
inline fun Modifier.inspectable(
noinline inspectorInfo: InspectorInfo.() -> Unit,
factory: Modifier.() -> Modifier
): Modifier
Use this to group a common set of modifiers and provide InspectorInfo for the resulting modifier.
import androidx.compose.foundation.background import androidx.compose.foundation.shape.RoundedCornerShape import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.Color import androidx.compose.ui.platform.debugInspectorInfo import androidx.compose.ui.platform.inspectable import androidx.compose.ui.unit.Dp import androidx.compose.ui.unit.dp /** Sample with a single parameter */ fun Modifier.simpleFrame(color: Color) = inspectable( inspectorInfo = debugInspectorInfo { name = "simpleFrame" value = color } ) { background(color, RoundedCornerShape(5.0.dp)) } /** Sample with multiple parameters */ fun Modifier.fancyFrame(size: Dp, color: Color) = inspectable( inspectorInfo = debugInspectorInfo { name = "fancyFrame" properties["size"] = size properties["color"] = color } ) { background(color, RoundedCornerShape(size)) }