Skip to content

Commit 02c2841

Browse files
committed
feat(auth): add email code verification page
- Implemented UI for code input - Added email display and instructions - Added verification button
1 parent 6afd8c9 commit 02c2841

File tree

1 file changed

+92
-0
lines changed

1 file changed

+92
-0
lines changed
Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
import 'package:flutter/material.dart';
2+
import 'package:ht_main/l10n/l10n.dart';
3+
import 'package:ht_main/shared/constants/app_spacing.dart';
4+
5+
/// {@template email_code_verification_page}
6+
/// Page where the user enters the 6-digit code sent to their email
7+
/// to complete the sign-in or account linking process.
8+
/// {@endtemplate}
9+
class EmailCodeVerificationPage extends StatelessWidget {
10+
/// {@macro email_code_verification_page}
11+
const EmailCodeVerificationPage({required this.email, super.key});
12+
13+
/// The email address the sign-in code was sent to.
14+
final String email;
15+
16+
@override
17+
Widget build(BuildContext context) {
18+
final l10n = context.l10n;
19+
final textTheme = Theme.of(context).textTheme;
20+
21+
return Scaffold(
22+
appBar: AppBar(
23+
title: Text(l10n.emailCodeSentPageTitle), // Updated l10n key
24+
),
25+
body: SafeArea(
26+
child: Padding(
27+
padding: const EdgeInsets.all(AppSpacing.paddingLarge),
28+
child: Center(
29+
child: Column(
30+
mainAxisAlignment: MainAxisAlignment.center,
31+
children: [
32+
const Icon(
33+
Icons.mark_email_read_outlined, // Suggestive icon
34+
size: 80,
35+
// Consider using theme color
36+
// color: Theme.of(context).colorScheme.primary,
37+
),
38+
const SizedBox(height: AppSpacing.xl),
39+
Text(
40+
l10n.emailCodeSentConfirmation(email), // Pass email to l10n
41+
style: textTheme.titleLarge, // Prominent text style
42+
textAlign: TextAlign.center,
43+
),
44+
const SizedBox(height: AppSpacing.xxl),
45+
Text(
46+
l10n.emailCodeSentInstructions, // New l10n key for instructions
47+
style: textTheme.bodyMedium,
48+
textAlign: TextAlign.center,
49+
),
50+
const SizedBox(height: AppSpacing.lg),
51+
// Input field for the 6-digit code
52+
Padding(
53+
padding: const EdgeInsets.symmetric(
54+
horizontal: AppSpacing.md,
55+
),
56+
child: TextField(
57+
// TODO(cline): Add controller and validation
58+
keyboardType: TextInputType.number,
59+
maxLength: 6,
60+
textAlign: TextAlign.center,
61+
decoration: InputDecoration(
62+
hintText: l10n.emailCodeVerificationHint, // Add l10n key
63+
border: const OutlineInputBorder(),
64+
counterText: '', // Hide the counter
65+
),
66+
),
67+
),
68+
const SizedBox(height: AppSpacing.xl),
69+
// Verify button
70+
ElevatedButton(
71+
// TODO(cline): Add onPressed logic to dispatch event
72+
onPressed: () {
73+
// Dispatch event to AuthenticationBloc
74+
// context.read<AuthenticationBloc>().add(
75+
// AuthenticationEmailCodeVerificationRequested(
76+
// email: email,
77+
// code: 'entered_code', // Get code from TextField
78+
// ),
79+
// );
80+
},
81+
child: Text(
82+
l10n.emailCodeVerificationButtonLabel,
83+
), // Add l10n key
84+
),
85+
],
86+
),
87+
),
88+
),
89+
),
90+
);
91+
}
92+
}

0 commit comments

Comments
 (0)