BankScaApprovalSheet class

A payment-bound strong-customer-authentication sheet implementing the PSD2 dynamic-linking pattern: the amount and payee stay visible and cannot be scrolled away while the customer authenticates.

The amount is deliberately rendered WITHOUT the scope privacy mask - dynamic linking requires the customer to see exactly what they are approving.

Present it with BankScaApprovalSheet.show, which resolves true on approval, false on rejection or expiry, and blocks drag/tap dismissal.

final approved = await BankScaApprovalSheet.show(
  context,
  amount: Money.fromDouble(1250.00, 'SAR'),
  payeeName: 'Acme Trading LLC',
  payeeAccountMasked: 'SA44 •••• 9021',
  onApprove: (method, pin) => verifyWithBackend(method, pin),
  onReject: () {},
);
Inheritance

Constructors

BankScaApprovalSheet({required Money amount, required String payeeName, required BankScaApproveCallback onApprove, required VoidCallback onReject, Key? key, String? payeeAccountMasked, String? reference, DateTime? expiresAt, Set<BankScaMethod> methods = const {BankScaMethod.biometric, BankScaMethod.pin}, int pinLength = 4, String title = 'Confirm payment', String rejectLabel = 'Reject payment', String usePinLabel = 'Use PIN instead', String useBiometricLabel = 'Use biometrics instead', String pushWaitingLabel = 'Approve this payment in your authenticator', String expiresPrefix = 'Expires in', EdgeInsetsGeometry? padding, TextStyle? amountStyle, TextStyle? titleStyle, IconData? headerIcon, IconData? successIcon, Color? successColor, String amountSemanticPrefix = 'Amount'})
const

Properties

amount Money
The exact amount being authorized. Never privacy-masked here.
final
amountSemanticPrefix String
Prefix used in the amount accessibility label, joined as '<prefix>: <amount>'. Defaults to 'Amount'.
final
amountStyle TextStyle?
Text style merged over the computed amount style (numeral hero in the theme foreground and font family). Null applies no override.
final
expiresAt DateTime?
When set, a countdown chip ticks down and the sheet auto-resolves false at zero.
final
expiresPrefix String
final
hashCode int
The hash code for this object.
no setterinherited
headerIcon IconData?
Glyph for the header security icon. Defaults to Icons.gpp_maybe_outlined when null.
final
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
methods Set<BankScaMethod>
Which authentication methods to offer. The first available of biometric → pin → pushConfirm becomes the initial method.
final
onApprove BankScaApproveCallback
Verifies the attempt with the host backend.
final
onReject VoidCallback
Fired when the customer explicitly rejects. The sheet pops false.
final
padding EdgeInsetsGeometry?
Outer content padding of the sheet. Defaults to symmetric horizontal BankTokens.space5 and vertical BankTokens.space4 when null.
final
payeeAccountMasked String?
Masked destination account, e.g. 'SA44 •••• 9021'.
final
payeeName String
final
pinLength int
Digits required for BankScaMethod.pin.
final
pushWaitingLabel String
final
reference String?
Payment reference shown under the payee row.
final
rejectLabel String
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
successColor Color?
Color of the success confirmation icon. Defaults to the theme positiveBalance when null.
final
successIcon IconData?
Glyph for the success confirmation icon. Defaults to Icons.check_circle_rounded when null.
final
title String
final
titleStyle TextStyle?
Text style merged over the computed header title style (headline small in the theme foreground). Null applies no override.
final
useBiometricLabel String
final
usePinLabel String
final

Methods

createElement() StatefulElement
Creates a StatefulElement to manage this widget's location in the tree.
inherited
createState() State<BankScaApprovalSheet>
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

Static Methods

show(BuildContext context, {required Money amount, required String payeeName, required BankScaApproveCallback onApprove, required VoidCallback onReject, String? payeeAccountMasked, String? reference, DateTime? expiresAt, Set<BankScaMethod> methods = const {BankScaMethod.biometric, BankScaMethod.pin}, int pinLength = 4, String title = 'Confirm payment', String rejectLabel = 'Reject payment', String usePinLabel = 'Use PIN instead', String useBiometricLabel = 'Use biometrics instead', String pushWaitingLabel = 'Approve this payment in your authenticator', String expiresPrefix = 'Expires in', EdgeInsetsGeometry? padding, TextStyle? amountStyle, TextStyle? titleStyle, IconData? headerIcon, IconData? successIcon, Color? successColor, String amountSemanticPrefix = 'Amount', Color? backgroundColor, BorderRadius? sheetRadius}) Future<bool?>
Presents the sheet modally. Resolves true when approved, false when rejected or expired, null never (dismissal is disabled).