Enter amount and contact us#7
Conversation
| } | ||
|
|
||
| bool _validateFields() { | ||
| if (_pinController.text.isEmpty) return false; |
There was a problem hiding this comment.
🟡 Empty amount input silently fails validation with no user feedback
In _validateFields(), when _pinController.text.isEmpty (line 52), the method returns false without showing any SnackBar or user feedback. In contrast, the other two validation failure paths (invalid amount at line 54-66, consent not checked at line 67-79) both display a SnackBar explaining the issue. This was clearly modeled after SetPin._validateFields() in lib/Payments/set_pin.dart:51-90 where every failure path shows a SnackBar. The user taps PAY with an empty field and nothing visibly happens.
| if (_pinController.text.isEmpty) return false; | |
| if (_pinController.text.isEmpty) { | |
| ScaffoldMessenger.of(context).showSnackBar( | |
| SnackBar( | |
| content: Text( | |
| 'Please enter an amount', | |
| textAlign: TextAlign.center, | |
| style: TextStyle(fontFamily: "Cinzel", fontSize: 20.r), | |
| ), | |
| backgroundColor: Colors.redAccent, | |
| duration: Duration(seconds: 2), | |
| ), | |
| ); | |
| return false; | |
| } |
Was this helpful? React with 👍 or 👎 to provide feedback.
| if (_validateFields()) { | ||
| //navigate to next page | ||
| } |
There was a problem hiding this comment.
🔴 PAY button does nothing after successful validation
At lines 325-327, when _validateFields() returns true, the handler body is just a comment //navigate to next page with no actual implementation. The page was derived from SetPin (see lib/Payments/set_pin.dart) which has a full _handleSetPin method that calls the service and navigates. In EnterAmount, this was left empty — so a user who enters a valid amount and checks the consent box gets no response when tapping PAY. Additionally, _isLoading (line 18) is never set to true, so the loading state/disabled button logic at lines 322-355 can never activate.
Prompt for agents
In lib/Payments/enter_amount.dart, the PAY button's onTap handler at lines 324-328 needs a complete implementation. After _validateFields() returns true, the code should:
1. Set _isLoading to true via setState
2. Call the payment service (e.g., _services.makePayment with widget.qrdata, the parsed amount from _pinController.text, and any needed PIN)
3. Navigate to a success or failure page based on the result
4. Handle errors with appropriate SnackBar messages
5. Set _isLoading back to false in a finally block
Refer to lib/Payments/set_pin.dart's _handleSetPin method (around line 96) for the established pattern of handling async service calls with loading state in this codebase.
Was this helpful? React with 👍 or 👎 to provide feedback.
Uh oh!
There was an error while loading. Please reload this page.