currency_kit_flutter 0.0.2 copy "currency_kit_flutter: ^0.0.2" to clipboard
currency_kit_flutter: ^0.0.2 copied to clipboard

Flutter widgets for currency_kit — a currency picker, an exchange-rate editor, a switch button and money text, all built on display-only conversion.

currency_kit_flutter #

Flutter widgets for currency_kit, built around the same rule:

An amount you store is always in one canonical currency. A second currency is a view of it.

Every widget here converts at render time and writes nothing back, so a user changing the currency they read cannot change what you keep.

Widgets #

Widget For
MoneyText Rendering a Money, converted through a rate when one is active
CurrencySwitchButton Showing which currency is being read, and changing it
CurrencyPickerSheet / showCurrencyPicker Choosing among currencies
ExchangeRateEditorSheet / showExchangeRateEditor Choosing which rate to display through
// The books are kept in AED; the user is reading USD.
final rate = ExchangeRate(base: CurrencyCode.usd, quote: CurrencyCode.aed, rate: 3.67);

MoneyText(const Money(36.70, CurrencyCode.aed), rate: rate); // reads "USD 10.00"

Change the rate and the same stored amount simply reads differently. There is no API here that writes a converted value back.

No dependencies you did not ask for #

The package depends on flutter and currency_kit, and nothing else. Where a design system would normally leak in, it is a callback instead:

CurrencyPickerSheet(
  options: options,
  leadingBuilder: (context, code) => CountryFlag.fromCurrencyCode(code.code),
  onConfirmed: (option) => setState(() => displayed = option.code),
);

Styling comes from the ambient Theme.

Strings #

Supply your own; the package bundles no localization machinery:

CurrencyKitLocalizationsScope(
  localizations: MyCurrencyStrings(),
  child: child,
);

CurrencyKitLocalizations.fallback provides English for development and tests.

Accessibility #

Built in, not retrofitted:

  • CurrencySwitchButton is one button with a label and a value — a screen reader hears "Change currency, USD, 1 USD equals 3.67 AED" as a single control, not three fragments. The visible code and caption are excluded so they are not read twice.
  • Picker and rate-editor rows carry selected and inMutuallyExclusiveGroup, and merge into one node each.
  • MoneyText renders text that names its own currency; semanticsLabel overrides it where a different reading is wanted.

The rate editor is generic #

The options are a list, not a fixed current/live/manual triple:

showExchangeRateEditor(
  context,
  base: CurrencyCode.usd,
  quote: CurrencyCode.aed,
  options: const [
    RateOption(label: 'Current rate', rate: 3.67),
    RateOption(label: 'Live rate', rate: 3.69),
    RateOption.manual(label: 'Manual'),
  ],
  onConfirmed: (rate, index) => setState(() => _rate = rate),
);

Confirm stays disabled until a manual entry is a positive, finite number.

0
likes
150
points
141
downloads

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

Flutter widgets for currency_kit — a currency picker, an exchange-rate editor, a switch button and money text, all built on display-only conversion.

Topics

#money #currency #exchange-rate #widget #picker

License

MIT (license)

Dependencies

currency_kit, flutter

More

Packages that depend on currency_kit_flutter