Skip to content

Commit

Permalink
Fix #114
Browse files Browse the repository at this point in the history
  • Loading branch information
caseyryan committed Jul 27, 2023
1 parent 76ab642 commit b3f0d17
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 7 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
## [2.11.6]
Potential fix https://github.com/caseyryan/flutter_multi_formatter/issues/114
## [2.11.5]
Added Luhn algorithm to validate card numbers
## [2.11.4]
Expand Down
4 changes: 4 additions & 0 deletions example/ios/Runner.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@
TargetAttributes = {
97C146ED1CF9000F007C117D = {
CreatedOnToolsVersion = 7.3.1;
DevelopmentTeam = ZR8BB8SA45;
LastSwiftMigration = 1100;
};
};
Expand Down Expand Up @@ -296,6 +297,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
DEVELOPMENT_TEAM = ZR8BB8SA45;
ENABLE_BITCODE = NO;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
Expand Down Expand Up @@ -428,6 +430,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
DEVELOPMENT_TEAM = ZR8BB8SA45;
ENABLE_BITCODE = NO;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
Expand Down Expand Up @@ -455,6 +458,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
DEVELOPMENT_TEAM = ZR8BB8SA45;
ENABLE_BITCODE = NO;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IDEDidComputeMac32BitWarning</key>
<true/>
</dict>
</plist>
2 changes: 1 addition & 1 deletion example/lib/pages/money_format_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ class _MoneyFormatPageState extends State<MoneyFormatPage> {
),
keyboardType: TextInputType.numberWithOptions(
decimal: true,
signed: true,
// signed: true,
),
inputFormatters: [
CurrencyInputFormatter(
Expand Down
2 changes: 1 addition & 1 deletion example/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ packages:
path: ".."
relative: true
source: path
version: "2.11.5"
version: "2.11.6"
flutter_test:
dependency: "direct dev"
description: flutter
Expand Down
13 changes: 9 additions & 4 deletions lib/formatters/currency_input_formatter.dart
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class CurrencySymbols {
static const String EURO_SIGN = '€';
static const String POUND_SIGN = '£';
static const String YEN_SIGN = '¥';
static const String ETHERIUM_SIGN = 'Ξ';
static const String ETHEREUM_SIGN = 'Ξ';
static const String BITCOIN_SIGN = 'Ƀ';
static const String SWISS_FRANK_SIGN = '₣';
static const String RUBLE_SIGN = '₽';
Expand All @@ -55,7 +55,7 @@ class CurrencyInputFormatter extends TextInputFormatter {
final int? maxTextLength;
final ValueChanged<num>? onValueChange;

bool _printDebugInfo = false;
bool _printDebugInfo = true;

/// [thousandSeparator] specifies what symbol will be used to separate
/// each block of 3 digits, e.g. [ThousandSeparator.Comma] will format
Expand All @@ -67,7 +67,7 @@ class CurrencyInputFormatter extends TextInputFormatter {
/// added in front of the resulting string. E.g. $ or €
/// some of the signs are available via constants like [CurrencySymbols.EURO_SIGN]
/// but you can basically add any string instead of it. The main rule is that the string
/// must not contain digits, preiods, commas and dashes
/// must not contain digits, periods, commas and dashes
/// [trailingSymbol] is the same as leading but this symbol will be added at the
/// end of your resulting string like 1,250€ instead of €1,250
/// [useSymbolPadding] adds a space between the number and trailing / leading symbols
Expand Down Expand Up @@ -371,7 +371,12 @@ class CurrencyInputFormatter extends TextInputFormatter {
longerString: newText,
shorterString: oldText,
);
if (_containsMantissaSeparator(newChars)) {

/// [hasWrongSeparator] is an attempt to fix this
/// https://github.com/caseyryan/flutter_multi_formatter/issues/114
/// Not sure if it will have some side effect
final hasWrongSeparator = newText.contains(',.');
if (_containsMantissaSeparator(newChars) || hasWrongSeparator) {
return true;
}
}
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: flutter_multi_formatter
description: A package of formatters for international phone numbers, credit / debit cards and a masked formatter
version: 2.11.5
version: 2.11.6
homepage: https://github.com/caseyryan/flutter_multi_formatter

environment:
Expand Down

0 comments on commit b3f0d17

Please sign in to comment.