countman library

Classes

AnimatedCounter
Animated rolling-digit counter backed by CustomPainter.
AnimatedCounterBuilder
Animated rolling-digit counter using Flutter's widget tree.
AnimatedCounterController
Programmatic control over an AnimatedCounter widget.
AnimatedCounterStyle
Visual style for AnimatedCounter and AnimatedCounterBuilder.
BarCountdown
A linear progress-bar countdown display. Composes CountdownBuilder.
BarCounter
A linear progress-bar counter display — the fill-toward-a-goal counterpart to BarCountdown. Progress = (value - from) / (to - from).
BarPainter
Draws a filled rounded-rect bar over a track — the shared rendering core for BarCountdown (bar shrinks) and BarCounter (bar grows). Both widgets only differ in how they compute progress; the fill math lives here once.
CardCountdown
A flip-card countdown display. Each time unit (H / M / S) is rendered as a card that animates when the digit changes.
CardCountdownProvider
Shares default style/size/timing config across a subtree of CardCountdowns, so a whole screen of cards doesn't need to repeat cardColor:/textStyle:/duration: etc. on every instance.
CardCountdownProviderData
Resolved config + shared glyph cache exposed to descendant CardCountdowns by CardCountdownProvider.
CardCountdownStyle
Visual style for CardCountdown.
CardGeometry
Resolved geometry for one CardCountdown paint pass — cell positions, separator/label centers, and the overall canvas size.
CardModel
Mutable, painter-visible animation state for one CardCountdown instance. Digit ticks and transition progress mutate this directly — no setState — the painter's repaint listenable (the shared AnimationController) is what schedules the repaint.
Cell
Layout of one digit cell within a CardCountdown, resolved by its _measure() and consumed by FlipCardPainter.
ClockPlugin<T extends ClockTask>
Base for interval-gated, wall-clock timer engines (countdown, elapsed).
ClockTask
A CountmanTask driven by a wall-clock anchor, processed on an interval. Shared by countdown (deadline ahead of now) and elapsed (start behind now).
Countdown
Countdown engine — drives Duration-based timers on the shared ticker. Each instance is an independent task queue (= a "group").
CountdownBuilder
A widget that drives a countdown timer on the shared ticker and exposes the remaining Duration via a builder callback.
CountdownController
Imperative controller for countdown display widgets.
CountdownFormat
Built-in duration formatters.
CountdownHandle
Returned by Countdown.add.
CountdownOptions
Options for a countdown task added via Countdown.add or countdown.
CountdownProvider
Supplies default configuration and an optional shared Countdown group to every countdown display widget below it.
CountdownTask
Internal task state.
Counter
Counter engine — drives number interpolation on the shared ticker. Each instance is an independent task queue (= a "group").
CounterBuilder
A widget that drives a counter animation on the shared ticker and exposes the current value via a builder callback.
CounterHandle
Returned by Counter.add. Allows the caller to retarget or cancel the animation without holding a reference to the plugin.
CounterOptions
Options for a counter animation task.
CounterPainter
CounterProvider
Supplies default configuration and an optional shared Counter group to every counter display widget below it.
CounterTask
Internal task state.
CounterTransition
Composable digit transition: pick one motion and layer independent scale / fade / blur modifiers — any combination, no enum explosion. Named presets (slide, fade, scale, rotate, flip, flipFade, slideScale, blur) cover the common looks.
CounterValueController
Imperative controller for counter display widgets.
Countman
Shared vsync ticker — one scheduleFrameCallback drives all plugins.
CountmanContext
Capabilities injected into a plugin when it is registered. Plugins hold a reference and call requestFrame whenever they enqueue a new task and need the ticker to (re-)start.
CountmanPlugin
Plugin interface. Each instance owns its own task queue and is registered once on the shared Countman ticker.
CountmanProvider
One-stop provider that configures all three families at once, so a page using counters, countdowns AND stopwatches doesn't need to hand-nest CounterProvider / CountdownProvider / ElapsedProvider.
CountmanScope<P>
Shared inherited scope carrying the default configuration a CounterProvider / CountdownProvider / ElapsedProvider hands down to descendant countman display widgets.
CountmanTask
Base state for a single task owned by a TaskQueuePlugin.
CountmanTextStyle
Visual style for the text displays — shared by TextCounter, TextCountdown and TextElapsed (see the TextCounterStyle / TextCountdownStyle / TextElapsedStyle aliases in those files).
DialArcConfig
Configuration for one decorative segmented arc ring.
DialColors
The five zone colours that drive tick / arc / digit tinting.
DialCountdown
DialCountdownStyle
A circular dial countdown display that replicates the ring.ts renderer in Flutter using CustomPainter.
DialInnerConfig
Configuration for the innermost progress ring.
DialTicksConfig
Configuration for the outermost tick ring.
DigitColumnLayout
DigitPhase
Mutable output holder for resolveDigitPhase. Callers keep ONE instance and reuse it every frame so the paint/build hot path stays allocation-free (a record return would heap-allocate per digit per frame in a perf-critical counter).
Elapsed
Elapsed-time engine — drives open-ended "stopwatch" timers on the shared ticker. Each instance is an independent task queue (= a "group").
ElapsedBuilder
Low-level open-ended elapsed-time (stopwatch) widget that exposes the current TimeParts via a builder — the elapsed counterpart to CountdownBuilder. Starts at zero on mount and counts up indefinitely until removed or ElapsedController.cancelled.
ElapsedController
Imperative controller for elapsed-time display widgets.
ElapsedHandle
Returned by Elapsed.add.
ElapsedOptions
Options for an elapsed-time task added via Elapsed.add or elapsed.
ElapsedProvider
Supplies default configuration and an optional shared Elapsed group to every elapsed-time display widget below it.
ElapsedTask
Internal task state.
FlipCardPainter
Paints one CardCountdown — every digit, separator and label — as a single CustomPainter repainted in place, not a widget subtree rebuilt per digit.
LazyDefault<T extends CountmanPlugin>
Holds a lazily-created, auto-registered default plugin instance. Replaces the per-engine _default / _registered bootstrap and the matching Countman.destroy() reset boilerplate.
OdometerCounter
A sliding-digit "odometer" counter. Now a thin preset over AnimatedCounter with CounterTransition.slide and odometer defaults (fixed-width leading zeros). The previous standalone painter was removed — AnimatedCounter's slide is the same look — so most rendering knobs are inherited from it.
OdometerCounterStyle
Visual style for OdometerCounter.
RingCountdown
A circular arc countdown display. Composes CountdownBuilder.
RingCounter
A circular arc counter display — the fill-toward-a-goal counterpart to RingCountdown. Progress = (value - from) / (to - from).
RingPainter
Draws a circular arc over a track — the shared rendering core for RingCountdown (arc depletes) and RingCounter (arc fills). Both widgets only differ in how they compute progress; the arc math lives here once.
StartScheduler
Frame-based batch scheduler for widget animation starts.
TaskQueuePlugin<T extends CountmanTask>
Shared boilerplate for every countman engine: task map, id allocator, context wiring, add/remove/dispose plumbing, and the per-frame tick skeleton (empty-check → first-frame render → per-task step → deferred removal of completed tasks).
TextCountdown
A Text-based countdown widget with optional prefix/suffix.
TextCounter
A Text-based counter widget with optional prefix/suffix.
TextElapsed
Displays an open-ended elapsed-time counter — a stopwatch, not a countdown. Starts at zero the moment it's mounted and counts up indefinitely until removed or ElapsedController.cancelled.
TimeParts
Read-only decomposition of a Duration into its calendar components, shared per task: the owning countdown/elapsed task computes it once per tick into a reused fixed-length backing list (zero per-frame allocation), and every consumer of that task — formatters, progress widgets, the flip-card's per-unit cells — reads the same instance instead of each recomputing the %/~/ math.

