diagnostics-list
Builds DiagnosticsList List


The code that drew it
A still frame holds a repeating animation at its first frame and a one-shot at its last, because a still of a moving thing is not reproducible. Run the gallery to review motion.
fn diagnostics_surface(_window: &mut Window, cx: &mut App) -> AnyElement {
let theme = cx.theme().clone();
let diagnostics = [
Diagnostic::new(
"fixture-error",
DiagnosticSeverity::Error,
DiagnosticLocation::new("fixture.rs:18"),
"Fixture diagnostic: incompatible value",
)
.action(DiagnosticAction::new("inspect", "Inspect fixture")),
Diagnostic::new(
"fixture-warning",
DiagnosticSeverity::Warning,
DiagnosticLocation::new("fixture.rs:31"),
"Fixture diagnostic: unused declaration",
),
Diagnostic::new(
"fixture-information",
DiagnosticSeverity::Information,
DiagnosticLocation::new("fixture.rs:47"),
"Fixture diagnostic: a simpler form is available",
),
Diagnostic::new(
"fixture-hint",
DiagnosticSeverity::Hint,
DiagnosticLocation::new("fixture.rs:64"),
"Fixture diagnostic: consider a descriptive name",
),
];
stack(&theme)
.w(px(760.0))
.child(caption(
&theme,
"synthetic diagnostics; filters, selection, and actions are caller-owned intents",
))
.child(
DiagnosticsList::new("scene.diagnostics", Loadable::Ready(diagnostics.to_vec()))
.selected("fixture-warning")
.visible_rows(5)
.on_filter(|_, _, _| {})
.on_select(|_, _, _| {})
.on_action(|_, _, _, _| {}),
)
.into_any_element()
}