BankCardPinManager class
Three-step Change-PIN flow: verify current PIN → enter new PIN → confirm.
Step 0: User enters their current PIN. Step 1: User enters the new PIN. Step 2: User confirms the new PIN.
On step 2 completion the widget calls onSubmit with
(currentPin, newPin).
If the two new PINs do not match, a shake animation is played and an error
message is shown without advancing. On a successful onSubmit result
(Future<bool> returning true) onSuccess is invoked.
Integrates BankPinDots for visual feedback and BankPinKeypad for input.
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatefulWidget
- BankCardPinManager
Constructors
-
BankCardPinManager({required Future<
bool> onSubmit(String currentPin, String newPin), Key? key, int pinLength = 4, VoidCallback? onCancel, VoidCallback? onSuccess, EdgeInsetsGeometry? padding, Color? accentColor, Color? foregroundColor, Color? successColor, TextStyle? titleStyle, TextStyle? subtitleStyle, TextStyle? errorTextStyle, TextStyle? stepLabelStyle, IconData backIcon = Icons.arrow_back, IconData successIcon = Icons.check_circle_outline, Duration? animationDuration, Curve? animationCurve, String currentPinTitle = 'Enter current PIN', String newPinTitle = 'Enter new PIN', String confirmPinTitle = 'Confirm new PIN', String currentPinSubtitle = 'Enter the PIN for your card', String? newPinSubtitle, String confirmPinSubtitle = 'Re-enter your new PIN to confirm', String mismatchErrorText = "PINs don't match. Please try again.", String incorrectPinErrorText = 'Incorrect current PIN. Please try again.', String genericErrorText = 'Something went wrong. Please try again.', String currentPinStepLabel = 'Step 1 of 3', String newPinStepLabel = 'Step 2 of 3', String confirmPinStepLabel = 'Step 3 of 3', String backSemanticLabel = 'Go back', String successTitle = 'PIN Changed', String successMessage = 'Your card PIN has been updated successfully.', String successSemanticLabel = 'PIN changed successfully', String? semanticLabel}) -
const
Properties
- accentColor → Color?
-
Overrides the submit spinner colour. Defaults to
BankThemeData.primary.
final
- animationCurve → Curve?
-
Curve of the error message switcher. Defaults to Curves.linear.
final
- animationDuration → Duration?
-
Duration of the error message switcher. Defaults to
BankTokens.durationBase.
final
- backIcon → IconData
-
Icon of the back button. Defaults to Icons.arrow_back.
final
- backSemanticLabel → String
-
Semantics label of the back button. Defaults to
'Go back'.final - confirmPinStepLabel → String
-
Step indicator on the confirm step. Defaults to
'Step 3 of 3'.final - confirmPinSubtitle → String
-
Subtitle of the confirm step. Defaults to
'Re-enter your new PIN to confirm'.final - confirmPinTitle → String
-
Title of the confirm step. Defaults to
'Confirm new PIN'.final - currentPinStepLabel → String
-
Step indicator on the current PIN step. Defaults to
'Step 1 of 3'.final - currentPinSubtitle → String
-
Subtitle of the current PIN step. Defaults to
'Enter the PIN for your card'.final - currentPinTitle → String
-
Title of the current PIN step. Defaults to
'Enter current PIN'.final - errorTextStyle → TextStyle?
-
Merged over the computed error style (BankTokens.bodySmall in
BankTokens.danger).
final
- foregroundColor → Color?
-
Overrides the step title and back icon colour. Defaults to
BankThemeData.onSurface.
final
- genericErrorText → String
-
Error shown when onSubmit throws. Defaults to
'Something went wrong. Please try again.'.final - hashCode → int
-
The hash code for this object.
no setterinherited
- incorrectPinErrorText → String
-
Error shown when the current PIN is rejected. Defaults to
'Incorrect current PIN. Please try again.'.final - key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
- mismatchErrorText → String
-
Error shown when the two new PINs differ. Defaults to
"PINs don't match. Please try again.".final - newPinStepLabel → String
-
Step indicator on the new PIN step. Defaults to
'Step 2 of 3'.final - newPinSubtitle → String?
-
Subtitle of the new PIN step. Defaults to
'Choose a new <pinLength>-digit PIN'.final - newPinTitle → String
-
Title of the new PIN step. Defaults to
'Enter new PIN'.final - onCancel → VoidCallback?
-
Called when the user dismisses the flow without completing it.
final
-
onSubmit
→ Future<
bool> Function(String currentPin, String newPin) -
Async submit handler. Receives the current PIN and the new PIN.
Return
trueon success,falseon failure (e.g. incorrect current PIN).final - onSuccess → VoidCallback?
-
Called after a successful onSubmit response.
final
- padding → EdgeInsetsGeometry?
-
Overrides the outer padding around the flow. Defaults to none.
final
- pinLength → int
-
Number of digits in the PIN (typically 4 or 6).
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- semanticLabel → String?
-
Overrides the root semantics label. Defaults to the current step title.
final
- stepLabelStyle → TextStyle?
-
Merged over the step indicator style (BankTokens.labelMedium).
final
- subtitleStyle → TextStyle?
-
Merged over the computed subtitle style (BankTokens.bodyMedium).
final
- successColor → Color?
-
Overrides the success badge and icon colour. Defaults to
BankTokens.success.
final
- successIcon → IconData
-
Icon shown in the success badge. Defaults to
Icons.check_circle_outline.
final
- successMessage → String
-
Body text of the success view. Defaults to
'Your card PIN has been updated successfully.'.final - successSemanticLabel → String
-
Semantics label of the success view. Defaults to
'PIN changed successfully'.final - successTitle → String
-
Heading of the success view. Defaults to
'PIN Changed'.final - titleStyle → TextStyle?
-
Merged over the computed title style (BankTokens.headlineMedium).
final
Methods
-
createElement(
) → StatefulElement -
Creates a StatefulElement to manage this widget's location in the tree.
inherited
-
createState(
) → State< BankCardPinManager> -
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