keep sign/verify pages loaded (#1703)
Matthew Fosse committed
Sep 25, 2024 at 19:15 UTC
9edd87b0afa330f2d3aecfcf3dad9a8bfcb0048c
2 files changed
+10
-2
lib/src/screens/dashboard/widgets/sign_form.dart
+5
-1
@@ -20,7 +20,7 @@ class SignForm extends StatefulWidget {
20
SignFormState createState() => SignFormState();
21
}
22
23
-class SignFormState extends State<SignForm> {
23
+class SignFormState extends State<SignForm> with AutomaticKeepAliveClientMixin {
24
SignFormState()
25
: formKey = GlobalKey<FormState>(),
26
messageController = TextEditingController(),
@@ -42,8 +42,12 @@ class SignFormState extends State<SignForm> {
42
super.dispose();
43
}
44
45
+ @override
46
+ bool get wantKeepAlive => true;
47
+
48
@override
49
Widget build(BuildContext context) {
50
+ super.build(context);
51
return Container(
52
padding: EdgeInsets.only(left: 24, right: 24),
53
child: Column(
lib/src/screens/dashboard/widgets/verify_form.dart
+5
-1
@@ -15,7 +15,7 @@ class VerifyForm extends StatefulWidget {
15
VerifyFormState createState() => VerifyFormState();
16
}
17
18
-class VerifyFormState extends State<VerifyForm> {
18
+class VerifyFormState extends State<VerifyForm> with AutomaticKeepAliveClientMixin {
19
VerifyFormState()
20
: formKey = GlobalKey<FormState>(),
21
messageController = TextEditingController(),
@@ -36,9 +36,13 @@ class VerifyFormState extends State<VerifyForm> {
36
void dispose() {
37
super.dispose();
38
}
39
+
40
+ @override
41
+ bool get wantKeepAlive => true;
42
43
@override
44
Widget build(BuildContext context) {
45
+ super.build(context);
46
return Container(
47
padding: EdgeInsets.only(left: 24, right: 24),
48
child: Form(