@@ -98,6 +98,8 @@ class _LoginFormState extends State<_LoginForm> {
9898 setState (() {
9999 _loading = true ;
100100 });
101+ final ScaffoldMessengerState scaffoldMessenger =
102+ ScaffoldMessenger .of (context);
101103 try {
102104 final email = _emailController.text;
103105 final password = _passwordController.text;
@@ -106,7 +108,7 @@ class _LoginFormState extends State<_LoginForm> {
106108 password: password,
107109 );
108110 } catch (e) {
109- ScaffoldMessenger . of (context) .showSnackBar (const SnackBar (
111+ scaffoldMessenger .showSnackBar (const SnackBar (
110112 content: Text ('Login failed' ),
111113 backgroundColor: Colors .red,
112114 ));
@@ -123,6 +125,8 @@ class _LoginFormState extends State<_LoginForm> {
123125 setState (() {
124126 _loading = true ;
125127 });
128+ final ScaffoldMessengerState scaffoldMessenger =
129+ ScaffoldMessenger .of (context);
126130 try {
127131 final email = _emailController.text;
128132 final password = _passwordController.text;
@@ -131,7 +135,7 @@ class _LoginFormState extends State<_LoginForm> {
131135 password: password,
132136 );
133137 } catch (e) {
134- ScaffoldMessenger . of (context) .showSnackBar (const SnackBar (
138+ scaffoldMessenger .showSnackBar (const SnackBar (
135139 content: Text ('Signup failed' ),
136140 backgroundColor: Colors .red,
137141 ));
@@ -173,6 +177,8 @@ class _ProfileFormState extends State<_ProfileForm> {
173177 }
174178
175179 Future <void > _loadProfile () async {
180+ final ScaffoldMessengerState scaffoldMessenger =
181+ ScaffoldMessenger .of (context);
176182 try {
177183 final userId = Supabase .instance.client.auth.currentUser! .id;
178184 final data = (await Supabase .instance.client
@@ -186,7 +192,7 @@ class _ProfileFormState extends State<_ProfileForm> {
186192 });
187193 }
188194 } catch (e) {
189- ScaffoldMessenger . of (context) .showSnackBar (const SnackBar (
195+ scaffoldMessenger .showSnackBar (const SnackBar (
190196 content: Text ('Error occurred while getting profile' ),
191197 backgroundColor: Colors .red,
192198 ));
@@ -219,6 +225,8 @@ class _ProfileFormState extends State<_ProfileForm> {
219225 const SizedBox (height: 16 ),
220226 ElevatedButton (
221227 onPressed: () async {
228+ final ScaffoldMessengerState scaffoldMessenger =
229+ ScaffoldMessenger .of (context);
222230 try {
223231 setState (() {
224232 _loading = true ;
@@ -233,13 +241,12 @@ class _ProfileFormState extends State<_ProfileForm> {
233241 'website' : website,
234242 });
235243 if (mounted) {
236- ScaffoldMessenger .of (context)
237- .showSnackBar (const SnackBar (
244+ scaffoldMessenger.showSnackBar (const SnackBar (
238245 content: Text ('Saved profile' ),
239246 ));
240247 }
241248 } catch (e) {
242- ScaffoldMessenger . of (context) .showSnackBar (const SnackBar (
249+ scaffoldMessenger .showSnackBar (const SnackBar (
243250 content: Text ('Error saving profile' ),
244251 backgroundColor: Colors .red,
245252 ));
0 commit comments