BankOverdraftCushionMeter class
Fee-free overdraft cushion display, equivalent to a "SpotMe" style meter: how much of a no-fee overdraft allowance has been used and how much cushion remains.
The card shows a title with a positive feeFreeLabel chip, a thick
rounded meter of used against limit (the fill turns
BankTokens.warning above 70 percent and BankTokens.danger above
90 percent), the computed remaining amount, limit labels at the track
ends, an optional increase hint when nextEligibleIncrease is set,
and an enable Switch when onChanged is provided. When enabled is
false the meter dims and disabledExplainer replaces the remaining
line.
All monetary values render through BankBalanceText, so they mask automatically when privacy mode is active.
BankOverdraftCushionMeter(
limit: Money.fromDouble(200, 'USD'),
used: Money.fromDouble(48.50, 'USD'),
nextEligibleIncrease: Money.fromDouble(50, 'USD'),
enabled: true,
onChanged: (value) => setCushionEnabled(value),
onAdjust: openIncreaseFlow,
)
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatelessWidget
- BankOverdraftCushionMeter
Constructors
-
BankOverdraftCushionMeter({required Money limit, required Money used, required bool enabled, Key? key, Money? nextEligibleIncrease, ValueChanged<
bool> ? onChanged, VoidCallback? onAdjust, String title = 'Overdraft cushion', String feeFreeLabel = 'Fee-free', String remainingTemplate = '{remaining} remaining', String increaseTemplate = 'Increase available: {amount}', String disabledExplainer = 'Your cushion is off. Turn it on to spend a ' 'little past zero without fees.', EdgeInsetsGeometry? padding, BorderRadius? radius, Color? backgroundColor, List<BoxShadow> ? shadow, Color? accentColor, TextStyle? titleStyle, TextStyle? subtitleStyle, TextStyle? amountStyle, double? meterHeight, IconData? chevronIcon, Duration? animationDuration, Curve? animationCurve, String? semanticLabel}) -
const
Properties
- accentColor → Color?
-
Accent for the meter fill, track tint, and increase row. Defaults
to the theme primary (warning/danger thresholds still apply).
final
- amountStyle → TextStyle?
-
Merged over the money style in the remaining and increase lines.
final
- animationCurve → Curve?
-
Curve of the meter fill animation. Defaults to
BankTokens.curveEmphasized.
final
- animationDuration → Duration?
-
Duration of the meter fill animation. Defaults to
BankTokens.durationBase.
final
- backgroundColor → Color?
-
Overrides the card fill color. Defaults to the theme surface.
final
- chevronIcon → IconData?
-
Overrides the increase row chevron. Defaults to a
direction-aware
Icons.chevron_right/Icons.chevron_left.final - disabledExplainer → String
-
Explainer shown instead of the remaining line while enabled is
false.final - enabled → bool
-
Whether the overdraft cushion is currently active.
final
- feeFreeLabel → String
-
Label for the positive "no fees" chip next to the title.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- increaseTemplate → String
-
Template for the increase hint row. The
{amount}token is replaced with nextEligibleIncrease.final - key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
- limit → Money
-
Total fee-free overdraft allowance.
final
- meterHeight → double?
-
Height of the meter track. Defaults to 14.
final
- nextEligibleIncrease → Money?
-
Next limit increase the customer is eligible for. When set, a hint
row is shown beneath the meter (only while enabled is
true).final - onAdjust → VoidCallback?
-
Called when the customer taps the increase hint row. When
null, the hint row is static and shows no chevron.final -
onChanged
→ ValueChanged<
bool> ? -
Called when the customer toggles the cushion on or off. When
null, no Switch is shown.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
- remainingTemplate → String
-
Template for the remaining-cushion line. The
{remaining}token is replaced with the computed remaining Money.final - runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- semanticLabel → String?
-
Overrides the computed meter semantics label.
final
-
shadow
→ List<
BoxShadow> ? -
Overrides the card shadow. Defaults to BankTokens.shadowCard;
pass
const []to flatten.final - subtitleStyle → TextStyle?
-
Merged over the remaining line and disabledExplainer text style.
final
- title → String
-
Card title.
final
- titleStyle → TextStyle?
-
Merged over the title style (labelLarge, onSurface).
final
- used → Money
-
Portion of limit currently drawn down.
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