Skip to content

Commit

Permalink
Merge pull request #2 from santhoshvgts/vg-amount-form-field-fix
Browse files Browse the repository at this point in the history
Amount form field controller max length Added
  • Loading branch information
santhoshvgts committed Mar 18, 2024
2 parents 14cbe9a + 21eef27 commit e16a541
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lib/form/utils/form_field_controller.dart
Original file line number Diff line number Diff line change
Expand Up @@ -256,8 +256,9 @@ class AmountFormFieldController extends FormFieldController {

String? requiredText;
NumberCurrencyFormat? currencyFormat;
int maxLength;

AmountFormFieldController(Key fieldKey, { bool required = false, this.requiredText, NumberCurrencyFormat? currencyFormat }) : super(fieldKey, required: required) {
AmountFormFieldController(Key fieldKey, { bool required = false, this.requiredText, this.maxLength = 20, NumberCurrencyFormat? currencyFormat }) : super(fieldKey, required: required) {
this.currencyFormat = currencyFormat ?? NumberCurrencyFormat.usd();
}

Expand Down Expand Up @@ -312,7 +313,7 @@ class AmountFormFieldController extends FormFieldController {
TextInputType get textInputType => TextInputType.numberWithOptions(decimal: true);

@override
List<TextInputFormatter> get inputFormatter => [ CurrencyInputFormatter(maxDigits: 50, currencyFormat: currencyFormat) ];
List<TextInputFormatter> get inputFormatter => [ CurrencyInputFormatter(maxDigits: 50, currencyFormat: currencyFormat) , LengthLimitingTextInputFormatter(maxLength)];

@override
bool get allowPaste => false;
Expand Down

0 comments on commit e16a541

Please sign in to comment.