BankPrizeDrawCard class
Card for a prize-linked savings account: deposit to earn draw chances, win monthly prizes, gift entries to loved ones.
A staple of prize-linked savings programmes across the GCC.
The card shows the account balance (via BankBalanceText, so it is masked when privacy mode is active on the ambient BankUiScope), a hero count of entries in the next draw, a static countdown to the next draw (days when far, hours and minutes when close; recomputed on each build, never ticking), the list of upcoming draws with deposit cutoffs, an eligibility hint when the balance is below minDeposit, and Add money / Gift a chance / Past winners actions.
All colours, radii, spacing, and text styles come from BankThemeData and BankTokens; every string and visual decision is overridable through optional constructor parameters. Inject clock for deterministic countdowns in tests and screenshots.
BankPrizeDrawCard(
balance: Money.fromDouble(1250, 'BHD'),
entriesCount: 25,
draws: [
BankPrizeDraw(
id: 'grand',
prizeLabel: 'Porsche 911 Carrera S',
drawDate: DateTime(2026, 3, 10),
lastDepositDate: DateTime(2026, 3, 1),
isGrand: true,
),
BankPrizeDraw(
id: 'may',
prizeLabel: 'Cash prize',
prizeAmount: Money.fromDouble(500000, 'USD'),
drawDate: DateTime(2026, 5, 13),
lastDepositDate: DateTime(2026, 5, 1),
),
],
minDeposit: Money.fromDouble(50, 'BHD'),
onAddMoney: () => openTopUp(),
onSendGift: () => openGifting(),
onViewWinners: () => openWinners(),
)
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatelessWidget
- BankPrizeDrawCard
Constructors
-
BankPrizeDrawCard({required Money balance, required int entriesCount, required List<
BankPrizeDraw> draws, Key? key, String title = 'Prize draws', String balanceLabel = 'My balance', String entriesLabel = 'chances in the next draw', int visibleDraws = 3, Money? minDeposit, String minDepositTemplate = 'Deposit at least {amount} to be eligible', String cutoffTemplate = 'Deposit by {date} to enter', String countdownDaysTemplate = 'Draw in {days} days', String countdownHoursTemplate = 'Draw in {hours}h {minutes}m', String grandLabel = 'Grand draw', bool? useIsoCurrencyCodes, VoidCallback? onAddMoney, VoidCallback? onSendGift, VoidCallback? onViewWinners, String addMoneyLabel = 'Add money', String sendGiftLabel = 'Gift a chance', String winnersLabel = 'Past winners', DateTime clock()?, EdgeInsetsGeometry? padding, BorderRadius? radius, Color? backgroundColor, Color? accentColor, List<BoxShadow> ? shadow, TextStyle? titleStyle, TextStyle? amountStyle, TextStyle? entriesStyle, IconData? grandBadgeIcon, Widget? header, String? semanticLabel}) -
Creates a prize-linked savings card.
const
Properties
- accentColor → Color?
-
Accent for the star badge, countdown icon, and action buttons.
Defaults to the theme BankThemeData.primary.
final
- addMoneyLabel → String
-
Label of the primary action. Defaults to
'Add money'.final - amountStyle → TextStyle?
-
Merged over the computed balance style (theme
BankThemeData.numeralMedium in the surface colour).
final
- backgroundColor → Color?
-
Overrides the card background. Defaults to the theme
BankThemeData.surface.
final
- balance → Money
-
Balance of the prize-linked savings account. Rendered through
BankBalanceText, so it is masked in privacy mode.
final
- balanceLabel → String
-
Label preceding the balance. Defaults to
'My balance'.final - clock → DateTime Function()?
-
Clock used for the countdown computation. Inject a fixed clock
for deterministic screenshots. Defaults to DateTime.now.
final
- countdownDaysTemplate → String
-
Countdown template used when the next draw is a day or more away;
{days}is replaced. Defaults to'Draw in {days} days'.final - countdownHoursTemplate → String
-
Countdown template used when the next draw is less than a day
away;
{hours}and{minutes}are replaced. Defaults to'Draw in {hours}h {minutes}m'.final - cutoffTemplate → String
-
Template of each draw's cutoff line;
{date}is replaced with the formatted BankPrizeDraw.lastDepositDate. Defaults to'Deposit by {date} to enter'.final -
draws
→ List<
BankPrizeDraw> -
Upcoming draws. Sorted by BankPrizeDraw.drawDate for display;
at most visibleDraws are listed. An empty list simply hides the
list and the countdown.
final
- entriesCount → int
-
Number of chances (entries) held in the next draw, shown in hero
numerals with NumeralStyle-aware digits.
final
- entriesLabel → String
-
Unit line under the entries hero numeral. Defaults to
'chances in the next draw'.final - entriesStyle → TextStyle?
-
Merged over the computed entries hero style (theme
BankThemeData.numeralHero in the surface colour).
final
-
Optional slot rendered below the actions.
final
- grandBadgeIcon → IconData?
-
Glyph of the grand-draw badge. Defaults to
BankIcons.watchlistFilled (a filled star).
final
- grandLabel → String
-
Semantics label of the star badge on grand draws. Defaults to
'Grand draw'.final - hashCode → int
-
The hash code for this object.
no setterinherited
- header → Widget?
-
Optional slot rendered above the heading.
final
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
- minDeposit → Money?
-
Minimum deposit required to be eligible. When set and the balance
amount is below it, an eligibility hint is shown.
final
- minDepositTemplate → String
-
Template of the eligibility hint;
{amount}is replaced with the formatted minDeposit. Defaults to'Deposit at least {amount} to be eligible'.final - onAddMoney → VoidCallback?
-
Called when the primary Add money button is tapped. When
null, the button renders disabled.final - onSendGift → VoidCallback?
-
Called when the Gift a chance button is tapped. When
null, the button renders disabled.final - onViewWinners → VoidCallback?
-
Called when the Past winners link is tapped. When
null, the link renders disabled.final - padding → EdgeInsetsGeometry?
-
Overrides the content padding. Defaults to
EdgeInsets.all(BankTokens.space5).final - radius → BorderRadius?
-
Overrides the card corner radius. Defaults to the theme
BankThemeData.cardRadius.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- semanticLabel → String?
-
Overrides the merged semantics summary of the card.
final
- sendGiftLabel → String
-
Label of the gifting action. Defaults to
'Gift a chance'.final -
shadow
→ List<
BoxShadow> ? -
Overrides the card shadow. Defaults to the resting-card shadow for
the theme background's brightness (BankTokens.shadowCardFor); pass
const []to flatten the card.final - title → String
-
Card heading. Defaults to
'Prize draws'.final - titleStyle → TextStyle?
-
Merged over the computed heading style
(BankTokens.headlineSmall in the surface colour).
final
- useIsoCurrencyCodes → bool?
-
Whether monetary prizes render with their ISO 4217 code
(
USD 500,000) instead of their symbol ($500,000).final - visibleDraws → int
-
Maximum number of upcoming draws listed. Defaults to 3.
final
- winnersLabel → String
-
Label of the winners link. Defaults to
'Past winners'.final
Methods
-
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