|
1 | 1 | import 'package:flutter/material.dart'; |
2 | 2 | import 'package:flutter_bloc/flutter_bloc.dart'; |
3 | 3 | import 'package:flutter_news_app_web_dashboard_full_source_code/authentication/bloc/authentication_bloc.dart'; |
| 4 | +import 'package:flutter_news_app_web_dashboard_full_source_code/authentication/widgets/auth_layout.dart'; |
4 | 5 | import 'package:flutter_news_app_web_dashboard_full_source_code/l10n/l10n.dart'; |
5 | 6 | import 'package:flutter_news_app_web_dashboard_full_source_code/router/routes.dart'; |
6 | 7 | import 'package:go_router/go_router.dart'; |
@@ -52,68 +53,56 @@ class AuthenticationPage extends StatelessWidget { |
52 | 53 | state.status == AuthenticationStatus.loading || |
53 | 54 | state.status == AuthenticationStatus.requestCodeLoading; |
54 | 55 |
|
55 | | - return Padding( |
56 | | - padding: const EdgeInsets.all(AppSpacing.paddingLarge), |
57 | | - child: Center( |
58 | | - child: SingleChildScrollView( |
59 | | - child: Column( |
60 | | - mainAxisAlignment: MainAxisAlignment.center, |
61 | | - crossAxisAlignment: CrossAxisAlignment.stretch, |
62 | | - children: [ |
63 | | - // --- Icon --- |
64 | | - Padding( |
65 | | - padding: const EdgeInsets.only(bottom: AppSpacing.xl), |
66 | | - child: Icon( |
67 | | - Icons.newspaper, |
68 | | - size: AppSpacing.xxl * 2, |
69 | | - color: colorScheme.primary, |
70 | | - ), |
71 | | - ), |
72 | | - // --- Headline and Subheadline --- |
73 | | - Text( |
74 | | - l10n.authenticationPageHeadline, |
75 | | - style: textTheme.headlineMedium?.copyWith( |
76 | | - fontWeight: FontWeight.bold, |
77 | | - ), |
78 | | - textAlign: TextAlign.center, |
79 | | - ), |
80 | | - const SizedBox(height: AppSpacing.md), |
81 | | - Text( |
82 | | - l10n.authenticationPageSubheadline, |
83 | | - style: textTheme.bodyLarge?.copyWith( |
84 | | - color: colorScheme.onSurfaceVariant, |
85 | | - ), |
86 | | - textAlign: TextAlign.center, |
87 | | - ), |
88 | | - const SizedBox(height: AppSpacing.xxl), |
| 56 | + return AuthLayout( |
| 57 | + child: Column( |
| 58 | + mainAxisAlignment: MainAxisAlignment.center, |
| 59 | + crossAxisAlignment: CrossAxisAlignment.stretch, |
| 60 | + children: [ |
| 61 | + // --- Icon --- |
| 62 | + Padding( |
| 63 | + padding: const EdgeInsets.only(bottom: AppSpacing.xl), |
| 64 | + child: Icon( |
| 65 | + Icons.newspaper, |
| 66 | + size: AppSpacing.xxl * 2, |
| 67 | + color: colorScheme.primary, |
| 68 | + ), |
| 69 | + ), |
| 70 | + // --- Headline and Subheadline --- |
| 71 | + Text( |
| 72 | + l10n.authenticationPageHeadline, |
| 73 | + style: textTheme.headlineMedium?.copyWith( |
| 74 | + fontWeight: FontWeight.bold, |
| 75 | + ), |
| 76 | + textAlign: TextAlign.center, |
| 77 | + ), |
| 78 | + const SizedBox(height: AppSpacing.md), |
| 79 | + Text( |
| 80 | + l10n.authenticationPageSubheadline, |
| 81 | + style: textTheme.bodyLarge?.copyWith( |
| 82 | + color: colorScheme.onSurfaceVariant, |
| 83 | + ), |
| 84 | + textAlign: TextAlign.center, |
| 85 | + ), |
| 86 | + const SizedBox(height: AppSpacing.xxl), |
89 | 87 |
|
90 | | - // --- Email Sign-In Button --- |
91 | | - ElevatedButton.icon( |
92 | | - icon: const Icon(Icons.email_outlined), |
93 | | - onPressed: isLoading |
94 | | - ? null |
95 | | - : () { |
96 | | - context.goNamed(Routes.requestCodeName); |
97 | | - }, |
98 | | - label: Text(l10n.authenticationEmailSignInButton), |
99 | | - style: ElevatedButton.styleFrom( |
100 | | - padding: const EdgeInsets.symmetric( |
101 | | - vertical: AppSpacing.md, |
102 | | - ), |
103 | | - textStyle: textTheme.labelLarge, |
104 | | - ), |
| 88 | + // --- Email Sign-In Button --- |
| 89 | + ElevatedButton.icon( |
| 90 | + icon: const Icon(Icons.email_outlined), |
| 91 | + onPressed: isLoading |
| 92 | + ? null |
| 93 | + : () => context.goNamed(Routes.requestCodeName), |
| 94 | + label: Text(l10n.authenticationEmailSignInButton), |
| 95 | + style: ElevatedButton.styleFrom( |
| 96 | + padding: const EdgeInsets.symmetric( |
| 97 | + vertical: AppSpacing.md, |
105 | 98 | ), |
106 | | - const SizedBox(height: AppSpacing.lg), |
107 | | - |
108 | | - // --- Loading Indicator --- |
109 | | - if (isLoading) |
110 | | - const Padding( |
111 | | - padding: EdgeInsets.only(top: AppSpacing.xl), |
112 | | - child: Center(child: CircularProgressIndicator()), |
113 | | - ), |
114 | | - ], |
| 99 | + textStyle: textTheme.labelLarge, |
| 100 | + ), |
115 | 101 | ), |
116 | | - ), |
| 102 | + const SizedBox(height: AppSpacing.lg), |
| 103 | + if (isLoading) |
| 104 | + const Center(child: CircularProgressIndicator()), |
| 105 | + ], |
117 | 106 | ), |
118 | 107 | ); |
119 | 108 | }, |
|
0 commit comments