From 2335a05ed9424d5fe92b46c4b63e356e5c893558 Mon Sep 17 00:00:00 2001
From: vjrj <vjrj@comunes.org>
Date: Sat, 27 May 2023 09:43:37 +0200
Subject: [PATCH] Only clear form in some cases

---
 lib/ui/screens/first_screen.dart | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/lib/ui/screens/first_screen.dart b/lib/ui/screens/first_screen.dart
index 3a8d3a85..2f820e66 100644
--- a/lib/ui/screens/first_screen.dart
+++ b/lib/ui/screens/first_screen.dart
@@ -79,8 +79,12 @@ class _FirstScreenState extends State<FirstScreen> {
             }
           }
         });
-
-        context.read<PaymentCubit>().reset();
+        final PaymentStatus paymentStatus =
+            context.read<PaymentCubit>().state.status;
+        if (paymentStatus == PaymentStatus.sending ||
+            paymentStatus == PaymentStatus.isSent) {
+          context.read<PaymentCubit>().reset();
+        }
         return BlocBuilder<PaymentCubit, PaymentState>(
             builder: (BuildContext context, PaymentState state) =>
                 Stack(children: <Widget>[
-- 
GitLab