Skip to content

Commit 3b1595b

Browse files
committed
refactor(authentication): simplify AuthenticationPage for new users
- Remove account linking functionality - Exclude anonymous sign-in button (to be added later) - Update UI and copy for new user onboarding
1 parent 7da9dab commit 3b1595b

File tree

1 file changed

+25
-59
lines changed

1 file changed

+25
-59
lines changed

lib/authentication/view/authentication_page.dart

Lines changed: 25 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -10,55 +10,27 @@ import 'package:go_router/go_router.dart';
1010
import 'package:ui_kit/ui_kit.dart';
1111

1212
/// {@template authentication_page}
13-
/// Displays authentication options (Google, Email, Anonymous) based on context.
13+
/// Displays authentication options (Email, Anonymous) for new users.
1414
///
15-
/// This page can be used for both initial sign-in and for connecting an
16-
/// existing anonymous account.
15+
/// This page is exclusively for initial sign-in/sign-up.
1716
/// {@endtemplate}
1817
class AuthenticationPage extends StatelessWidget {
1918
/// {@macro authentication_page}
20-
const AuthenticationPage({
21-
required this.headline,
22-
required this.subHeadline,
23-
required this.showAnonymousButton,
24-
required this.isLinkingContext,
25-
super.key,
26-
});
27-
28-
/// The main title displayed on the page.
29-
final String headline;
30-
31-
/// The descriptive text displayed below the headline.
32-
final String subHeadline;
33-
34-
/// Whether to show the "Continue Anonymously" button.
35-
final bool showAnonymousButton;
36-
37-
/// Whether this page is being shown in the account linking context.
38-
final bool isLinkingContext;
19+
const AuthenticationPage({super.key});
3920

4021
@override
4122
Widget build(BuildContext context) {
4223
final l10n = AppLocalizationsX(context).l10n;
4324
final textTheme = Theme.of(context).textTheme;
4425
final colorScheme = Theme.of(context).colorScheme;
4526

27+
// Static content for the main authentication page.
28+
const String headline = 'Welcome to the News App';
29+
const String subHeadline =
30+
'Sign in or create an account to get personalized news.';
31+
4632
return Scaffold(
47-
appBar: AppBar(
48-
backgroundColor: Colors.transparent,
49-
elevation: 0,
50-
// Conditionally add the leading close button only in linking context
51-
leading: isLinkingContext
52-
? IconButton(
53-
icon: const Icon(Icons.close),
54-
tooltip: MaterialLocalizations.of(context).closeButtonTooltip,
55-
onPressed: () {
56-
// Navigate back to the account page when close is pressed
57-
context.goNamed(Routes.accountName);
58-
},
59-
)
60-
: null,
61-
),
33+
appBar: AppBar(backgroundColor: Colors.transparent, elevation: 0),
6234
body: SafeArea(
6335
child: BlocConsumer<AuthenticationBloc, AuthenticationState>(
6436
listener: (context, state) {
@@ -88,7 +60,7 @@ class AuthenticationPage extends StatelessWidget {
8860
Padding(
8961
padding: const EdgeInsets.only(bottom: AppSpacing.xl),
9062
child: Icon(
91-
isLinkingContext ? Icons.sync : Icons.newspaper,
63+
Icons.newspaper,
9264
size: AppSpacing.xxl * 2,
9365
color: colorScheme.primary,
9466
),
@@ -118,11 +90,7 @@ class AuthenticationPage extends StatelessWidget {
11890
onPressed: isLoading
11991
? null
12092
: () {
121-
context.goNamed(
122-
isLinkingContext
123-
? Routes.linkingRequestCodeName
124-
: Routes.requestCodeName,
125-
);
93+
context.goNamed(Routes.requestCodeName);
12694
},
12795
label: Text(l10n.authenticationEmailSignInButton),
12896
style: ElevatedButton.styleFrom(
@@ -134,24 +102,22 @@ class AuthenticationPage extends StatelessWidget {
134102
),
135103
const SizedBox(height: AppSpacing.lg),
136104

137-
// --- Anonymous Sign-In Button (Conditional) ---
138-
if (showAnonymousButton) ...[
139-
OutlinedButton.icon(
140-
icon: const Icon(Icons.person_outline),
141-
onPressed: isLoading
142-
? null
143-
: () => context.read<AuthenticationBloc>().add(
144-
const AuthenticationAnonymousSignInRequested(),
145-
),
146-
label: Text(l10n.authenticationAnonymousSignInButton),
147-
style: OutlinedButton.styleFrom(
148-
padding: const EdgeInsets.symmetric(
149-
vertical: AppSpacing.md,
150-
),
151-
textStyle: textTheme.labelLarge,
105+
// --- Anonymous Sign-In Button ---
106+
OutlinedButton.icon(
107+
icon: const Icon(Icons.person_outline),
108+
onPressed: isLoading
109+
? null
110+
: () => context.read<AuthenticationBloc>().add(
111+
const AuthenticationAnonymousSignInRequested(),
112+
),
113+
label: Text(l10n.authenticationAnonymousSignInButton),
114+
style: OutlinedButton.styleFrom(
115+
padding: const EdgeInsets.symmetric(
116+
vertical: AppSpacing.md,
152117
),
118+
textStyle: textTheme.labelLarge,
153119
),
154-
],
120+
),
155121

156122
// --- Loading Indicator ---
157123
if (isLoading) ...[

0 commit comments

Comments
 (0)