This file contains 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
// FILE: Tab1.tsx | |
// add the import.. | |
import { withRouter } from "react-router"; |
This file contains 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
// FILE: Tab1.tsx | |
import React from 'react'; | |
import { IonHeader, IonToolbar, IonTitle, IonContent } from '@ionic/react'; | |
const Tab1: React.SFC = () => { | |
return ( | |
<> | |
This file contains 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
// FILE: Tab1Detail.tsx | |
import { withRouter } from "react-router"; // <== NEW | |
const Tab1Detail: React.SFC = (props) => { // <== NEW | |
return ( | |
<> | |
This file contains 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( | |
future: Provider.of(context).getUser(), | |
builder: (context, AsyncSnapshot snapshot) { // ⇐ NEW |
This file contains 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
onPressed: () async { | |
// save the fields.. | |
final form = _formKey.currentState; | |
form.save(); | |
// Validate will return true if is valid, or false if invalid. | |
if (form.validate()) { | |
try { | |
FirebaseUser result = | |
await Provider.of(context).loginUser( |
This file contains 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 LoadingCircle extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) { | |
return Center( | |
child: Container( | |
child: CircularProgressIndicator(), | |
alignment: Alignment(0.0, 0.0), | |
), | |
); | |
} |
This file contains 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:firebase_auth/firebase_auth.dart'; | |
import 'dart:async'; | |
import 'package:flutter/cupertino.dart'; | |
class AuthService with ChangeNotifier { | |
final FirebaseAuth _auth = FirebaseAuth.instance; | |
/// | |
/// return the Future with firebase user object FirebaseUser if one exists |
This file contains 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: [ | |
SizedBox(height: 20.0), // ⇐ NEW | |
Text( // ⇐ NEW | |
'Home Page Flutter Firebase Content', | |
style: TextStyle(fontSize: 20, fontWeight: FontWeight.bold), | |
), | |
SizedBox(height: 20.0), // ⇐ NEW | |
Text( // ⇐ NEW | |
`Welcome ${widget.currentUser.email}`, | |
style: TextStyle( |
This file contains 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:firebase_auth/firebase_auth.dart'; |
This file contains 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 HomePage extends StatefulWidget { | |
final FirebaseUser currentUser; // ⇐ NEW | |
HomePage(this.currentUser); // ⇐ NEW | |
@override | |
_HomePageState createState() => _HomePageState(); | |
} |