Skip to content

Commit 36b524d

Browse files
committed
feat(auth): improve request code UI
- Updated text styles and spacing - Added hint text to email field - Standardized button styling - Improved loading indicator
1 parent 46c993e commit 36b524d

File tree

1 file changed

+37
-26
lines changed

1 file changed

+37
-26
lines changed

lib/authentication/view/request_code_page.dart

Lines changed: 37 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ class _RequestCodeView extends StatelessWidget {
4242
Widget build(BuildContext context) {
4343
final l10n = context.l10n;
4444
final colorScheme = Theme.of(context).colorScheme;
45+
final textTheme = Theme.of(context).textTheme; // Added textTheme
4546

4647
return Scaffold(
4748
appBar: AppBar(
@@ -106,27 +107,29 @@ class _RequestCodeView extends StatelessWidget {
106107
mainAxisAlignment: MainAxisAlignment.center,
107108
crossAxisAlignment: CrossAxisAlignment.stretch,
108109
children: [
109-
// --- Hardcoded Icon ---
110+
// --- Icon ---
110111
Padding(
111-
padding: const EdgeInsets.only(
112-
bottom: AppSpacing.xl,
113-
), // Spacing below icon
112+
padding: const EdgeInsets.only(bottom: AppSpacing.xl),
114113
child: Icon(
115-
Icons.email_outlined, // Hardcoded icon
116-
size:
117-
(Theme.of(context).iconTheme.size ??
118-
AppSpacing.xl) *
119-
3.0,
120-
color: Theme.of(context).colorScheme.primary,
114+
Icons.email_outlined,
115+
size: AppSpacing.xxl * 2, // Standardized large icon
116+
color: colorScheme.primary,
121117
),
122118
),
123-
const SizedBox(
124-
height: AppSpacing.lg,
125-
), // Space between icon and text
119+
// const SizedBox(height: AppSpacing.lg), // Removed
126120
// --- Explanation Text ---
127121
Text(
128-
l10n.emailSignInExplanation,
129-
style: Theme.of(context).textTheme.bodyLarge,
122+
l10n.requestCodePageHeadline, // Using a more title-like l10n key
123+
style: textTheme.headlineSmall?.copyWith(
124+
fontWeight: FontWeight.bold,
125+
),
126+
textAlign: TextAlign.center,
127+
),
128+
const SizedBox(height: AppSpacing.md),
129+
Text(
130+
l10n.requestCodePageSubheadline, // Using a more descriptive subheadline
131+
style: textTheme.bodyLarge
132+
?.copyWith(color: colorScheme.onSurfaceVariant),
130133
textAlign: TextAlign.center,
131134
),
132135
const SizedBox(height: AppSpacing.xxl),
@@ -177,6 +180,8 @@ class _EmailLinkFormState extends State<_EmailLinkForm> {
177180
@override
178181
Widget build(BuildContext context) {
179182
final l10n = context.l10n;
183+
final textTheme = Theme.of(context).textTheme; // Added textTheme
184+
final colorScheme = Theme.of(context).colorScheme; // Added colorScheme
180185

181186
return Form(
182187
key: _formKey,
@@ -186,9 +191,9 @@ class _EmailLinkFormState extends State<_EmailLinkForm> {
186191
TextFormField(
187192
controller: _emailController,
188193
decoration: InputDecoration(
189-
labelText: l10n.authenticationEmailLabel,
190-
border: const OutlineInputBorder(),
191-
// Consider adding hint text if needed
194+
labelText: l10n.requestCodeEmailLabel, // More specific label
195+
hintText: l10n.requestCodeEmailHint, // Added hint text
196+
// border: const OutlineInputBorder(), // Uses theme default
192197
),
193198
keyboardType: TextInputType.emailAddress,
194199
autocorrect: false,
@@ -206,14 +211,20 @@ class _EmailLinkFormState extends State<_EmailLinkForm> {
206211
const SizedBox(height: AppSpacing.lg),
207212
ElevatedButton(
208213
onPressed: widget.isLoading ? null : _submitForm,
209-
child:
210-
widget.isLoading
211-
? const SizedBox(
212-
height: 24,
213-
width: 24,
214-
child: CircularProgressIndicator(strokeWidth: 2),
215-
)
216-
: Text(l10n.authenticationSendLinkButton),
214+
style: ElevatedButton.styleFrom(
215+
padding: const EdgeInsets.symmetric(vertical: AppSpacing.md),
216+
textStyle: textTheme.labelLarge,
217+
),
218+
child: widget.isLoading
219+
? SizedBox(
220+
height: AppSpacing.xl, // Consistent size with text
221+
width: AppSpacing.xl,
222+
child: CircularProgressIndicator(
223+
strokeWidth: 2,
224+
color: colorScheme.onPrimary, // Color for loader on button
225+
),
226+
)
227+
: Text(l10n.requestCodeSendCodeButton), // More specific button text
217228
),
218229
],
219230
),

0 commit comments

Comments
 (0)