This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Future _buildErrorDialog(BuildContext context, _message) { | |
| return showDialog( | |
| builder: (context) { | |
| return AlertDialog( | |
| title: Text('Error Message'), | |
| content: Text(_message), | |
| actions: [ | |
| FlatButton( | |
| child: Text('Cancel'), | |
| onPressed: () { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Validate will return true if is valid, or false if invalid. | |
| if (form.validate()) { | |
| var result = await Provider.of(context) | |
| .loginUser(email: _email, password: _password); | |
| if (result == null) { | |
| // see project in github for this code | |
| //return _buildShowErrorDialog(context, | |
| // "Error Logging In With Those Credentials"); | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import 'dart:async'; | |
| import 'package:flutter/material.dart'; | |
| class AuthService with ChangeNotifier { | |
| var currentUser; | |
| AuthService() { | |
| print("new AuthService"); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class MyApp extends StatelessWidget { | |
| // This widget is the root of your application. | |
| @override | |
| Widget build(BuildContext context) { | |
| return MaterialApp( | |
| title: 'Flutter Demo', | |
| theme: ThemeData(primarySwatch: Colors.blue), | |
| home: FutureBuilder( | |
| // get the Provider, and call the getUser method | |
| future: Provider.of<AuthService>(context).getUser(), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| children: <Widget>[ | |
| SizedBox(height: 20.0), // <= NEW | |
| Text( | |
| 'Login Information', | |
| style: TextStyle(fontSize: 20), | |
| ), | |
| SizedBox(height: 20.0), // <= NEW | |
| TextFormField( | |
| keyboardType: TextInputType.emailAddress, | |
| decoration: InputDecoration(labelText: "Email Address")), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| body: Container( | |
| padding: EdgeInsets.all(20.0), | |
| child: Column() | |
| ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class _LoginPageState extends State<LoginPage> { | |
| final _formKey = GlobalKey<FormState>(); | |
| String _password; | |
| String _email; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class _LoginPageState extends State<LoginPage> { | |
| final _formKey = GlobalKey<FormState>(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import 'package:flutter/material.dart'; | |
| import 'package:simple_firebase_auth/login_page.dart'; | |
| void main() => runApp(MyApp()); | |
| class MyApp extends StatelessWidget { | |
| // This widget is the root of your application. | |
| @override | |
| Widget build(BuildContext context) { | |
| return MaterialApp( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import 'package:flutter/material.dart'; | |
| class HomePage extends StatefulWidget { | |
| @override | |
| _HomePageState createState() => _HomePageState(); | |
| } | |
| class _HomePageState extends State<HomePage> { | |
| @override | |
| Widget build(BuildContext context) { |