Skip to content
Get started
Menu
Get started

Amount text

AmountText shows a Money value. It formats through the active locale’s MoneyFormat, uses tabular figures so digits line up, and gives screen readers the amount in words.

The widget formats the amount and currency you pass; it never adds, rounds or converts.

Amount roles from caption to display, followed by total, muted and struck amounts.Amount roles from caption to display, followed by total, muted and struck amounts.
Amount text
Amount roles from caption to display, followed by total, muted and struck amounts at 200 percent text.
200% text
example/lib/screens/steps/fees_step.dart
AmountText(Money.idr(fee));

Variants: caption, row, total, large, display.

Variant Role Use
caption 13/18 tabular Legends and meta lines
row (default) 15/20 regular tabular Line items
total 15/20 heading weight Total row value
large 20/28 amountLarge Action bar, balance, chart headline
display 32/36 display The one display amount on a screen

Large and display text cap at 1.6 times scaling. Total uses heading weight even when the host selects a heavier amount weight. Use style for color and decoration only, such as muted or struck values.

Migrate the deprecated emphasis: true to variant: AmountTextVariant.display.

AmountText(quote.total, variant: AmountTextVariant.display);

The default: the 15/20 label size, regular weight, aligned to the end. Use it inside rows.

variant: AmountTextVariant.display uses the 32/36 display style with PaymentTheme.amountWeight. Use it for the one total per screen.

AmountText(quote.total, variant: AmountTextVariant.display);

style is merged over the base style, for example to strike through an amount, as the transaction list does for failed and canceled payments.

AmountText(
record.amount,
style: const TextStyle(decoration: TextDecoration.lineThrough),
);
  • Amounts 20 px and larger, and every display amount, follow text scaling only up to 1.6×, as platform large titles do.
  • An amount that still does not fit scales down instead of being clipped. A hidden digit is worse than a smaller one.
  • It never wraps: an amount is always one line.
Situation Variant / composition Payment example
Checkout payable amount total Use total once beside the Pay action; row for list amounts.

Use Inline for non-money copy.

Choose the variant by where the amount is read:

Where the amount is read Variant
Supporting annotation caption
Repeated transaction row
Payable sum total
Standalone summary large
Main transaction amount display

Pass the amount from the host. For failed or canceled payments, apply the documented strike-through style; a refund keeps the original amount unchanged.

Do: Use total once beside the Pay action; row for list amounts.

Don’t: Format money with floating-point string concatenation.

  • Show the currency the host charges in. Do not convert in the UI.
  • One display amount per screen. Two totals that look equal compete.
  • Never animate an amount changing. Show the new value, and explain the change with a notice banner when it matters.
  • Screen readers hear MoneyFormat.spoken, not the symbol-and-digits string.
Example transaction detail screen with synthetic dataExample transaction detail screen with synthetic data
Example: transaction detail

AmountText

class AmountText extends StatelessWidget · lib/src/foundation/primitives.dart

Renders Money with the active locale's formatter and a spoken label.

ParameterTypeDefaultDescription
moneyrequiredpositionalMoney——
style:TextStyle?—Color and decoration only: muted or struck amounts.
variant:AmountTextVariantAmountTextVariant.rowSemantic amount role. Default is the regular row label.
emphasis:boolfalseLegacy display amount, replaced by the display variant.

AmountTextVariant

enum AmountTextVariant · lib/src/foundation/primitives.dart

The five amount looks. Nothing else exists.

ValueDescription
caption13/18 caption for legends and meta lines.
row15/20 regular label for line items. Default.
total15/20 at heading weight for Total values.
large20/28 headline amount, capped at 1.6 times text scale.
display32/36 display amount, capped at 1.6 times text scale.