Skip to main content

Module stepper

Module stepper 

Source
Expand description

Stepper — a modern, embeddable step-flow widget (Material/Ant/Flutter “stepper”), and Wizard, a thin modal launcher built on it.

A stepper shows a visible step-indicator strip above (or beside) a content area driven by a Switcher, with a footer of Back / Skip / Help / Next / Finish controls. It supports linear and non-linear (clickable) navigation, optional + skippable steps, per step validation gating, a generic chrome slot, and a StepperController handle for programmatic reset / jump / introspection.

§Data flow

The application owns its form state as Signals. A step’s content factory captures clones of those signals (write side); Step::complete_when derives the Next gate from the same signals; and Stepper::on_finish reads them back — plus the StepperController for per-step introspection (visited / skipped) — to branch on the choices made. There is no QVariant field registry: plain shared signals are the cross-step channel.

#[derive(Clone)]
struct Form { name: Signal<String>, plan: Signal<Plan> }
let form = Form { name: Signal::new(String::new()), plan: Signal::new(Plan::Free) };

Stepper::new()
    .step(Step::new(lit!("Account"))
        .content({ let f = form.clone(); move || TextInput::new().text(f.name.clone()) })
        .complete_when(form.name.map(|n| !n.is_empty())))
    .step(Step::new(lit!("Plan"))
        .content({ let f = form.clone(); move || plan_picker(f.plan.clone()) }))
    .on_finish({ let f = form.clone(); move |_ctx, ctrl| {
        match f.plan.get() { Plan::Free => {/* … */} Plan::Pro => {/* … */} }
        let _ = ctrl.skipped(1);
    }});

Structs§

Step
One page in a Stepper.
Stepper
An embeddable multi-step flow widget. See the module docs for the data-flow pattern and a usage example.
StepperController
Shared handle controlling a Stepper.
Wizard
A button (or custom trigger) that opens a modal Stepper.

Enums§

ChromePosition
Where the optional chrome slot (banner / sidebar) sits relative to the stepper body.
FinishOutcome
What an on_finish callback decided.
StepStatus
Lifecycle state of a single step, surfaced in the indicator strip and (for the active step) as aria-current="step".
StepperOrientation
Indicator-strip orientation for a Stepper.

Traits§

IntoFinishOutcome
Return-type bridge for Stepper::on_finish / Wizard::on_finish callbacks, so the same setter accepts a callback that cannot fail and one that can.