From e8959158f74ea97c7c4462235caef1a7b66de1af Mon Sep 17 00:00:00 2001 From: Mugi Khan Date: Mon, 18 Nov 2024 19:47:07 +0200 Subject: [PATCH] Fix dart formatting --- lib/app_config.dart | 3 ++- lib/widgets/login_page.dart | 40 ++++++++++++++---------------- lib/widgets/signup_page.dart | 48 ++++++++++++++++++------------------ 3 files changed, 45 insertions(+), 46 deletions(-) diff --git a/lib/app_config.dart b/lib/app_config.dart index 5646baa..1b0ecb7 100644 --- a/lib/app_config.dart +++ b/lib/app_config.dart @@ -1,5 +1,6 @@ /// Update these values class AppConfig { static const String backendUrl = 'https://4be6-71-211-245-221.ngrok-free.app'; - static const String powersyncUrl = 'https://65663910ce6b81ac131b8c62.powersync.journeyapps.com'; + static const String powersyncUrl = + 'https://65663910ce6b81ac131b8c62.powersync.journeyapps.com'; } diff --git a/lib/widgets/login_page.dart b/lib/widgets/login_page.dart index 267f5d1..8c30fd8 100644 --- a/lib/widgets/login_page.dart +++ b/lib/widgets/login_page.dart @@ -29,35 +29,33 @@ class _LoginPageState extends State { _busy = true; _error = null; }); - try { - final credential = await FirebaseAuth.instance.signInWithEmailAndPassword( - email: _usernameController.text, - password: _passwordController.text - ); - if(mounted) { + try { + await FirebaseAuth.instance.signInWithEmailAndPassword( + email: _usernameController.text, password: _passwordController.text); + if (context.mounted) { Navigator.of(context).pushReplacement(MaterialPageRoute( builder: (context) => listsPage, )); - } - } on FirebaseAuthException catch (e) { - if (e.code == 'user-not-found') { - setState(() { - _error = 'No user found for that email.'; - }); - } else if (e.code == 'wrong-password') { + } + } on FirebaseAuthException catch (e) { + if (e.code == 'user-not-found') { setState(() { - _error = 'Wrong password provided for that user.'; + _error = 'No user found for that email.'; }); - } - } catch (e) { + } else if (e.code == 'wrong-password') { + setState(() { + _error = 'Wrong password provided for that user.'; + }); + } + } catch (e) { setState(() { _error = e.toString(); }); - } finally { - setState(() { - _busy = false; - }); - } + } finally { + setState(() { + _busy = false; + }); + } } @override diff --git a/lib/widgets/signup_page.dart b/lib/widgets/signup_page.dart index 64b8ef5..48e7450 100644 --- a/lib/widgets/signup_page.dart +++ b/lib/widgets/signup_page.dart @@ -29,35 +29,35 @@ class _SignupPageState extends State { _busy = true; _error = null; }); - try { - final credential = await FirebaseAuth.instance.createUserWithEmailAndPassword( - email: _usernameController.text, - password: _passwordController.text, - ); - if(mounted) { + try { + await FirebaseAuth.instance.createUserWithEmailAndPassword( + email: _usernameController.text, + password: _passwordController.text, + ); + if (context.mounted) { Navigator.of(context).pushReplacement(MaterialPageRoute( - builder: (context) => homePage, + builder: (context) => homePage, )); - } - } on FirebaseAuthException catch (e) { - if (e.code == 'weak-password') { - setState(() { - _error = 'The password provided is too weak.'; - }); - } else if (e.code == 'email-already-in-use') { + } + } on FirebaseAuthException catch (e) { + if (e.code == 'weak-password') { setState(() { - _error = 'The account already exists for that email.'; + _error = 'The password provided is too weak.'; }); - } - } catch (e) { - setState(() { - _error = e.toString(); - }); - } finally { - setState(() { + } else if (e.code == 'email-already-in-use') { + setState(() { + _error = 'The account already exists for that email.'; + }); + } + } catch (e) { + setState(() { + _error = e.toString(); + }); + } finally { + setState(() { _busy = false; - }); - } + }); + } } @override