BankAccountCard class

Swipeable card that visually represents a single bank account.

Renders the account balance, type icon, masked account number, account name, and: when the account is not active: a status chip. Frozen accounts additionally show a semi-transparent overlay with a snowflake icon to make the state unmistakably clear.

Theme surface treatments:

  • Voltage: BankThemeData.accentGradient is non-null → violet/cyan gradient background, white text. Wrapped in RepaintBoundary to isolate gradient repaints.
  • Studio / Bloom: flat BankThemeData.surface background with BankThemeData.onSurface text.

When BankThemeData.useGlow is true, a coloured box-shadow glow is rendered beneath the card using BankThemeData.glowColor.

Wrap multiple BankAccountCards in a PageView to enable swiping between accounts:

PageView(
  children: accounts
      .map((a) => Padding(
            padding: const EdgeInsets.symmetric(horizontal: 16),
            child: BankAccountCard(account: a, onTap: () {}),
          ))
      .toList(),
)
Inheritance

Constructors

BankAccountCard({required BankAccount account, Key? key, VoidCallback? onTap, VoidCallback? onLongPress, Widget itemBuilder(BuildContext, BankAccount)?, bool showFullBalance = true, Widget? actions, EdgeInsetsGeometry? padding, BorderRadius? radius, Color? backgroundColor, Gradient? gradient, Color? foregroundColor, Color? secondaryColor, List<BoxShadow>? shadow, TextStyle? titleStyle, TextStyle? amountStyle, TextStyle? numberStyle, IconData? typeIcon, IconData? frozenIcon, String closedLabel = 'Closed', String frozenSemanticLabel = 'Account frozen', String? semanticLabel, double? height})
const

Properties

account BankAccount
The account data to display.
final
actions Widget?
Optional widget rendered at the bottom of the card, e.g. a row of action buttons. It is placed below the account-name / status row.
final
amountStyle TextStyle?
Merged over the balance style (theme numeralHero/numeralLarge).
final
backgroundColor Color?
Overrides the flat background colour. Defaults to the theme surface. Ignored while a gradient is painted.
final
closedLabel String
Status chip label for closed accounts. Defaults to 'Closed'.
final
foregroundColor Color?
Overrides the primary text colour. Defaults to white on gradient surfaces, otherwise the theme onSurface.
final
frozenIcon IconData?
Overrides the frozen-overlay icon. Defaults to Icons.ac_unit_outlined.
final
frozenSemanticLabel String
Accessibility label of the frozen-overlay icon. Defaults to 'Account frozen'.
final
gradient Gradient?
Overrides the background gradient. Defaults to the theme accentGradient when the preset provides one.
final
hashCode int
The hash code for this object.
no setterinherited
height double?
Overrides the fixed card height. Defaults to 200.
final
itemBuilder Widget Function(BuildContext, BankAccount)?
When non-null, completely overrides the default card content. The builder receives BuildContext and the BankAccount and must return a widget tree that fills the card.
final
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
numberStyle TextStyle?
Merged over the masked-number style (BankTokens.bodySmall).
final
onLongPress VoidCallback?
Called on a long-press, e.g. to show a context menu.
final
onTap VoidCallback?
Called when the card is tapped. If null, no tap interaction is wired.
final
padding EdgeInsetsGeometry?
Overrides the content padding. Defaults to EdgeInsets.all(BankTokens.space4).
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
secondaryColor Color?
Overrides the secondary text and icon colour. Defaults to 80% white on gradient surfaces, otherwise the theme onSurfaceVariant.
final
semanticLabel String?
Overrides the computed accessibility label of the whole card.
final
shadow List<BoxShadow>?
Overrides the glow shadow. Defaults to the theme glow when useGlow is on; pass const [] to remove it.
final
showFullBalance bool
true uses BankBalanceSize.hero for the balance; false uses BankBalanceSize.large (compact mode e.g. in the account switcher).
final
titleStyle TextStyle?
Merged over the account-name style (BankTokens.labelLarge).
final
typeIcon IconData?
Overrides the account-type icon derived from BankAccount.type.
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