IFSC Field Testing #1
This commit is contained in:
@@ -312,14 +312,16 @@ final _ifscFieldKey = GlobalKey<FormFieldState>();
|
|||||||
onFieldSubmitted: (_) {
|
onFieldSubmitted: (_) {
|
||||||
_validateIFSC();
|
_validateIFSC();
|
||||||
},
|
},
|
||||||
onChanged: (value) {
|
onChanged: (value) {
|
||||||
final trimmed = value.trim().toUpperCase();
|
setState(() {
|
||||||
if (trimmed.length < 11) {
|
final trimmed = value.trim().toUpperCase();
|
||||||
// clear bank/branch if backspace or changed
|
if (trimmed.length < 11) {
|
||||||
bankNameController.clear();
|
// clear bank/branch if backspace or changed
|
||||||
branchNameController.clear();
|
bankNameController.clear();
|
||||||
}
|
branchNameController.clear();
|
||||||
},
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
validator: (value) {
|
validator: (value) {
|
||||||
final pattern = RegExp(r'^[A-Z]{4}0[A-Z0-9]{6}$');
|
final pattern = RegExp(r'^[A-Z]{4}0[A-Z0-9]{6}$');
|
||||||
if (value == null || value.trim().isEmpty) {
|
if (value == null || value.trim().isEmpty) {
|
||||||
@@ -393,19 +395,19 @@ final _ifscFieldKey = GlobalKey<FormFieldState>();
|
|||||||
child: SizedBox(
|
child: SizedBox(
|
||||||
width: double.infinity,
|
width: double.infinity,
|
||||||
child: ElevatedButton(
|
child: ElevatedButton(
|
||||||
onPressed: _isValidating
|
onPressed: _isValidating || ifscController.text.length != 11
|
||||||
? null
|
? null
|
||||||
: () {
|
: () {
|
||||||
final isAccountValid =
|
final isAccountValid =
|
||||||
_accountNumberFieldKey.currentState!.validate();
|
_accountNumberFieldKey.currentState!.validate();
|
||||||
final isConfirmAccountValid =
|
final isConfirmAccountValid =
|
||||||
_confirmAccountNumberFieldKey.currentState!.validate();
|
_confirmAccountNumberFieldKey.currentState!.validate();
|
||||||
final isIfscValid = _ifscFieldKey.currentState!.validate();
|
final isIfscValid = _ifscFieldKey.currentState!.validate();
|
||||||
|
|
||||||
if (isAccountValid && isConfirmAccountValid && isIfscValid) {
|
if (isAccountValid && isConfirmAccountValid && isIfscValid) {
|
||||||
_validateBeneficiary();
|
_validateBeneficiary();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
child: _isValidating
|
child: _isValidating
|
||||||
? const SizedBox(
|
? const SizedBox(
|
||||||
|
|||||||
@@ -505,13 +505,15 @@ class _QuickPayOutsideBankScreen extends State<QuickPayOutsideBankScreen> {
|
|||||||
_validateIFSC();
|
_validateIFSC();
|
||||||
},
|
},
|
||||||
onChanged: (value) {
|
onChanged: (value) {
|
||||||
|
setState(() {
|
||||||
final trimmed = value.trim().toUpperCase();
|
final trimmed = value.trim().toUpperCase();
|
||||||
if (trimmed.length < 11) {
|
if (trimmed.length < 11) {
|
||||||
// clear bank/branch if backspace or changed
|
// clear bank/branch if backspace or changed
|
||||||
bankNameController.clear();
|
bankNameController.clear();
|
||||||
branchNameController.clear();
|
branchNameController.clear();
|
||||||
}
|
}
|
||||||
},
|
});
|
||||||
|
},
|
||||||
validator: (value) {
|
validator: (value) {
|
||||||
final pattern = RegExp(r'^[A-Z]{4}0[A-Z0-9]{6}$');
|
final pattern = RegExp(r'^[A-Z]{4}0[A-Z0-9]{6}$');
|
||||||
if (value == null || value.trim().isEmpty) {
|
if (value == null || value.trim().isEmpty) {
|
||||||
@@ -613,18 +615,18 @@ class _QuickPayOutsideBankScreen extends State<QuickPayOutsideBankScreen> {
|
|||||||
child: SizedBox(
|
child: SizedBox(
|
||||||
width: double.infinity,
|
width: double.infinity,
|
||||||
child: ElevatedButton(
|
child: ElevatedButton(
|
||||||
onPressed: _isValidating
|
onPressed: _isValidating || ifscController.text.length != 11
|
||||||
? null
|
? null
|
||||||
: () {
|
: () {
|
||||||
if (confirmAccountNumberController.text ==
|
if (confirmAccountNumberController.text ==
|
||||||
accountNumberController.text) {
|
accountNumberController.text) {
|
||||||
_validateBeneficiary();
|
_validateBeneficiary();
|
||||||
} else {
|
} else {
|
||||||
setState(() {
|
setState(() {
|
||||||
_validationError =
|
_validationError =
|
||||||
AppLocalizations.of(context)
|
AppLocalizations.of(context)
|
||||||
.accountMismatch;
|
.accountMismatch;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
child: _isValidating
|
child: _isValidating
|
||||||
|
|||||||
Reference in New Issue
Block a user