Skip to content

LayrzProgressBar

Kenny Mochizuki Escalona edited this page Aug 28, 2026 · 1 revision

LayrzProgressBar

A standardized linear progress bar with determinate and indeterminate modes.

Metadata Predecessor: None — no direct ThemedProgressBar exists in layrz_theme Phase: M6 (pulled forward as an M4/M5 prerequisite) Domain: Feedback Primitive: CustomPaint (no Material LinearProgressIndicator) Status: Merged · Review required.


Overview

LayrzProgressBar renders a rounded-capsule track with a filled indicator, in one of two modes selected entirely by whether value is null:

  • Determinate (value non-null, [0.0, 1.0]): a filled bar growing from the leading edge as value increases — 1.0 is a full bar.
  • Indeterminate (value == null): a capsule that sweeps back and forth across the track, looping for as long as the widget is mounted.
// Determinate — upload progress
LayrzProgressBar(value: 0.42, semanticLabel: 'Upload progress')

// Indeterminate — unknown-duration operation
LayrzProgressBar(semanticLabel: 'Loading')

null always means indeterminate, never zero progress — a caller wanting to show "no progress yet" passes 0.0 explicitly.

Determinate direction is the opposite of LayrzButtonIndicator

LayrzButtonIndicator's internal determinate mode depletes from full to empty (correct for a button countdown). LayrzProgressBar is the opposite: it fills from empty to full as value rises. This is a deliberate divergence, not an inconsistency — the two components serve different semantics and neither replicates the other's direction.

Non-goals

This widget is display-only — it is not interactive. A draggable variant is LayrzSlider's responsibility, not this widget's. It also has no circular/ring variant — a future LayrzProgressRing would be a separate component, not an option on this one.

Colors follow the LayrzChipType semantic convention

LayrzProgressBarType (info / success / warning / danger / context / custom) mirrors LayrzChipType's vocabulary exactly, rather than inventing a second semantic-color enum. When type is custom, the explicit color parameter is honored instead of a token color, falling back to tokens.colors.primary.shade500 if both are unset.

Accessibility

The bar wraps its content in a live-region Semantics node. semanticLabel supplies the human-readable description (e.g. 'Upload progress'); when null, a generic label is used — 'Progress' for determinate mode, 'Loading' for indeterminate. The percentage (determinate) or busy state (indeterminate) is always announced in addition to the label, never in its place.

Reduced motion (MediaQuery.disableAnimationsOf) freezes the indeterminate sweep at its start position instead of looping — the sweep controller is torn down entirely rather than merely left unstarted while reduce-motion is active, and is recreated the next time it's needed.

API

LayrzProgressBar

Parameter Type Notes
value double? The determinate fraction in [0.0, 1.0]. null selects indeterminate mode. Asserted to be null or within range.
type LayrzProgressBarType Defaults to LayrzProgressBarType.info. Selects the indicator's semantic accent color.
color Color? Explicit indicator color, honored only when type is custom.
height double The bar's height in logical pixels. Defaults to 8.0.
borderRadius double? Border radius for track and indicator. Defaults to tokens.radius.full (a pill shape) when null.
semanticLabel String? Accessibility description of what this bar represents. See the Accessibility section above for the fallback behavior when null.

LayrzProgressBarType (enum)

info · success · warning · danger · context · custom — matches LayrzChipType's vocabulary. custom honors the constructor's color parameter; every other value resolves its own token color via colorToken(LayrzTokens tokens).

LayrzProgressStyleSpec

An immutable, paint-only spec (trackColor, indicatorColor) resolved once per build via LayrzProgressStyleSpec.resolve(type:, color:, tokens:). No interaction states are involved — a progress bar is not tappable, so there is nothing to resolve beyond type and tokens.

LayrzProgressPainter

The CustomPainter backing both modes. Exported independently in case a caller needs to compose it directly, though ordinary use goes through LayrzProgressBar.

Design tokens used

  • Colors: info/success/warning/danger/contextual (indicator accent by type), sf3 (track background), primary (custom-type fallback accent).
  • Motion: dDialog for the indeterminate sweep's animation duration.

Related documents

Component Catalog, Milestone 6


Last updated: 2026-08-28 (first documentation of this widget)

Clone this wiki locally