PinCodeKeyboard class
This Widget builds custom numeric keyboard on the screen. It presents three
columns with numbers from 1 to 9 in three rows. Below them is the zero, there are
in the two customizable button options on the right direction. To define them use
deleteKeyButton and/or bottomRightKeyboardButton. The right button by default
can be is an auto submit button, delete button and biometrics button.
When the widget is loaded for the first time, on the bottom right of the
page there is no button. At this moment the biometrics for the app are still
not enabled. After at least 1 number has been selected the delete button
shows up. When the length of the input has reached the pin code length, the
button icon disappears. The pin code is encrypted and stored in the
local device secure storage. Then, there is an auto submit for the selected
pin code to the backend for verification. When the pin code is submitted,
the widget should present to the user that the pin verification is in
progress with loading animation. Over the masked pin a Shimmer will be
presented and buttons will change their appearance. The pin code from the
input is auto submitted once its length reaches the returned value from
PinCodeService.getPinLength(), which should return a value less than 10.
After the pin has been saved
successfully in the secure storage, the biometrics icon appear on the bottom
right. When you press it, it triggers enabling of the biometrics event. The
local authentication from the local_auth package is triggered. The user is
asked, if he/she wants to allow the app to use biometrics authentication.
When he/she clicks ok, the biometrics authentication is triggered. When it
is successful, on the screen is displayed a message that the biometrics are
enabled. The next time when the app is restarted, because the pin code
will be stored in the device secure storage, the biometrics authentication
will be automatically triggered and the biometrics icon will be displayed
on the bottom right. When you press it every time it will trigger the
biometric authentication. Note: If biometricsLocalDataSource parameter is
not provided to PinCodeKeyboard the biometrics authentication feature
cannot be used.
For more information on how the widgets work check the functional specification section in the README.md file.
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatelessWidget
- PinCodeKeyboard
Constructors
- PinCodeKeyboard({required PinCodeService pinCodeService, required String translateError(Object error), BiometricsLocalDataSource? biometricsLocalDataSource, PinBiometricsAuthDataSource? biometricsAuthDataSource, String mapBiometricMessageToString(BiometricsMessage message)?, dynamic onAuthenticated(dynamic)?, PinCodeCustomKey? deleteKeyButton, PinCodeCustomKey? bottomRightKeyboardButton, String? localizedReason, bool addDependencies = true, dynamic onError(Object error, String translatedError)?, bool autoPromptBiometric = false, Key? key})
-
const
Properties
- addDependencies → bool
-
If set to true the dependencies will be injected before the building of
the widget, otherwise the user should provide an implementation for the
dependencies
final
- autoPromptBiometric → bool
-
If set to true the biometric authentication will be triggered automatically
when the widget is loaded, requires biometricsLocalDataSource to be provided
otherwise the biometric authentication will be disabled
Default to false
final
- biometricsAuthDataSource → PinBiometricsAuthDataSource?
-
Provides a contract for custom biometrics authentication plugin. If this
parameter is not provided, a default one will be used featuring
LocalAuthenticationfrom the local_auth packagefinal - biometricsLocalDataSource → BiometricsLocalDataSource?
-
Provides a contract to be implemented for the biometrics related methods.
If this parameter is not provided the biometrics authentication is disabled
for the package
final
- bottomRightKeyboardButton → PinCodeCustomKey?
-
Provide custom implementation for the most down right button. If this
parameter is not used, a default button is used, which provides pin code
auto submit, biometrics enabling and biometrics authentication functionalities,
and its icon changes to empty, face, finger. Do not forget to make it clickable.
final
- deleteKeyButton → PinCodeCustomKey?
-
Provide custom implementation for the most down left button, shown when
there is pin code input on the screen. Do not forget to make it clickable.
Default to LeftArrow.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
- localizedReason → String?
-
Provide a custom message, otherwise the default
_enterPinWithBiometricswill be usedfinal - mapBiometricMessageToString → String Function(BiometricsMessage message)?
-
mapBiometricMessageToString will be used to translate the
BiometricsMessageto human readable text and will be used into the default notificationfinal - onAuthenticated → dynamic Function(dynamic)?
-
Callback called when the user authentication succeeds. It accepts a dynamic
value which is forwarded from the
verifyPinCodemethod of the pinCodeService.final - onError → dynamic Function(Object error, String translatedError)?
-
onError is optional function that enable error handling out of the package
final
- pinCodeService → PinCodeService
-
Provides a contract to be implemented for the pin code related methods.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- translateError → String Function(Object error)
-
Handle the translation of the error from the errors stream
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