Skip to content

Instantly share code, notes, and snippets.

View aaronksaunders's full-sized avatar

Aaron K Saunders aaronksaunders

View GitHub Profile
@aaronksaunders
aaronksaunders / Markdium-Dart.dart
Created June 4, 2019 17:52
Markdium-Simple Firebase Login Flow in Flutter, Now Firebase
Future _buildErrorDialog(BuildContext context, _message) {
return showDialog(
builder: (context) {
return AlertDialog(
title: Text('Error Message'),
content: Text(_message),
actions: [
FlatButton(
child: Text('Cancel'),
onPressed: () {
// 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");
}
}
@aaronksaunders
aaronksaunders / Markdium-javascript.js
Created May 30, 2019 23:46
Markdium-Simple Firebase Login Flow in Flutter
import 'dart:async';
import 'package:flutter/material.dart';
class AuthService with ChangeNotifier {
var currentUser;
AuthService() {
print("new AuthService");
}
@aaronksaunders
aaronksaunders / Markdium-javascript.js
Created May 30, 2019 23:46
Markdium-Simple Firebase Login Flow in Flutter
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(),
@aaronksaunders
aaronksaunders / Markdium-javascript.js
Created May 30, 2019 23:46
Markdium-Simple Firebase Login Flow in Flutter
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")),
@aaronksaunders
aaronksaunders / Markdium-javascript.js
Created May 30, 2019 23:46
Markdium-Simple Firebase Login Flow in Flutter
body: Container(
padding: EdgeInsets.all(20.0),
child: Column()
)
@aaronksaunders
aaronksaunders / Markdium-javascript.js
Created May 30, 2019 23:46
Markdium-Simple Firebase Login Flow in Flutter
class _LoginPageState extends State<LoginPage> {
final _formKey = GlobalKey<FormState>();
String _password;
String _email;
@aaronksaunders
aaronksaunders / Markdium-javascript.js
Created May 30, 2019 23:46
Markdium-Simple Firebase Login Flow in Flutter
class _LoginPageState extends State<LoginPage> {
final _formKey = GlobalKey<FormState>();
@aaronksaunders
aaronksaunders / Markdium-javascript.js
Created May 30, 2019 23:46
Markdium-Simple Firebase Login Flow in Flutter
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(
@aaronksaunders
aaronksaunders / Markdium-javascript.js
Created May 30, 2019 23:46
Markdium-Simple Firebase Login Flow in Flutter
import 'package:flutter/material.dart';
class HomePage extends StatefulWidget {
@override
_HomePageState createState() => _HomePageState();
}
class _HomePageState extends State<HomePage> {
@override
Widget build(BuildContext context) {