From 2ddaa2227155d1b60001f7a930b1d0072f56caec Mon Sep 17 00:00:00 2001 From: Gianluca Bettega Date: Thu, 7 Nov 2024 10:58:16 -0300 Subject: [PATCH] 4.14.1 --- CHANGELOG.md | 4 ++++ lib/currency_textfield.dart | 7 +------ pubspec.yaml | 2 +- test/currency_textfield_test.dart | 8 ++++++++ 4 files changed, 14 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 86ca0c2..b841fdc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## [4.14.1] - 2024-11-07 +- Fixed bugs. +- Added tests. + ## [4.14.0] - 2024-11-07 - Added missing min value check. - Fixed zero not being deleted if `showZeroValue` parameter is true.[23](https://github.com/IsaiasSantana/currency_textfield/issues/23) diff --git a/lib/currency_textfield.dart b/lib/currency_textfield.dart index 5d00d53..a591800 100644 --- a/lib/currency_textfield.dart +++ b/lib/currency_textfield.dart @@ -355,15 +355,10 @@ class CurrencyTextFieldController extends TextEditingController { _value = 0; _isNegative = forceNegative; - if (_showZeroValue) { - _changeText(); - } else { - _previewsText = ''; - } - if (_resetSeparator && _startWithSeparator) { _startWithSeparator = false; } + _changeText(); } bool _checkCleanZeroText(String currentText) { diff --git a/pubspec.yaml b/pubspec.yaml index 0fa7fd1..c47aee5 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: currency_textfield description: A flutter package that implements a Controller for currency text input. -version: 4.14.0 +version: 4.14.1 homepage: https://github.com/IsaiasSantana/currency_textfield environment: sdk: '>=3.0.0 <4.0.0' diff --git a/test/currency_textfield_test.dart b/test/currency_textfield_test.dart index c86a2ba..9a3f8ea 100644 --- a/test/currency_textfield_test.dart +++ b/test/currency_textfield_test.dart @@ -239,4 +239,12 @@ void main() { expect(controller.intValue, 30000); expect(controller.doubleTextWithoutCurrencySymbol, '300.00'); }); + + test('clear_zero_value', () { + final controller = + CurrencyTextFieldController(initIntValue: 0, showZeroValue: true); + + controller.clear(); + expect(controller.text, ""); + }); }