Skip to content

Commit a6526cc

Browse files
committed
https://github.com/caseyryan/flutter_multi_formatter/issues/123
1 parent 1d6f594 commit a6526cc

3 files changed

Lines changed: 14 additions & 2 deletions

File tree

CHANGELOG.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
## [2.10.6]
1+
## [2.10.9]
2+
- Fixed https://github.com/caseyryan/flutter_multi_formatter/issues/123
3+
- Fixed https://github.com/caseyryan/flutter_multi_formatter/issues/116
24
- Fixed https://github.com/caseyryan/flutter_multi_formatter/issues/122 by adding triggerOnCountrySelectedInitially param to CountryDropdown
35
## [2.10.5]
46
- CountryDropdown can now be filtered. If you need it to show only a

lib/formatters/currency_input_formatter.dart

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -435,6 +435,15 @@ class CurrencyInputFormatter extends TextInputFormatter {
435435
if (input.isEmpty) return false;
436436
var clearedInput = input;
437437
if (leadingSymbol.isNotEmpty) {
438+
/// allows to get read of an odd minus in front of a leading symbol
439+
/// https://github.com/caseyryan/flutter_multi_formatter/issues/123
440+
var sub = clearedInput.substring(
441+
0,
442+
clearedInput.indexOf(leadingSymbol) + 1,
443+
);
444+
if (sub.length > leadingSymbol.length) {
445+
return true;
446+
}
438447
clearedInput = clearedInput.replaceAll(leadingSymbol, '');
439448
}
440449
if (trailingSymbol.isNotEmpty) {

lib/formatters/formatter_utils.dart

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -556,7 +556,8 @@ String toCurrencyString(
556556
}
557557

558558
final str = sb.toString();
559-
final evenPart = addedMantissaSeparator ? str.substring(0, str.indexOf('.')) : str;
559+
final evenPart =
560+
addedMantissaSeparator ? str.substring(0, str.indexOf('.')) : str;
560561

561562
int skipEvenNumbers = 0;
562563
String shorteningName = '';

0 commit comments

Comments
 (0)