KpiCard class

Editorial KPI card. Hairline-bordered surface tile with a mono-uppercase label, a big italic Instrument Serif numeral, and an optional delta row (arrow + magnitude + unit) and/or sparkline below.

Replaces the inline EditorialStatTile markup spread across:

  • lib/presentation/screens/org/org_dashboard_screen.dart
  • lib/presentation/screens/progress/progress_dashboard_screen.dart (those will be migrated in the follow-up sprint — this widget just has to BE them, with the same visual weight).

Example:

KpiCard(
  label: 'Active learners',
  value: '17',
  delta: const KpiDelta(
    direction: KpiDeltaDirection.up,
    magnitude: 6,
    unit: ' this week',
  ),
)

KpiCard(
  label: 'Retention',
  value: '94',
  valueSuffix: '%',
  delta: const KpiDelta(direction: KpiDeltaDirection.down, magnitude: 2, unit: ' pt'),
  sparkline: SparklineSlot(...),
)
Inheritance
Available extensions

Constructors

KpiCard({Key? key, required String label, required String value, String? valueSuffix, KpiDelta? delta, Widget? sparkline, Color? accent, bool loading = false, VoidCallback? onTap, EdgeInsetsGeometry padding = const EdgeInsets.fromLTRB(20, 18, 20, 16)})
const

Properties

accent Color?
Optional accent color override for the numeral. Defaults to t.ink — pass t.ochre / t.forestDeep to call out the headline number.
final
delta KpiDelta?
final
hashCode int
The hash code for this object.
no setterinherited
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
label String
Top label. Rendered uppercase by the card.
final
loading bool
While true, renders a small CircularProgressIndicator in place of the value. Label, delta, and sparkline still render around it so the card height does not jump when data arrives.
final
onTap VoidCallback?
final
padding EdgeInsetsGeometry
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
sparkline Widget?
Optional widget rendered below the delta (typically a small sparkline or progress bar). The slot takes full card width and sits above the bottom padding.
final
value String
Headline value. String — callers format their own number / percentage / score. Use valueSuffix for %, x, etc. so the suffix can be rendered at a smaller size for editorial balance.
final
valueSuffix String?
Optional smaller-size suffix glyph (e.g. %).
final

Methods

animate({Key? key, List<Effect>? effects, AnimateCallback? onInit, AnimateCallback? onPlay, AnimateCallback? onComplete, bool? autoPlay, Duration? delay, AnimationController? controller, Adapter? adapter, double? target, double? value}) Animate

Available on Widget, provided by the AnimateWidgetExtensions extension

Wraps the target Widget in an Animate instance, and returns the instance for chaining calls. Ex. myWidget.animate() is equivalent to Animate(child: myWidget).
build(BuildContext context) Widget
Describes the part of the user interface represented by this widget.
override
createElement() StatelessElement
Creates a StatelessElement to manage this widget's location in the tree.
inherited
debugDescribeChildren() List<DiagnosticsNode>
Returns a list of DiagnosticsNode objects describing this node's children.
inherited
debugFillProperties(DiagnosticPropertiesBuilder properties) → void
Add additional properties associated with the node.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toDiagnosticsNode({String? name, DiagnosticsTreeStyle? style}) DiagnosticsNode
Returns a debug representation of the object that is used by debugging tools and by DiagnosticsNode.toStringDeep.
inherited
toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) String
A string representation of this object.
inherited
toStringDeep({String prefixLineOne = '', String? prefixOtherLines, DiagnosticLevel minLevel = DiagnosticLevel.debug, int wrapWidth = 65}) String
Returns a string representation of this node and its descendants.
inherited
toStringShallow({String joiner = ', ', DiagnosticLevel minLevel = DiagnosticLevel.debug}) String
Returns a one-line detailed description of the object.
inherited
toStringShort() String
A short, textual description of this widget.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited