Skip to main content

Module progress_bar

Module progress_bar 

Source
Expand description

ProgressBar โ€” a bar showing progress from 0.0 to 1.0.

Supports determinate (fixed or reactive value), indeterminate (animated sweep), horizontal, and vertical orientations. The stationary chrome (track and determinate fill) is delegated to ProgressBarStyle; the indeterminate sweep is widget-owned (motion infrastructure is not chrome). Three paint paths exist internally:

  • Horizontal indeterminate uses the shader-driven animated-quad pipeline. ProgressBar::build registers an AnimatedQuadHandle and mounts a single IndeterminateSweepLeaf whose paint() issues one draw_animated_quad per frame; the shader composes the track + moving fill in a procedural draw. The recipe frame is NOT mounted in this case (the shader self-paints both).
  • Vertical indeterminate keeps the signal-based path. The recipe frame paints the track; an IndeterminateSweepLeaf in signal mode paints a moving fill rect on top driven by a Signal<f32>::animate_looping.
  • Determinate mounts the recipe frame only; the frame paints the track plus a proportional fill rect.
// Static determinate bar at 70 %:
let _bar = ProgressBar::new(0.7).thickness(6.0);

// Reactive determinate bar:
let progress = Signal::new(0.0_f32);
let _bar = ProgressBar::new(0.0).value(progress);

// Indeterminate (animated sweep):
let _spinner_bar = ProgressBar::indeterminate();

Structsยง

ProgressBar
A progress bar โ€” determinate or indeterminate, horizontal or vertical.