BankFinancialHealthScore class
Composite financial wellness score card: one glanceable number with tappable factor drill-downs.
Renders a 270 degree segmented arc gauge (red, amber, green bands) with the overall score centered in hero numerals and the title beneath it. When previousScore is provided the sweep animates from the old position and a delta chip appears under the gauge. Below the gauge, each BankHealthFactor renders as a row with its icon, label, a thin progress bar tinted by its score (danger below 0.4, warning below 0.7, positive otherwise), an optional tip line, and a chevron when onFactorTap is set.
Score digits respect the ambient NumeralStyle. The sweep animation
jumps straight to the final position under
MediaQuery.disableAnimations. The gauge semantics summarise the
score and the weakest factor.
BankFinancialHealthScore(
score: 72,
previousScore: 65,
factors: const [
BankHealthFactor(
id: 'savings',
label: 'Savings rate',
score: 0.35,
icon: Icons.savings_outlined,
tip: 'Try saving 10% of every paycheck.',
),
BankHealthFactor(
id: 'spending',
label: 'Spending discipline',
score: 0.8,
icon: Icons.speed_outlined,
),
],
onFactorTap: (factor) => openFactorDetail(factor.id),
)
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatefulWidget
- BankFinancialHealthScore
Constructors
-
BankFinancialHealthScore({required int score, required List<
BankHealthFactor> factors, Key? key, int? previousScore, void onFactorTap(BankHealthFactor factor)?, String title = 'Financial health', double gaugeSize = 150, EdgeInsetsGeometry? padding, BorderRadius? radius, Color? backgroundColor, List<BoxShadow> ? shadow, Color? dangerColor, Color? warningColor, Color? positiveColor, TextStyle? scoreStyle, TextStyle? titleStyle, TextStyle? factorLabelStyle, TextStyle? factorTipStyle, IconData? chevronIcon, Duration? animationDuration, Curve? animationCurve, String? semanticLabel}) -
const
Properties
- animationCurve → Curve?
-
Overrides the sweep animation curve. Defaults to
BankTokens.curveEmphasized.
final
- animationDuration → Duration?
-
Overrides the sweep animation duration. Defaults to
BankTokens.durationXSlow.
final
- backgroundColor → Color?
-
Overrides the card fill colour. Defaults to the theme surface.
final
- chevronIcon → IconData?
-
Overrides the factor row chevron glyph. Defaults to
Icons.chevron_right.
final
- dangerColor → Color?
-
Overrides the critical band tint (gauge band, factor bars, delta
chip). Defaults to BankTokens.danger.
final
- factorLabelStyle → TextStyle?
-
Merged over each factor label style (bodyMedium, onSurface).
final
-
factors
→ List<
BankHealthFactor> -
Individual wellness dimensions rendered as rows under the gauge.
final
- factorTipStyle → TextStyle?
-
Merged over each factor tip style (bodySmall, onSurfaceVariant).
final
- gaugeSize → double
-
Diameter of the arc gauge.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
- onFactorTap → void Function(BankHealthFactor factor)?
-
Called with the tapped factor; enables the row chevrons.
final
- padding → EdgeInsetsGeometry?
-
Overrides the card content padding. Defaults to space4 all round.
final
- positiveColor → Color?
-
Overrides the healthy band tint. Defaults to the theme
positiveBalance colour.
final
- previousScore → int?
-
Enables the delta chip and animates the sweep from this value.
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
- score → int
-
Overall wellness score from 0 to 100.
final
- scoreStyle → TextStyle?
-
Merged over the hero score numeral style inside the gauge.
final
- semanticLabel → String?
-
Overrides the computed gauge semantics label.
final
-
shadow
→ List<
BoxShadow> ? -
Overrides the card shadow. Defaults to BankTokens.shadowCard;
pass
const []to flatten.final - title → String
-
Heading shown under the score inside the gauge.
final
- titleStyle → TextStyle?
-
Merged over the title style (labelMedium, score tint).
final
- warningColor → Color?
-
Overrides the middling band tint. Defaults to
BankTokens.warning.
final
Methods
-
createElement(
) → StatefulElement -
Creates a StatefulElement to manage this widget's location in the tree.
inherited
-
createState(
) → State< BankFinancialHealthScore> -
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