BankTransactionPinSheet class

Transfer-specific authorisation PIN bottom sheet.

Distinct from the login PIN: uses a different semantic label, title, and subtitle to make the authorisation context clear. The host app supplies an onSubmit callback that performs the authorisation; the result determines whether the sheet closes with true or shows an error shake.

Use BankTransactionPinSheet.show to present it as a modal bottom sheet:

final confirmed = await BankTransactionPinSheet.show(
  context,
  onSubmit: (pin) async {
    return await api.authoriseTransfer(pin);
  },
);
if (confirmed == true) { /* proceed */ }
Inheritance

Constructors

BankTransactionPinSheet({required Future<bool> onSubmit(String pin), Key? key, int pinLength = 6, VoidCallback? onCancel, String title = 'Enter PIN', String subtitle = 'Enter your PIN to confirm this transfer', String cancelLabel = 'Cancel', String semanticLabel = 'Transaction PIN sheet', Color? backgroundColor, BorderRadius? radius, EdgeInsetsGeometry? padding, TextStyle? titleStyle, TextStyle? subtitleStyle, Color? accentColor, Duration? errorResetDelay})
const

Properties

accentColor Color?
Overrides the loading indicator color. Defaults to the theme primary.
final
backgroundColor Color?
Overrides the sheet background color. Defaults to the theme surface.
final
cancelLabel String
Label of the cancel button. Defaults to 'Cancel'.
final
errorResetDelay Duration?
How long the error state is shown before the PIN clears after a wrong entry. Defaults to 800 milliseconds.
final
hashCode int
The hash code for this object.
no setterinherited
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
onCancel VoidCallback?
Called when the user taps the cancel button. If null, a default Navigator.pop is used.
final
onSubmit Future<bool> Function(String pin)
Called with the entered PIN when pinLength digits have been entered. Return true to close the sheet with a success result, or false to show a shake error and allow retry.
final
padding EdgeInsetsGeometry?
Overrides the sheet content padding (keyboard insets are still added below it). Defaults to space6 sides, space4 top, space6 bottom.
final
pinLength int
Number of PIN digits expected. Defaults to 6.
final
radius BorderRadius?
Overrides the sheet corner radius. Defaults to the theme sheetRadius.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
semanticLabel String
Semantics label of the sheet. Defaults to 'Transaction PIN sheet'.
final
subtitle String
Subtitle shown below the title. Defaults to 'Enter your PIN to confirm this transfer'.
final
subtitleStyle TextStyle?
Merged over the subtitle style (BankTokens.bodyMedium in onSurfaceVariant).
final
title String
Sheet title. Defaults to 'Enter PIN'.
final
titleStyle TextStyle?
Merged over the title style (BankTokens.headlineMedium in onSurface).
final

Methods

createElement() StatefulElement
Creates a StatefulElement to manage this widget's location in the tree.
inherited
createState() State<BankTransactionPinSheet>
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 Future<bool> onSubmit(String pin), int pinLength = 6}) Future<bool?>
Presents the sheet as a modal bottom sheet and returns true on successful authorisation, false on cancellation, or null if dismissed.