BankPaymentCard class

A modern, layered payment-card face with a full-bleed artwork slot.

This is the flexible card surface behind neobank "My Cards" screens: a base gradient (or flat colour), an optional full-bleed artwork Widget beneath the UI (character art, a pattern, a photo — the kit bundles no assets, you supply the widget), a legibility scrim, then the card anatomy composited on top: an EMV chip, a contactless mark, a network badge, a label pill, the masked maskedNumber, and the holderName / expiry row. An optional balance renders on the face for account-style cards and honours privacy mode.

Cards default to the ISO 7810 ID-1 aspect ratio (1.586) so they read as real bank cards, and pair with BankCardCarousel for a swipeable wallet. Every visual decision is an optional parameter defaulting to the theme.

BankPaymentCard(
  label: 'Everyday',
  maskedNumber: '•••• 8695',
  holderName: 'ALEX MORGAN',
  expiry: '08/28',
  network: BankCardNetwork.visa,
  artwork: const MyCardArtwork(),
  balance: Money.fromDouble(3565.00, 'GBP'),
)
Inheritance

Constructors

BankPaymentCard({Key? key, String? label, String? maskedNumber, String? holderName, String? expiry, BankCardNetwork network = BankCardNetwork.generic, Money? balance, String balanceLabel = 'Balance', Widget? artwork, Widget? overlay, Widget surfaceBuilder(BuildContext context, Widget child)?, Gradient? gradient, Color? backgroundColor, Color? foregroundColor, bool showChip = true, Color? chipColor, bool showContactless = true, IconData? contactlessIcon, bool numberless = false, bool? scrim, BorderRadius? radius, EdgeInsetsGeometry? padding, List<BoxShadow>? shadow, double aspectRatio = kBankCardAspectRatio, double? width, double? height, double? maxWidth, VoidCallback? onTap, TextStyle? labelStyle, TextStyle? numberStyle, TextStyle? holderNameStyle, TextStyle? expiryStyle, TextStyle? captionStyle, TextStyle? balanceStyle, String holderLabel = 'CARD HOLDER', String expiryLabel = 'VALID THRU', String? semanticLabel})
const

Properties

artwork Widget?
Full-bleed artwork widget painted beneath the card UI (illustration, pattern, photo). The kit ships no assets — supply your own widget.
final
aspectRatio double
Aspect ratio (width / height). Defaults to kBankCardAspectRatio (1.586). Ignored when height is provided.
final
backgroundColor Color?
Flat base colour, used when gradient is null.
final
balance Money?
Optional balance rendered on the card face. Masks under privacy mode.
final
balanceLabel String
Caption above balance.
final
balanceStyle TextStyle?
Merged over the computed balance style.
final
captionStyle TextStyle?
Merged over the computed caption style (holder/expiry/balance labels).
final
chipColor Color?
Chip colour. Defaults to a gold tone.
final
contactlessIcon IconData?
Overrides the contactless glyph.
final
expiry String?
Expiry MM/YY, bottom-right. Hidden when null.
final
expiryLabel String
Caption above expiry.
final
expiryStyle TextStyle?
Merged over the computed expiry style.
final
foregroundColor Color?
Foreground colour for all card text/marks. Defaults to BankThemeData.onPrimary.
final
gradient Gradient?
Base gradient. Defaults to BankThemeData.cardSurfaceGradient, then BankThemeData.accentGradient (or a primary gradient) when both this and backgroundColor are null.
final
hashCode int
The hash code for this object.
no setterinherited
height double?
Fixed height. When set, aspectRatio is ignored.
final
holderLabel String
Caption above holderName.
final
holderName String?
Cardholder name, bottom-left. Hidden when null.
final
holderNameStyle TextStyle?
Merged over the computed cardholder-name style.
final
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
label String?
Short human-readable card name / nickname (e.g. 'Everyday'), shown as a pill top-left. Hidden when null.
final
labelStyle TextStyle?
Merged over the computed label-pill style.
final
maskedNumber String?
Masked card number, e.g. '•••• 8695'. Hidden when null or numberless.
final
maxWidth double?
Maximum width when width is null.
final
network BankCardNetwork
The payment network mark shown top-right. BankCardNetwork.generic hides it.
final
numberless bool
Hide the number and expiry from the face (data revealed in-app).
final
numberStyle TextStyle?
Merged over the computed card-number style.
final
onTap VoidCallback?
Tap handler for the whole card.
final
overlay Widget?
Optional widget layered above the artwork but below the card UI (e.g. a brand emblem or foil overlay).
final
padding EdgeInsetsGeometry?
Inner padding. Defaults to BankTokens.space5.
final
radius BorderRadius?
Card corner radius. Defaults to BankThemeData.cardRadius.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
scrim bool?
Draw a bottom legibility scrim. Defaults to true when artwork is set.
final
semanticLabel String?
Overrides the computed semantics label.
final
shadow List<BoxShadow>?
Card shadow. Defaults to BankTokens.shadowFloatingFor of the theme background brightness; pass const [] to flatten.
final
showChip bool
Whether to draw the EMV chip.
final
showContactless bool
Whether to draw the contactless mark.
final
surfaceBuilder Widget Function(BuildContext context, Widget child)?
Escape hatch to wrap the base surface with a custom painted layer without touching the card UI. Receives the base surface as its child.
final
width double?
Fixed width. When null the card fills its constraints (up to maxWidth).
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