Skip to content

Commit

Permalink
Button and TextField Formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
vivjamba committed Jul 17, 2021
1 parent dfec8bd commit e2c612f
Show file tree
Hide file tree
Showing 2 changed files with 62 additions and 48 deletions.
2 changes: 1 addition & 1 deletion lib/adddestination.dart
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ class _AddDestPageState extends State<AddDestPage> {
margin: const EdgeInsets.only(top: 5, bottom: 20.0),
child: TextField(
controller: destDetailsController,
obscureText: true,
obscureText: false,
decoration: InputDecoration(
border: OutlineInputBorder(),
labelText: 'Details',
Expand Down
108 changes: 61 additions & 47 deletions lib/login.dart
Original file line number Diff line number Diff line change
Expand Up @@ -80,56 +80,70 @@ class _LoginPageState extends State<LoginPage> {
),
),
),
RaisedButton(
color: Colors.blue,
child: Text("Log In",
style: TextStyle(
color: Colors.white,
fontSize: 20.0,
)
),
onPressed: () async {
Row(
children: [
Expanded(
flex: 30,
child: Padding(
padding: const EdgeInsets.only(left: 20, right: 10),
child: ElevatedButton(
child: Text("Log In",
style: TextStyle(
color: Colors.white,
fontSize: 20.0,
)
),
onPressed: () async {

//Test code to print contents of controllers
// print(emailController.text);
// print(passwordController.text);
//Test code to print contents of controllers
// print(emailController.text);
// print(passwordController.text);

try {
await FirebaseAuth.instance.signInWithEmailAndPassword(
email: emailController.text,
password: passwordController.text
);
print('Login successful!');
Navigator.push(
context,
MaterialPageRoute(builder: (context) => DestinationPage(title: 'Saved Destinations')),
);
} on FirebaseAuthException catch (e) {
print('Login Failed. Error code: ${e.code}');
print(e.message);
}
},
),
RaisedButton(
child: Text("Sign Up",
style: TextStyle(
color: Colors.white,
fontSize: 20.0,
)
try {
await FirebaseAuth.instance.signInWithEmailAndPassword(
email: emailController.text,
password: passwordController.text
);
print('Login successful!');
Navigator.push(
context,
MaterialPageRoute(builder: (context) => DestinationPage(title: 'Saved Destinations')),
);
} on FirebaseAuthException catch (e) {
print('Login Failed. Error code: ${e.code}');
print(e.message);
}
},
),
),
),
Expanded(
flex: 30,
child: Padding(
padding: const EdgeInsets.only(left: 10, right: 20),
child: ElevatedButton(
child: Text("Sign Up",
style: TextStyle(
color: Colors.white,
fontSize: 20.0,
)
),
onPressed: () async {
try {
await FirebaseAuth.instance.createUserWithEmailAndPassword(
email: emailController.text,
password: passwordController.text
);
print('Account created!');
} on FirebaseAuthException catch (e) {
print('Signup Failed. Error code: ${e.code}');
print(e.message);
}
}
),
),
),
color: Colors.blue,
onPressed: () async {
try {
await FirebaseAuth.instance.createUserWithEmailAndPassword(
email: emailController.text,
password: passwordController.text
);
print('Account created!');
} on FirebaseAuthException catch (e) {
print('Signup Failed. Error code: ${e.code}');
print(e.message);
}
}
],
),
],
),
Expand Down

0 comments on commit e2c612f

Please sign in to comment.