Skip to content

Commit 153e018

Browse files
committed
feat(account): create full-screen AccountPage
Introduced a new AccountPage widget to serve as a full-screen modal entry point for all account-related functionality. This replaces the previous AccountSheet. - Created lib/account/view/account_page.dart. The new page includes a Scaffold with an AppBar and a close button for dismissing the entire modal. - Migrated the UI and logic from the old AccountSheet into the body of the new AccountPage. - Removed the Navigator.of(context).pop() calls from the onTap handlers, as navigation will now occur within the new page's context.
1 parent 8bd29e9 commit 153e018

File tree

1 file changed

+30
-29
lines changed

1 file changed

+30
-29
lines changed
Lines changed: 30 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -8,37 +8,44 @@ import 'package:flutter_news_app_mobile_client_full_source_code/router/routes.da
88
import 'package:go_router/go_router.dart';
99
import 'package:ui_kit/ui_kit.dart';
1010

11-
/// {@template account_sheet}
12-
/// A modal bottom sheet that displays user account information and actions.
11+
/// {@template account_page}
12+
/// A full-screen modal page that displays user account information and actions.
1313
///
14-
/// This widget is shown when the user taps on their avatar in the app bar.
15-
/// It adapts its content based on whether the user is authenticated or
16-
/// anonymous.
14+
/// This page serves as the main entry point for all account-related
15+
/// sections like settings, saved items, and content preferences.
1716
/// {@endtemplate}
18-
class AccountSheet extends StatelessWidget {
19-
/// {@macro account_sheet}
20-
const AccountSheet({super.key});
17+
class AccountPage extends StatelessWidget {
18+
/// {@macro account_page}
19+
const AccountPage({super.key});
2120

2221
@override
2322
Widget build(BuildContext context) {
23+
final l10n = AppLocalizationsX(context).l10n;
2424
// Watch AppBloc for user details and authentication status
2525
final appState = context.watch<AppBloc>().state;
2626
final user = appState.user;
2727
final status = appState.status;
2828
final isAnonymous = status == AppLifeCycleStatus.anonymous;
2929

30-
// The content is wrapped in a SingleChildScrollView to ensure it's
31-
// scrollable on smaller devices where the content might overflow.
32-
return SingleChildScrollView(
33-
child: Padding(
34-
padding: const EdgeInsets.all(AppSpacing.paddingMedium),
35-
child: Column(
36-
mainAxisSize: MainAxisSize.min,
37-
children: [
38-
_buildUserHeader(context, user, isAnonymous),
39-
const SizedBox(height: AppSpacing.lg),
40-
_buildNavigationList(context),
41-
],
30+
return Scaffold(
31+
appBar: AppBar(
32+
leading: IconButton(
33+
icon: const Icon(Icons.close),
34+
onPressed: () => context.pop(),
35+
),
36+
title: Text(l10n.accountTitle),
37+
),
38+
body: SingleChildScrollView(
39+
child: Padding(
40+
padding: const EdgeInsets.all(AppSpacing.paddingMedium),
41+
child: Column(
42+
mainAxisSize: MainAxisSize.min,
43+
children: [
44+
_buildUserHeader(context, user, isAnonymous),
45+
const SizedBox(height: AppSpacing.lg),
46+
_buildNavigationList(context),
47+
],
48+
),
4249
),
4350
),
4451
);
@@ -76,8 +83,7 @@ class AccountSheet extends StatelessWidget {
7683
textStyle: textTheme.labelLarge,
7784
),
7885
onPressed: () {
79-
// Close the sheet before navigating
80-
Navigator.of(context).pop();
86+
// Navigate directly to the linking flow.
8187
context.goNamed(Routes.accountLinkingName);
8288
},
8389
),
@@ -101,8 +107,7 @@ class AccountSheet extends StatelessWidget {
101107
textStyle: textTheme.labelLarge,
102108
),
103109
onPressed: () {
104-
// Close the sheet before signing out
105-
Navigator.of(context).pop();
110+
// Dispatch sign-out event.
106111
context.read<AuthenticationBloc>().add(
107112
const AuthenticationSignOutRequested(),
108113
);
@@ -147,11 +152,7 @@ class AccountSheet extends StatelessWidget {
147152
leading: Icon(icon, color: theme.colorScheme.primary),
148153
title: Text(title, style: textTheme.titleMedium),
149154
trailing: const Icon(Icons.chevron_right),
150-
onTap: () {
151-
// Close the sheet before navigating to the new page.
152-
Navigator.of(context).pop();
153-
onTap();
154-
},
155+
onTap: onTap,
155156
);
156157
}
157158

0 commit comments

Comments
 (0)