Skip to content

Commit

Permalink
GitHub auth untested (apache#25255)
Browse files Browse the repository at this point in the history
  • Loading branch information
darkhan.nausharipov committed Feb 8, 2023
1 parent 17b8c42 commit 2ab46ec
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions learning/tour-of-beam/frontend/lib/components/login/content.dart
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,13 @@ class _BrandedLoginButtons extends StatelessWidget {
required this.onLoggedIn,
});

Future<void> _logIn(AuthProvider authProvider) async {
await GetIt.instance.get<AuthNotifier>().logIn(authProvider);
onLoggedIn();
}

@override
Widget build(BuildContext context) {
final authNotifier = GetIt.instance.get<AuthNotifier>();

final isLightTheme = Theme.of(context).brightness == Brightness.light;
final textStyle =
MaterialStatePropertyAll(Theme.of(context).textTheme.bodyMedium);
Expand Down Expand Up @@ -124,16 +127,17 @@ class _BrandedLoginButtons extends StatelessWidget {
return Column(
children: [
ElevatedButton.icon(
onPressed: () {},
onPressed: () {
_logIn(GithubAuthProvider());
},
style: isLightTheme ? githubLightButtonStyle : darkButtonStyle,
icon: SvgPicture.asset(Assets.svg.githubLogo),
label: const Text('ui.continueGitHub').tr(),
),
const SizedBox(height: BeamSizes.size16),
ElevatedButton.icon(
onPressed: () async {
await authNotifier.logIn(GoogleAuthProvider());
onLoggedIn();
onPressed: () {
_logIn(GoogleAuthProvider());
},
style: isLightTheme ? googleLightButtonStyle : darkButtonStyle,
icon: SvgPicture.asset(Assets.svg.googleLogo),
Expand Down

0 comments on commit 2ab46ec

Please sign in to comment.