Skip to content
This repository was archived by the owner on Jul 12, 2024. It is now read-only.

Commit f213f31

Browse files
committed
refactor: Update login.dart to use authNotifier instead of ref.read(authProvider.notifier)
1 parent 1b8e513 commit f213f31

File tree

1 file changed

+19
-17
lines changed

1 file changed

+19
-17
lines changed

lib/pages/login/login.dart

+19-17
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ class LoginScreenState extends ConsumerState<LoginScreen> {
2525
Widget build(BuildContext context) {
2626
Brightness platformBrightness = MediaQuery.of(context).platformBrightness;
2727

28+
final authNotifier = ref.read(authProvider.notifier);
29+
2830
return Scaffold(
2931
body: SafeArea(
3032
child: Center(
@@ -60,11 +62,11 @@ class LoginScreenState extends ConsumerState<LoginScreen> {
6062
dButton(
6163
text: "Login",
6264
onPress: () async {
63-
await ref.read(authProvider.notifier).login(
64-
email: emailController.text,
65-
password: passwordController.text,
66-
context: context,
67-
);
65+
await authNotifier.login(
66+
email: emailController.text,
67+
password: passwordController.text,
68+
context: context,
69+
);
6870
},
6971
),
7072
const SizedBox(height: 16),
@@ -92,10 +94,10 @@ class LoginScreenState extends ConsumerState<LoginScreen> {
9294
height: 40,
9395
),
9496
onPressed: () async {
95-
await ref.read(authProvider.notifier).oAuthLogin(
96-
provider: OAuthProvider.google,
97-
context: context,
98-
);
97+
await authNotifier.oAuthLogin(
98+
provider: OAuthProvider.google,
99+
context: context,
100+
);
99101
},
100102
),
101103
const SizedBox(width: 30),
@@ -106,21 +108,21 @@ class LoginScreenState extends ConsumerState<LoginScreen> {
106108
height: 40,
107109
),
108110
onPressed: () async {
109-
await ref.read(authProvider.notifier).oAuthLogin(
110-
provider: OAuthProvider.facebook,
111-
context: context,
112-
);
111+
await authNotifier.oAuthLogin(
112+
provider: OAuthProvider.facebook,
113+
context: context,
114+
);
113115
},
114116
),
115117
const SizedBox(width: 30),
116118
IconButton(
117119
icon: SvgPicture.asset('assets/images/apple_icon.svg',
118120
width: 40, height: 40),
119121
onPressed: () async {
120-
await ref.read(authProvider.notifier).oAuthLogin(
121-
provider: OAuthProvider.apple,
122-
context: context,
123-
);
122+
await authNotifier.oAuthLogin(
123+
provider: OAuthProvider.apple,
124+
context: context,
125+
);
124126
},
125127
),
126128
],

0 commit comments

Comments
 (0)