number_editing_controller 2.1.0
number_editing_controller: ^2.1.0 copied to clipboard
A TextEditingController that formats numbers, decimals, and currencies as you type with locale support.
2.1.0 #
New features #
- Mutable formatting options. All formatting parameters (
locale,groupSeparator,allowNegative, and type-specific options) are now mutable with getters and setters. Changing any option automatically reformats the current value. NumberEditingTextControlleris now an interface backed by three concrete subclasses:CurrencyEditingController,DecimalEditingController, andIntegerEditingController. Existing factory constructors (.currency(),.decimal(),.integer()) continue to work and return the appropriate subclass.CurrencyEditingControllermutable options:currencyName,currencySymbol,decimalSeparator.DecimalEditingControllermutable options:minimalFractionDigits,maximumFractionDigits,decimalSeparator.showCurrencySymboloption onCurrencyEditingController. Set tofalseto hide the currency symbol and its separator from formatted text, useful when the symbol is displayed as a prefix/suffix widget outside the text field.resolvedCurrencySymbolread-only property onCurrencyEditingController. Returns the actual symbol used for formatting, resolved from the currency code and locale.currencySymbolPositionread-only property onCurrencyEditingController. ReturnsCurrencySymbolPosition.prefixor.suffixbased on the current locale.CurrencySymbolPositionenum exported from the public API.
Bug fixes #
- Fixed dead/unreachable code in
RealPart.format(). - Fixed
StaticPart.format()returning0instead ofnullfor its numeric value. - Added bounds clamping for
toStringAsFixed()to prevent crash whenmaximumFractionDigitsexceeds 20.
Improvements #
- Expanded test suite from 114 to 192 tests covering mutable options, subclass behavior, currency symbol visibility, and symbol position.
- Updated README with runtime option examples, class hierarchy table, known limitations, and animated demos.
- Updated example app with currency picker, locale switcher, negative toggle, and external currency symbol placement tabs.
2.0.0 #
Breaking changes #
- Moved implementation files from
lib/parsed_number_format/tolib/src/. OnlyNumberEditingTextControlleris exported from the public API. - Renamed internal
FormatResultinparts.darttoPartFormatResultto avoid naming collision. - Removed unused
CurrencySignPartclass (replaced byStaticPart). - Removed unused
PartLengthclass hierarchy andlengthgetters on format parts. - Updated minimum SDK constraints to Dart >=3.3.0 and Flutter >=3.19.0.
Bug fixes #
- Fixed negative decimal numbers producing incorrect values when typed (e.g.
-5.14was parsed as-4.86). - Fixed crash (
RangeError) when a group separator appeared at the start of input. - Fixed crash (
UnsupportedError) when settingnumbertoNaNorInfinity. - Fixed incorrect grouping for negative numbers with 6+ digits when typed (e.g.
-100000was formatted as-,100,000). - Fixed currency symbol duplication when typing a character before a leading currency symbol.
Improvements #
- Added
repositoryandtopicsfields topubspec.yamlfor better pub.dev discoverability. - Improved package description.
- Added
librarydirective with documentation to the barrel export file. - Added dartdoc comments to all public classes and members.
- Improved and corrected existing doc comments (grammar, terminology).
- Made internal locale utility functions private.
- Replaced custom
String.repeatextension with Dart's built-in*operator. - Replaced list-based
isDigitcheck with a code unit comparison. - Added
dispose()calls in all example app controllers. - Removed default Flutter counter test from the example app.
- Removed FVM dependency from CI workflows.
- Simplified GitHub Actions workflows.
- Rewrote README with usage examples, configuration tables, and parameter documentation.
- Expanded test suite from 11 to 114 tests covering formatting, locales, edge cases, caret positions, and bug regressions.
1.4.0 #
- Updated dependencies and flutter version
1.3.1 #
- Updated library layout
1.3.0 #
- Fixed documentation
- Updated flutter
- Updated dependencies
1.2.1 #
- Updated docs
1.2.0 #
- Added an optional
currencySymbolparameter
1.1.0 #
- Added a flag to allow only unsigned input
1.0.2 #
- Fixed a bug with zero-input deletion
1.0.1 #
- Updated docs
1.0.0 #
- Initial release