File tree Expand file tree Collapse file tree
learning/tour-of-beam/frontend/lib/components/login Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -84,10 +84,13 @@ class _BrandedLoginButtons extends StatelessWidget {
8484 required this .onLoggedIn,
8585 });
8686
87+ Future <void > _logIn (AuthProvider authProvider) async {
88+ await GetIt .instance.get <AuthNotifier >().logIn (authProvider);
89+ onLoggedIn ();
90+ }
91+
8792 @override
8893 Widget build (BuildContext context) {
89- final authNotifier = GetIt .instance.get <AuthNotifier >();
90-
9194 final isLightTheme = Theme .of (context).brightness == Brightness .light;
9295 final textStyle =
9396 MaterialStatePropertyAll (Theme .of (context).textTheme.bodyMedium);
@@ -124,16 +127,17 @@ class _BrandedLoginButtons extends StatelessWidget {
124127 return Column (
125128 children: [
126129 ElevatedButton .icon (
127- onPressed: () {},
130+ onPressed: () {
131+ _logIn (GithubAuthProvider ());
132+ },
128133 style: isLightTheme ? githubLightButtonStyle : darkButtonStyle,
129134 icon: SvgPicture .asset (Assets .svg.githubLogo),
130135 label: const Text ('ui.continueGitHub' ).tr (),
131136 ),
132137 const SizedBox (height: BeamSizes .size16),
133138 ElevatedButton .icon (
134- onPressed: () async {
135- await authNotifier.logIn (GoogleAuthProvider ());
136- onLoggedIn ();
139+ onPressed: () {
140+ _logIn (GoogleAuthProvider ());
137141 },
138142 style: isLightTheme ? googleLightButtonStyle : darkButtonStyle,
139143 icon: SvgPicture .asset (Assets .svg.googleLogo),
You can’t perform that action at this time.
0 commit comments