BankAmountInputField class
A format-as-you-type monetary text field: the form-embedded counterpart
to BankAmountKeypad.
The field renders the currency symbol (resolved through
BankMoneyFormatter's symbol table) as a fixed prefix, groups thousands
live while the user types, restricts fraction digits to the currency's
precision (0 for JPY, 3 for KWD/BHD, 2 by default), and converts digits
per NumeralStyle: falling back to the ambient BankUiScope style when
numeralStyle is null.
The parsed value is emitted as a Decimal via onChanged so hosts can
construct Money(amount, currencyCode) directly. Empty input reports
null. When the entered amount exceeds maxAmount (or falls below
minAmount), the entry text and helper line turn BankTokens.danger and
null is reported.
A non-null errorText replaces the helper line and turns the border
BankTokens.danger, matching BankTextField.
BankAmountInputField(
currencyCode: 'USD',
onChanged: (amount) => setState(() => _amount = amount),
label: 'Amount',
helperText: 'Available: \$5,000.00',
maxAmount: Decimal.parse('5000'),
)
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatefulWidget
- BankAmountInputField
Constructors
-
BankAmountInputField({required String currencyCode, required ValueChanged<
Decimal?> onChanged, Key? key, Decimal? initialAmount, Decimal? maxAmount, Decimal? minAmount, String? label, String? helperText, String? errorText, bool enabled = true, bool autofocus = false, FocusNode? focusNode, BankBalanceSize displaySize = BankBalanceSize.large, NumeralStyle? numeralStyle, EdgeInsetsGeometry? contentPadding, BorderRadius? radius, Color? backgroundColor, TextStyle? amountStyle, TextStyle? labelStyle, TextStyle? helperStyle, TextStyle? errorStyle, String? semanticLabel}) -
const
Properties
- amountStyle → TextStyle?
-
Merged over the computed entry style (the displaySize numeral
tier coloured per the in-range state).
final
- autofocus → bool
-
Whether the field requests focus when first built.
final
- backgroundColor → Color?
-
Overrides BankThemeData.surface as the fill while enabled
(the disabled fill stays BankThemeData.surfaceVariant).
final
- contentPadding → EdgeInsetsGeometry?
-
Overrides the field's inner content padding (default:
BankTokens.space4 horizontal by BankTokens.space3 vertical).
final
- currencyCode → String
-
ISO 4217 currency code, e.g.
'USD','JPY'. Determines the prefix symbol and the number of fraction digits accepted.final - displaySize → BankBalanceSize
-
Numeral typography tier (from BankThemeData) used for the entry text.
final
- enabled → bool
-
When
falsethe field is greyed out and does not accept input.final - errorStyle → TextStyle?
-
Merged over the computed errorText style (default:
BankTokens.bodySmall in BankTokens.danger).
final
- errorText → String?
-
Error message. When non-null the border turns BankTokens.danger and
the label is tinted accordingly.
final
- focusNode → FocusNode?
-
Optional external focus node.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- helperStyle → TextStyle?
-
Merged over the computed helperText style (default:
BankTokens.bodySmall coloured per the in-range state).
final
- helperText → String?
-
Helper text rendered below the field. Replaced by errorText when set
and tinted BankTokens.danger while the amount is out of range.
final
- initialAmount → Decimal?
-
Pre-filled amount shown when the field first builds.
final
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
- label → String?
-
Label rendered above the field. Coloured BankTokens.danger on error.
final
- labelStyle → TextStyle?
-
Merged over the computed label style (default:
BankTokens.labelMedium coloured per the error state).
final
- maxAmount → Decimal?
-
Upper bound; amounts above it render in BankTokens.danger and report
nullto onChanged.final - minAmount → Decimal?
-
Lower bound; amounts below it render in BankTokens.danger and report
nullto onChanged.final - numeralStyle → NumeralStyle?
-
Numeral script for the entered digits. Falls back to
BankUiScopeData.numeralStyle when
null.final -
onChanged
→ ValueChanged<
Decimal?> -
Called on every edit with the parsed amount, or
nullwhen the field is empty or the amount is outside minAmount..maxAmount.final - radius → BorderRadius?
-
Overrides BankThemeData.buttonRadius as the field border radius.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- semanticLabel → String?
-
Overrides label as the field's semantics label.
final
Methods
-
createElement(
) → StatefulElement -
Creates a StatefulElement to manage this widget's location in the tree.
inherited
-
createState(
) → State< BankAmountInputField> -
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