BankSavingsChallengeCard class

Gamified stepped savings challenge card (26-week or 52-week style).

Presents a savings challenge as a grid of stamp circles, one per step: completed steps are filled with the brand colour and a check mark, the current step pulses with an animated ring (static when the platform requests reduced motion), and future steps are outlined. Below the grid the card shows a "{completed} of {total}" progress line, the next deposit amount (rendered with BankBalanceText, so it masks in privacy mode) with an optional due date, and an async deposit button with an inline spinner and success check.

A flame streak chip appears next to the title while streak is greater than zero. For long challenges the grid caps at 30 visible stamps and appends a "+N more" tail chip.

Use it on a savings or goals screen wherever a recurring stepped challenge (the classic 26-week saving challenge) needs a glanceable, tappable summary.

BankSavingsChallengeCard(
  title: '52 week challenge',
  totalSteps: 52,
  completedSteps: 17,
  nextDeposit: Money.fromDouble(18, 'USD'),
  nextDepositDate: DateTime(2026, 7, 10),
  streak: 17,
  onDepositNow: () => api.deposit(challengeId),
  onTap: () => openChallengeDetail(challengeId),
)
Inheritance

Constructors

BankSavingsChallengeCard({required String title, required int totalSteps, required int completedSteps, required Money nextDeposit, Key? key, DateTime? nextDepositDate, int streak = 0, Future<bool> onDepositNow()?, VoidCallback? onTap, String depositLabel = 'Deposit now', String streakTemplate = '{n} week streak', String progressTemplate = '{completed} of {total}', String moreTemplate = '+{n} more', EdgeInsetsGeometry? padding, BorderRadius? radius, Color? backgroundColor, Color? accentColor, List<BoxShadow>? shadow, TextStyle? titleStyle, TextStyle? subtitleStyle, String? semanticLabel, IconData? checkIcon, IconData? streakIcon, IconData? scheduleIcon, Duration? animationDuration, double? stampSize})
const

Properties

accentColor Color?
Overrides the stamp, ring, and deposit-button accent. Defaults to the theme primary colour.
final
animationDuration Duration?
Base duration of the current-stamp pulse (and, doubled, of the success hold). Defaults to BankTokens.durationXSlow.
final
backgroundColor Color?
Overrides the card fill colour. Defaults to the theme surface.
final
checkIcon IconData?
Glyph for completed stamps and the deposit success state. Defaults to Icons.check_rounded.
final
completedSteps int
Deposits completed so far. Must be between 0 and totalSteps.
final
depositLabel String
Label of the deposit button.
final
hashCode int
The hash code for this object.
no setterinherited
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
moreTemplate String
Tail chip text for capped grids; {n} is substituted with the number of hidden stamps.
final
nextDeposit Money
Amount of the next scheduled deposit.
final
nextDepositDate DateTime?
Due date of the next deposit; hidden when null.
final
onDepositNow Future<bool> Function()?
Performs the next deposit; return true on success to show the inline success check. The button hides when null.
final
onTap VoidCallback?
Called when the card body is tapped.
final
padding EdgeInsetsGeometry?
Overrides the card content padding. Defaults to space4 all round.
final
progressTemplate String
Progress line text; {completed} and {total} are substituted.
final
radius BorderRadius?
Overrides the card corner radius. Defaults to the theme cardRadius.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
scheduleIcon IconData?
Overrides the next-deposit row glyph. Defaults to BankIcons.schedule.
final
semanticLabel String?
Overrides the card semantics. Defaults to a label built from the title, progress, and streak.
final
shadow List<BoxShadow>?
Overrides the card shadow. Defaults to the theme glow when enabled, else BankTokens.shadowCard; pass const [] to flatten.
final
stampSize double?
Diameter of each stamp circle. Defaults to 28.
final
streak int
Consecutive on-time deposits. A flame chip renders when above zero.
final
streakIcon IconData?
Overrides the streak chip glyph. Defaults to Icons.local_fire_department_rounded.
final
streakTemplate String
Streak chip text; {n} is substituted with streak.
final
subtitleStyle TextStyle?
Merged over the computed progress-line style (BankTokens.labelMedium in onSurfaceVariant).
final
title String
Challenge name, e.g. '52 week challenge'.
final
titleStyle TextStyle?
Merged over the computed title style (BankTokens.headlineSmall in onSurface).
final
totalSteps int
Total number of deposits in the challenge.
final

Methods

createElement() StatefulElement
Creates a StatefulElement to manage this widget's location in the tree.
inherited
createState() State<BankSavingsChallengeCard>
Creates the mutable state for this widget at a given location in the tree.
override
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

Constants

maxVisibleStamps → const int
Maximum number of stamp circles rendered before the tail chip.