BankSavingsProjectionCard class
Interactive savings projection calculator: pick a deposit amount and a duration, see what you earn.
Two sliders drive a live results panel (a BankSummaryStack block):
the deposit, the projected earnings, and the total at maturity.
Earnings use a simple annual rate pro-rated monthly,
amount * rate / 100 * months / 12, rounded to the currency's minor
units as registered in BankCurrencies. All money strings render via
BankMoneyFormatter and honour the ambient numeral style.
Privacy mode intentionally does NOT mask any figure on this card: every amount is a user-entered hypothetical, not account data, so the results rows render as plain text rather than privacy-aware balance text.
When islamicFinanceMode is enabled on the ambient BankUiScope,
the rate row swaps rateLabel for profitRateLabel and the earnings
row swaps earningsLabel for profitEarningsLabel.
Provide onApply to render a full-width call-to-action button that reports the selected deposit (as a Money) and duration in months.
BankSavingsProjectionCard(
currencyCode: 'BHD',
annualRate: 3.5,
initialAmount: 1000,
initialMonths: 12,
onApply: (deposit, months) => openSavingsAccount(deposit, months),
)
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatefulWidget
- BankSavingsProjectionCard
Constructors
-
BankSavingsProjectionCard({required String currencyCode, required double annualRate, Key? key, double initialAmount = 1000, double minAmount = 100, double maxAmount = 50000, double amountStep = 100, int minMonths = 1, int maxMonths = 36, int initialMonths = 12, void onApply(Money deposit, int months)?, String title = 'Savings projection', String amountLabel = 'Deposit amount', String monthsTemplate = '{n} months', String depositLabel = 'Deposit', String rateLabel = 'Interest rate (AER)', String profitRateLabel = 'Expected profit rate', String earningsLabel = 'Interest earned', String profitEarningsLabel = 'Expected profit', String totalLabel = 'Total at maturity', String applyLabel = 'Start saving', EdgeInsetsGeometry? padding, BorderRadius? radius, Color? backgroundColor, Color? accentColor, List<
BoxShadow> ? shadow, TextStyle? titleStyle, TextStyle? amountStyle}) -
Creates a savings projection calculator card.
const
Properties
- accentColor → Color?
-
Overrides the slider and button accent. Defaults to the theme
primary colour.
final
- amountLabel → String
-
Label above the deposit slider, also used in its semantics.
final
- amountStep → double
-
Increment the deposit slider snaps to (drives its divisions).
final
- amountStyle → TextStyle?
-
Merged over the computed deposit-readout numeral style.
final
- annualRate → double
-
Simple annual rate in percent, e.g.
3.5for 3.5 %.final - applyLabel → String
-
Caption of the onApply button.
final
- backgroundColor → Color?
-
Overrides the card's fill colour. Defaults to the theme surface.
final
- currencyCode → String
-
ISO 4217 currency code used for formatting and for onApply.
final
- depositLabel → String
-
Results row label for the deposit.
final
- earningsLabel → String
-
Results row label for the earnings in conventional mode.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- initialAmount → double
-
Starting deposit selection, clamped into minAmount..maxAmount.
final
- initialMonths → int
-
Starting duration selection, clamped into minMonths..maxMonths.
final
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
- maxAmount → double
-
Upper bound of the deposit slider.
final
- maxMonths → int
-
Upper bound of the duration slider, in months.
final
- minAmount → double
-
Lower bound of the deposit slider.
final
- minMonths → int
-
Lower bound of the duration slider, in months.
final
- monthsTemplate → String
-
Duration display template;
{n}is substituted with the months.final - onApply → void Function(Money deposit, int months)?
-
Renders a call-to-action button when non-null; called with the
selected deposit and duration in months.
final
- padding → EdgeInsetsGeometry?
-
Overrides the card's content padding. Defaults to space4 all round.
final
- profitEarningsLabel → String
-
Replaces earningsLabel when Islamic finance mode is active.
final
- profitRateLabel → String
-
Replaces rateLabel when Islamic finance mode is active.
final
- radius → BorderRadius?
-
Overrides the card's corner radius. Defaults to the theme
cardRadius.
final
- rateLabel → String
-
Results row label for the rate in conventional mode.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
shadow
→ List<
BoxShadow> ? -
Overrides the card shadow. Defaults to BankTokens.shadowCard;
pass
const []to flatten.final - title → String
-
Heading shown at the top of the card.
final
- titleStyle → TextStyle?
-
Merged over the computed title style, so partial overrides work.
final
- totalLabel → String
-
Results row label for the total at maturity.
final
Methods
-
createElement(
) → StatefulElement -
Creates a StatefulElement to manage this widget's location in the tree.
inherited
-
createState(
) → State< BankSavingsProjectionCard> -
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