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
| @override | |
| void dispose() { | |
| super.dispose(); | |
| nameController.dispose(); | |
| emailController.dispose(); | |
| passwordController.dispose(); | |
| ageController.dispose(); | |
| } |
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
| return Scaffold( | |
| appBar: AppBar( | |
| title: Text(title), | |
| actions: <Widget>[ | |
| IconButton( | |
| icon: Icon( | |
| Icons.exit_to_app, | |
| color: Colors.white, | |
| ), | |
| 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
| return Drawer( | |
| child: ListView( | |
| padding: EdgeInsets.zero, | |
| children: <Widget>[ | |
| UserAccountsDrawerHeader( | |
| accountEmail: Text(name), | |
| accountName: Text(email), | |
| decoration: BoxDecoration( | |
| color: Colors.blue, | |
| ), |
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
| void logInToFb() { | |
| firebaseAuth | |
| .signInWithEmailAndPassword( | |
| email: emailController.text, password: passwordController.text) | |
| .then((result) { | |
| Navigator.pushReplacement( | |
| context, | |
| MaterialPageRoute(builder: (context) => Home(uid: result.user.uid)), | |
| ); | |
| }).catchError((err) { |
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
| // Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file | |
| // for details. All rights reserved. Use of this source code is governed by a | |
| // BSD-style license that can be found in the LICENSE file. | |
| import 'package:flutter/material.dart'; | |
| void main() => runApp(MyApp()); | |
| class MyApp extends StatelessWidget { | |
| @override |
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
| final firestoreInstance = FirebaseFirestore.instance; |
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
| void _onPressed() { | |
| firestoreInstance.collection("users").add( | |
| { | |
| "name" : "john", | |
| "age" : 50, | |
| "email" : "example@example.com", | |
| "address" : { | |
| "street" : "street 24", | |
| "city" : "new york" | |
| } |
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
| void _onPressed(){ | |
| var firebaseUser = FirebaseAuth.instance.currentUser; | |
| firestoreInstance.collection("users").doc(firebaseUser.uid).set( | |
| { | |
| "name" : "john", | |
| "age" : 50, | |
| "email" : "example@example.com", | |
| "address" : { | |
| "street" : "street 24", | |
| "city" : "new york" |
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
| void _onPressed() { | |
| var firebaseUser = FirebaseAuth.instance.currentUser; | |
| firestoreInstance.collection("users").doc(firebaseUser.uid).set( | |
| { | |
| "username" : "userX", | |
| },SetOptions(merge: true)).then((_){ | |
| print("success!"); | |
| }); | |
| } |
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
| void _onPressed()async{ | |
| var firebaseUser = await FirebaseAuth.instance.currentUser(); | |
| firestoreInstance | |
| .collection("users") | |
| .document(firebaseUser.uid) | |
| .updateData({"age": 60}).then((_) { | |
| print("success!"); | |
| }); | |
| } |