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
"-M0FJ-WJXYDS-TPehYzV" : { | |
"age" : "4", | |
"name" : "shadow", | |
"type" : "Cats" | |
}, | |
"-M0FJLC6he0Qh9fVY9LV" : { | |
"age" : "7", | |
"name" : "max", | |
"type" : "Dogs" | |
} |
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 main() { | |
var response = | |
{"token":"eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsImp0aSI6IjIxMDcxNjg1XATLkHM3-LSmHBpY-_ER_eDcsQnHGKKmLXjHpBevyRW2HvOeWD4zbnlkoZwiL23"}; | |
print(response["token"]); | |
} |
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
dependencies: | |
firebase_core: ^0.5.0+1 | |
firebase_database: ^4.1.1 | |
firebase_auth: ^0.18.1+2 | |
splashscreen : 1.2.0 | |
flutter_signin_button: ^1.0.0 |
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 main() async { | |
WidgetsFlutterBinding.ensureInitialized(); | |
await Firebase.initializeApp(); | |
runApp(MyApp()); | |
} | |
class MyApp extends StatelessWidget { | |
@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
class IntroScreen extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) { | |
User result = FirebaseAuth.instance.currentUser; | |
return new SplashScreen( | |
navigateAfterSeconds: result != null ? Home(uid: result.uid) : SignUp(), | |
seconds: 5, | |
title: new Text( | |
'Welcome To Meet up!', | |
style: new TextStyle(fontWeight: FontWeight.bold, fontSize: 20.0), |
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(widget.title), | |
), | |
body: Center( | |
child: Column(mainAxisAlignment: MainAxisAlignment.center, children: < | |
Widget>[ | |
Padding( | |
padding: EdgeInsets.all(10.0), | |
child: Text("Meet Up", |
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 _formKey = GlobalKey<FormState>(); | |
FirebaseAuth firebaseAuth = FirebaseAuth.instance; | |
DatabaseReference dbRef = FirebaseDatabase.instance.reference().child("Users"); | |
TextEditingController emailController = TextEditingController(); | |
TextEditingController nameController = TextEditingController(); | |
TextEditingController passwordController = TextEditingController(); | |
TextEditingController ageController = TextEditingController(); |
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 Form( | |
key: _formKey, | |
child: SingleChildScrollView( | |
child: Column(children: <Widget>[ | |
Padding( | |
padding: EdgeInsets.all(20.0), | |
child: TextFormField( | |
controller: nameController, | |
decoration: InputDecoration( | |
labelText: "Enter User Name", |
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
child: ElevatedButton( | |
style: ButtonStyle(backgroundColor: MaterialStateProperty.all<Color>(Colors.lightBlue)), | |
onPressed: () { | |
if (_formKey.currentState.validate()) { | |
registerToFb(); | |
} | |
}, | |
child: Text('Submit'), | |
), |
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 registerToFb() { | |
firebaseAuth | |
.createUserWithEmailAndPassword( | |
email: emailController.text, password: passwordController.text) | |
.then((result) { | |
dbRef.child(result.user.uid).set({ | |
"email": emailController.text, | |
"age": ageController.text, | |
"name": nameController.text | |
}).then((res) { |