BankCreditLimitAdjuster class

User-controlled credit limit card: the customer drags their own limit.

Shows the currently selected limit as a large numeral that updates live while dragging, above a slider spanning from the amount already used (the limit can never drop below current usage) up to the bank approved maximum. Values snap to round increments and a subtle marker on the track pins the limit configured today. A thin used-versus-limit progress bar turns BankTokens.danger once utilisation passes 90 percent of the selection.

A commit button appears only when the selection differs from the configured limit: it shows an inline spinner while onCommit runs, flashes a success check when it resolves true, and reverts the slider to the configured limit when it resolves false or throws.

Money is rendered through BankBalanceText and BankMoneyFormatter, so privacy mode and numeral style from the ambient BankUiScope are respected. The slider announces formatted values to assistive technologies.

BankCreditLimitAdjuster(
  currentLimit: Money.fromDouble(4500, 'USD'),
  maxApproved: Money.fromDouble(8000, 'USD'),
  used: Money.fromDouble(1250, 'USD'),
  onCommit: (newLimit) async => api.setCardLimit(newLimit),
)
Inheritance

Constructors

BankCreditLimitAdjuster({required Money currentLimit, required Money maxApproved, required Money used, required Future<bool> onCommit(Money newLimit), Key? key, String title = 'Your card limit', String usedTemplate = '{used} used of {limit}', String maxLabel = 'Bank approved maximum', String commitLabel = 'Confirm new limit', EdgeInsetsGeometry? padding, BorderRadius? radius, Color? backgroundColor, List<BoxShadow>? shadow, Color? accentColor, TextStyle? titleStyle, TextStyle? subtitleStyle, TextStyle? amountStyle, IconData? successIcon, Duration? animationDuration, Curve? animationCurve, String? semanticLabel})
const

Properties

accentColor Color?
Overrides the accent used by the progress fill, slider, spinner, and commit button. Defaults to the theme primary.
final
amountStyle TextStyle?
Style for the large selected-limit numeral. Defaults to the BankBalanceText default style.
final
animationCurve Curve?
Curve of the commit-button reveal animation. Defaults to BankTokens.curveStandard.
final
animationDuration Duration?
Duration of the commit-button reveal animation. Defaults to BankTokens.durationBase.
final
backgroundColor Color?
Overrides the card fill color. Defaults to the theme surface.
final
commitLabel String
Label of the commit button shown when the selection changed.
final
currentLimit Money
The limit configured on the card today, drawn as a subtle marker on the slider track.
final
hashCode int
The hash code for this object.
no setterinherited
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
maxApproved Money
The hard ceiling the bank has approved.
final
maxLabel String
Caption shown next to the formatted maxApproved amount.
final
onCommit Future<bool> Function(Money newLimit)
Persists the newly selected limit. Resolve true to accept (a success check is flashed) or false to reject (the slider reverts to the configured limit).
final
padding EdgeInsetsGeometry?
Overrides the card content padding. Defaults to EdgeInsets.all(BankTokens.space4).
final
radius BorderRadius?
Overrides the card corner radius. Defaults to the theme cardRadius.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
semanticLabel String?
Overrides the slider semantics label. Defaults to title.
final
shadow List<BoxShadow>?
Overrides the card shadow. Defaults to BankTokens.shadowCard; pass const [] to flatten.
final
subtitleStyle TextStyle?
Merged over the computed microtext style (labelSmall, variant color) used under the progress bar and on the maximum row.
final
successIcon IconData?
Icon flashed on the commit button after a successful commit. Defaults to BankIcons.success.
final
title String
Card heading.
final
titleStyle TextStyle?
Merged over the computed title style (bodyMedium, variant color).
final
used Money
Amount of the limit already consumed. The slider cannot go below this value.
final
usedTemplate String
Microtext template under the progress bar. {used} and {limit} are replaced with formatted amounts.
final

Methods

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