forked from vilsijain/Red-Hat-Mobil-App
-
Notifications
You must be signed in to change notification settings - Fork 0
/
reg.dart
117 lines (108 loc) · 3.86 KB
/
reg.dart
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
import 'package:firebase_auth/firebase_auth.dart';
//import 'package:firebase_core/firebase_core.dart';
import 'package:flutter/material.dart';
class MyReg extends StatefulWidget {
@override
_MyRegState createState() => _MyRegState();
}
class _MyRegState extends State<MyReg> {
var authc = FirebaseAuth.instance;
String email;
String password;
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('Registration'),
backgroundColor: Colors.red,
),
body: Center(
child: Container(
width: 300,
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
// Image.asset("assets/Redhat logo.png"),
TextField(
keyboardType: TextInputType.emailAddress,
onChanged: (value) {
email = value;
},
decoration: InputDecoration(
hintText: "Enter Email",icon: Icon(Icons.mail),
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(20),
),
),
),
SizedBox(
height: 10,
),
// children: <Widget>[
// TextField(
// keyboardType: TextInputType.emailAddress,
// onChanged: (value) {
// email = value;
// },
// decoration: InputDecoration(
// hintText: "User ",icon: Icon(Icons.mail),
// border: OutlineInputBorder(
// borderRadius: BorderRadius.circular(20),
// ),
// ),
// ),
// SizedBox(
// height: 10,
// ),
TextField(
obscureText: true,
onChanged: (value) {
password = value;
},
decoration: InputDecoration(
hintText: "Enter Password",icon: Icon(Icons.remove_red_eye),
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(20),
),
),
),
SizedBox(
height: 10,
),
Material(
color: Colors.lightBlueAccent,
borderRadius: BorderRadius.circular(10),
elevation: 10,
// Image.asset("assets/Redhat logo.png");
child: MaterialButton(
minWidth: 200,
height: 40,
child: Text('Submit'),
onPressed: () async {
try {
var user = await authc.createUserWithEmailAndPassword(
email: email,
password: password,
);
print(email);
print(password);
if (user.additionalUserInfo.isNewUser == true) {
Navigator.pushNamed(context, "chatState");
}
} catch (e) {
print(e);
// Row(
// children: <Widget>[
// Container(
// child: Image.asset('assets/Redhat logo.png',height: 80, width:45),),],);
}
},
),
),
],
),
),
),
);
}
}