-
Notifications
You must be signed in to change notification settings - Fork 0
Refactor/auth flow and account linking #142
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
ddeeec7
feat(authentication): refactor account linking and route protection
fulleni 7da9dab
refactor(account): update navigation to use specific route name
fulleni 3b1595b
refactor(authentication): simplify AuthenticationPage for new users
fulleni 0bcaa26
refactor(authentication): simplify request code page navigation
fulleni ee612c6
feat(authentication): add account linking page for anonymous users
fulleni 3488a31
docs(router): add comments explaining top-level routes and authentica…
fulleni 3fedb86
feat(authentication): implement static content using localization
fulleni 997c788
fix(authentication): navigate to correct verification page based on c…
fulleni 3cbda23
feat(router): update account linking page transition
fulleni 27635c2
refactor(authentication): convert AccountLinkingPage to modal bottom …
fulleni c0c94e0
refactor(authentication): make AccountLinkingPage dismissible
fulleni ceaae82
fix(account): update button navigation to use push instead of go
fulleni ed39e56
refactor(authentication): convert AccountLinkingPage to full-screen view
fulleni 0284c9c
refactor(router): simplify AccountLinking page transition
fulleni aca2b62
feat(l10n): update account linking headline text in app_ar.arb and ap…
fulleni 5f94d48
style: format
fulleni 4fa036f
fix(l10n): update translations and remove account linking reference
fulleni File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,105 @@ | ||
| import 'package:flutter/material.dart'; | ||
| import 'package:flutter_bloc/flutter_bloc.dart'; | ||
| import 'package:flutter_news_app_mobile_client_full_source_code/authentication/bloc/authentication_bloc.dart'; | ||
| import 'package:flutter_news_app_mobile_client_full_source_code/l10n/l10n.dart'; | ||
| import 'package:flutter_news_app_mobile_client_full_source_code/router/routes.dart'; | ||
| import 'package:go_router/go_router.dart'; | ||
| import 'package:ui_kit/ui_kit.dart'; | ||
|
|
||
| /// {@template account_linking_page} | ||
| /// Displays options for an anonymous user to link their account to an email. | ||
| /// | ||
| /// {@endtemplate} | ||
| class AccountLinkingPage extends StatelessWidget { | ||
| /// {@macro account_linking_page} | ||
| const AccountLinkingPage({super.key}); | ||
|
|
||
| @override | ||
| Widget build(BuildContext context) { | ||
| final l10n = AppLocalizationsX(context).l10n; | ||
| final textTheme = Theme.of(context).textTheme; | ||
| final colorScheme = Theme.of(context).colorScheme; | ||
|
|
||
| return Scaffold( | ||
| appBar: AppBar(title: Text(l10n.accountLinkingHeadline)), | ||
| body: BlocConsumer<AuthenticationBloc, AuthenticationState>( | ||
| listener: (context, state) { | ||
| if (state.status == AuthenticationStatus.failure) { | ||
| ScaffoldMessenger.of(context) | ||
| ..hideCurrentSnackBar() | ||
| ..showSnackBar( | ||
| SnackBar( | ||
| content: Text(state.exception!.toFriendlyMessage(context)), | ||
| backgroundColor: colorScheme.error, | ||
| ), | ||
| ); | ||
| } | ||
| }, | ||
| builder: (context, state) { | ||
| final isLoading = state.status == AuthenticationStatus.loading; | ||
|
|
||
| return Padding( | ||
| padding: const EdgeInsets.all(AppSpacing.paddingLarge), | ||
| child: Center( | ||
| child: SingleChildScrollView( | ||
| child: Column( | ||
| mainAxisAlignment: MainAxisAlignment.center, | ||
| crossAxisAlignment: CrossAxisAlignment.stretch, | ||
| children: [ | ||
| Padding( | ||
| padding: const EdgeInsets.only(bottom: AppSpacing.xl), | ||
| child: Icon( | ||
| Icons.sync, | ||
| size: AppSpacing.xxl * 2, | ||
| color: colorScheme.primary, | ||
| ), | ||
| ), | ||
| Text( | ||
| l10n.accountLinkingHeadline, | ||
| style: textTheme.headlineMedium?.copyWith( | ||
| fontWeight: FontWeight.bold, | ||
| ), | ||
| textAlign: TextAlign.center, | ||
| ), | ||
| const SizedBox(height: AppSpacing.md), | ||
| Text( | ||
| l10n.accountLinkingBody, | ||
| style: textTheme.bodyLarge?.copyWith( | ||
| color: colorScheme.onSurfaceVariant, | ||
| ), | ||
| textAlign: TextAlign.center, | ||
| ), | ||
| const SizedBox(height: AppSpacing.xxl), | ||
| ElevatedButton.icon( | ||
| icon: const Icon(Icons.email_outlined), | ||
| onPressed: isLoading | ||
| ? null | ||
| : () { | ||
| context.goNamed( | ||
| Routes.accountLinkingRequestCodeName, | ||
| ); | ||
| }, | ||
| label: Text(l10n.accountLinkingSendLinkButton), | ||
| style: ElevatedButton.styleFrom( | ||
| padding: const EdgeInsets.symmetric( | ||
| vertical: AppSpacing.md, | ||
| ), | ||
| textStyle: textTheme.labelLarge, | ||
| ), | ||
| ), | ||
| if (isLoading) ...[ | ||
| const Padding( | ||
| padding: EdgeInsets.only(top: AppSpacing.xl), | ||
| child: Center(child: CircularProgressIndicator()), | ||
| ), | ||
| ], | ||
| ], | ||
| ), | ||
| ), | ||
| ), | ||
| ); | ||
| }, | ||
| ), | ||
| ); | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.