Enums

CountdownType
Per-digit transition used by CardCountdown when a value changes.
CounterMotion
Primary per-digit movement for CounterTransition. Exactly one applies; CounterTransition.scale / .fade / .blur layer on top of it.
NumeralSystem
Predefined numeral systems for internationalization.
SlideEffect
Enter/exit behavior for a CountdownType.slide/CountdownType.flip digit's scale (CardCountdown.scaleEffect) or opacity (CardCountdown.opacityEffect).
StaggerDirection
The direction in which the stagger effect propagates across digits.

Properties

countdownClock DateTime Function()
Injectable wall clock shared by every time-based engine (countdown, elapsed). Lives in core/ so no engine depends on another just to read the clock.
getter/setter pair
defaultCountdown Countdown
The default Countdown instance (interval = 1 s) used by CountdownWidget when no plugin is provided. Auto-registered with Countman on first access.
no setter
defaultCountdownMs Countdown
The default precise Countdown instance (interval: 0 — processes every frame) used by widgets with precise: true when no plugin is given. Lets sub-second formatters (CountdownFormat.msTenths / CountdownFormat.msMillis) update smoothly without hand-wiring a group. Auto-registered with Countman on first access.
no setter
defaultCounter Counter
The default shared Counter instance. Auto-registered with Countman on first access.
no setter
defaultElapsed Elapsed
The default Elapsed instance (interval = 1 s) used by TextElapsed when no plugin is provided. Auto-registered with Countman on first access.
no setter
defaultElapsedMs Elapsed
The default precise Elapsed instance (interval: 0 — processes every frame) used by widgets with precise: true when no plugin is given. Auto-registered with Countman on first access.
no setter

