File tree Expand file tree Collapse file tree 3 files changed +59
-5
lines changed Expand file tree Collapse file tree 3 files changed +59
-5
lines changed Original file line number Diff line number Diff line change @@ -186,10 +186,6 @@ class TextNumberFilter {
186
186
if (! allowing && startPosition < state.index) {
187
187
state.remove (startPosition, state.index);
188
188
}
189
- if (options.fixNumber) {
190
- state.prefix ('0' );
191
- integerDigits = 1 ;
192
- }
193
189
allowing = true ;
194
190
startPosition = state.index;
195
191
}
Original file line number Diff line number Diff line change 1
1
name : number_text_input_formatter
2
2
description : Number Text Input Formatter for Flutter
3
- version : 1.0.0+7
3
+ version : 1.0.0+8
4
4
5
5
homepage : https://github.com/joutvhu/number_text_input_formatter
6
6
repository : https://github.com/joutvhu/number_text_input_formatter.git
Original file line number Diff line number Diff line change @@ -1011,4 +1011,62 @@ void main() {
1011
1011
);
1012
1012
expect (result.text, '14%' );
1013
1013
});
1014
+
1015
+ test ('percentage_text_input_formatter_2' , () {
1016
+ var result = PercentageTextInputFormatter (
1017
+ integerDigits: 12 ,
1018
+ decimalDigits: 2 ,
1019
+ decimalSeparator: '.' ,
1020
+ groupDigits: 3 ,
1021
+ groupSeparator: ',' ,
1022
+ ).formatEditUpdate (
1023
+ const TextEditingValue (
1024
+ text: '' ,
1025
+ ),
1026
+ const TextEditingValue (
1027
+ text: '.' ,
1028
+ ),
1029
+ );
1030
+ expect (result.text, '0.00' );
1031
+ });
1032
+
1033
+ test ('percentage_text_input_formatter_3' , () {
1034
+ var result = PercentageTextInputFormatter (
1035
+ integerDigits: 12 ,
1036
+ decimalDigits: 2 ,
1037
+ decimalSeparator: '.' ,
1038
+ groupDigits: 3 ,
1039
+ groupSeparator: ',' ,
1040
+ allowNegative: true ,
1041
+ overrideDecimalPoint: false ,
1042
+ insertDecimalPoint: false ,
1043
+ insertDecimalDigits: false ,
1044
+ ).formatEditUpdate (
1045
+ const TextEditingValue (
1046
+ text: '' ,
1047
+ ),
1048
+ const TextEditingValue (
1049
+ text: '-.' ,
1050
+ ),
1051
+ );
1052
+ expect (result.text, '-0.00' );
1053
+ });
1054
+
1055
+ test ('percentage_text_input_formatter_4' , () {
1056
+ var result = PercentageTextInputFormatter (
1057
+ integerDigits: 12 ,
1058
+ decimalDigits: 2 ,
1059
+ decimalSeparator: '.' ,
1060
+ groupDigits: 3 ,
1061
+ groupSeparator: ',' ,
1062
+ ).formatEditUpdate (
1063
+ const TextEditingValue (
1064
+ text: '' ,
1065
+ ),
1066
+ const TextEditingValue (
1067
+ text: '.24' ,
1068
+ ),
1069
+ );
1070
+ expect (result.text, '0.24' );
1071
+ });
1014
1072
}
You can’t perform that action at this time.
0 commit comments