Skip to content

Commit

Permalink
Pop EnterPaymentInfoPage after pressing approve on a valid input
Browse files Browse the repository at this point in the history
  • Loading branch information
erdemyerebasmaz committed Nov 5, 2024
1 parent f2c0e05 commit 82df0b3
Showing 1 changed file with 4 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -151,25 +151,23 @@ class _EnterPaymentInfoPageState extends State<EnterPaymentInfoPage> {

Future<void> _onApprovePressed() async {
final inputCubit = context.read<InputCubit>();
_setLoading(true);

try {
_setLoading(true);
await _validateInput();
if (_formKey.currentState!.validate()) {
if (mounted) {
Navigator.of(context).pop();
}
_setLoading(false);
if (mounted) Navigator.pop(context);
inputCubit.addIncomingInput(_paymentInfoController.text, InputSource.inputField);
}
} catch (error) {
_setLoading(false);
_log.warning(error.toString(), error);
if (mounted) {
setState(() {
errorMessage = context.texts().payment_info_dialog_error;
});
}
} finally {
_setLoading(false);
}
}

Expand Down

0 comments on commit 82df0b3

Please sign in to comment.