Functions

applyRotateX(Canvas canvas, Offset center, double angle, double perspective, void draw()) → void
Applies a perspective rotateX transform around center for the duration of draw, then restores the canvas.
countdown(CountdownOptions opts) CountdownHandle
Add a countdown using the default shared Countdown instance.
counter(CounterOptions opts) CounterHandle
Add a counter animation using the default shared Counter instance. Auto-registered with Countman on first call.
elapsed(ElapsedOptions opts) ElapsedHandle
Add an elapsed-time timer using the default shared Elapsed instance.
isAllNinesTarget(int n) bool
True when n consists entirely of 9s (9, 99, 999, …): (n + 1) is a power of ten. Used to detect targets where digit interpolation stalls, animating to n − ε instead and snapping at completion.
remainingUntil(Object to) Duration
Returns the remaining Duration until the deadline described by to, clamped to Duration.zero if already past.
resolveDeadline(Object to) DateTime
Converts to to an absolute DateTime deadline.
resolveDigitPhase(DigitPhase out, {required bool fast, required int fastFrom, required int fastTo, required double position, required bool increasing, required int targetDigit, required double target, required bool hasTarget, double eps = 1e-3}) → void
Resolves the odometer triple a single digit column renders THIS frame INTO out, shared by the painter fast-path (CounterPainter.resolveColumnPhase) and the widget-tree path (DigitColumn) so the trajectory + end-of-roll ghost-prevention math lives in ONE tested place instead of being mirrored.

Typedefs

BarCountdownStyle = BarStyle
Visual style for BarCountdown. Alias of the shared BarStyle.
BarCounterStyle = BarStyle
Visual style for BarCounter. Alias of the shared BarStyle.
CounterPainterBuilder = CounterPainter Function({String decimalSeparator, required Size digitSize, required List<double> digitValues, required AxisDirection flipDirection, required int fractionDigits, required List<int> groupingPattern, required bool hideLeadingZeroes, required bool increasing, double numberAlignment, String numeralMapper(int)?, required NumeralSystem numeralSystem, EdgeInsets padding, required Listenable repaint, TextStyle? separatorStyle, required TextStyle style, String? thousandSeparator, required CounterTransition transition})
Factory signature for AnimatedCounter.painterBuilder. Receives the exact arguments the default CounterPainter would be built with, so a custom implementation can subclass CounterPainter and forward them (overriding only the drawing methods it cares about) while keeping the in-place update() / repaint contract the fast path relies on.
DurationFormatter = String Function(TimeParts parts)
Formatter function type for CountdownWidget / TextElapsed. Receives the shared per-task TimeParts (pre-decomposed d/h/m/s/ms) rather than a raw Duration, so a formatter reads components directly with no % math.
RingCountdownStyle = RingStyle
Visual style for RingCountdown. Alias of the shared RingStyle.
RingCounterStyle = RingStyle
Visual style for RingCounter. Alias of the shared RingStyle.
TextCountdownStyle = CountmanTextStyle
Visual style for TextCountdown. Alias of the shared CountmanTextStyle.
TextCounterStyle = CountmanTextStyle
Visual style for TextCounter. Alias of the shared CountmanTextStyle.
TextElapsedStyle = CountmanTextStyle
Visual style for TextElapsed. Alias of the shared CountmanTextStyle.