Skip to content
This repository has been archived by the owner on Dec 17, 2024. It is now read-only.

Commit

Permalink
Fix dart formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
mugikhan committed Nov 18, 2024
1 parent 49e1ea7 commit e895915
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 46 deletions.
3 changes: 2 additions & 1 deletion lib/app_config.dart
Original file line number Diff line number Diff line change
@@ -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';
}
40 changes: 19 additions & 21 deletions lib/widgets/login_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -29,35 +29,33 @@ class _LoginPageState extends State<LoginPage> {
_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
Expand Down
48 changes: 24 additions & 24 deletions lib/widgets/signup_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -29,35 +29,35 @@ class _SignupPageState extends State<SignupPage> {
_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
Expand Down

0 comments on commit e895915

Please sign in to comment.