Pantrix UI

Diagnostics Inspector

Shows over an app what its theme's diagnostics have found: a button with the number of findings, and on its press a sheet that lists them, each with its check, where it was found and what puts it right. A finding chosen in the list is outlined where its node stands, until the screen is next pressed. While nothing has been found, nothing is shown.

import com.pantrixui.components.overlay.inspector.PantrixDiagnosticsInspector

Examples

Over a screen

A screen with two findings: a button in a pale colour and an icon button with a blank name. Press the button at the bottom right, and choose a finding in the list: its node is outlined.

val findings = remember { PantrixFindings() }
PantrixTheme(diagnostics = findings) {
    PantrixDiagnosticsInspector(findings, modifier = Modifier.height(240.dp), tagKey = "orders") {
        Screen(tagKey = "orders")
    }
}

@Composable
private fun Screen(tagKey: String) {
    PantrixCard(modifier = Modifier.fillMaxSize(), variant = CardVariant.Outlined) {
        Column(verticalArrangement = Arrangement.spacedBy(PantrixTheme.spacing.sm)) {
            PantrixText(text = "Orders", style = PantrixTheme.typography.headline)
            PantrixText(text = "Three orders are waiting to be sent.")
            PantrixButton(
                text = "Send",
                onClick = {},
                modifier = Modifier.fillMaxWidth(),
                colors = ButtonColors(container = Color(0xFFFFE082), content = Color.White),
                tagKey = "${tagKey}_send"
            )
            PantrixIconButton(
                imageVector = PantrixIcons.MoreHorizontal,
                contentDescription = "",
                onClick = {},
                tagKey = "${tagKey}_more"
            )
        }
    }
}

Its button at the top

The button at the top, where it can stand beside a bar's actions.

val findings = remember { PantrixFindings() }
PantrixTheme(diagnostics = findings) {
    PantrixDiagnosticsInspector(
        findings,
        modifier = Modifier.height(240.dp),
        alignment = Alignment.TopEnd,
        tagKey = "orders_top"
    ) {
        Screen(tagKey = "orders_top")
    }
}

@Composable
private fun Screen(tagKey: String) {
    PantrixCard(modifier = Modifier.fillMaxSize(), variant = CardVariant.Outlined) {
        Column(verticalArrangement = Arrangement.spacedBy(PantrixTheme.spacing.sm)) {
            PantrixText(text = "Orders", style = PantrixTheme.typography.headline)
            PantrixText(text = "Three orders are waiting to be sent.")
            PantrixButton(
                text = "Send",
                onClick = {},
                modifier = Modifier.fillMaxWidth(),
                colors = ButtonColors(container = Color(0xFFFFE082), content = Color.White),
                tagKey = "${tagKey}_send"
            )
            PantrixIconButton(
                imageVector = PantrixIcons.MoreHorizontal,
                contentDescription = "",
                onClick = {},
                tagKey = "${tagKey}_more"
            )
        }
    }
}

API

findings

Shows over an app what its theme's diagnostics have found: a button with the number of findings, and on its press a sheet that lists them, each with its check, where it was found and what puts it right. A finding chosen in the list is outlined where its node stands, until the screen is next pressed. While nothing has been found, nothing is shown.

ParameterTypeDefaultWhat it is
findingsPantrixFindingswhat the theme's diagnostics have found: the diagnostics of the theme around content.
modifierModifierModifierapplied to the box that holds content and the inspector over it.
alignmentAlignmentAlignment.BottomEndwhere the button stands over content.
tagKeyString?nulla locale-independent key for automation: the inspector's tag is DiagnosticsInspector_<tagKey>, and its button's, its list's and its findings' are made from the key.
content@Composable () -> Unitthe app's screen.