1+ import  'package:firebase_app_web/pages/HomePage.dart' ;
2+ import  'package:firebase_app_web/pages/SignInPage.dart' ;
13import  'package:flutter/material.dart' ;
24import  'package:flutter_svg/flutter_svg.dart' ;
5+ import  'package:firebase_auth/firebase_auth.dart'  as  firebase_auth;
36
47class  SignUpPage  extends  StatefulWidget  {
58 SignUpPage ({Key  key}) :  super (key:  key);
@@ -9,6 +12,11 @@ class SignUpPage extends StatefulWidget {
912}
1013
1114class  _SignUpPageState  extends  State <SignUpPage > {
15+  firebase_auth.FirebaseAuth  firebaseAuth =  firebase_auth.FirebaseAuth .instance;
16+  TextEditingController  _emailController =  TextEditingController ();
17+  TextEditingController  _pwdController =  TextEditingController ();
18+  bool  circular =  false ;
19+ 
1220 @override 
1321 Widget  build (BuildContext  context) {
1422 return  Scaffold (
@@ -46,11 +54,11 @@ class _SignUpPageState extends State<SignUpPage> {
4654 SizedBox (
4755 height:  18 ,
4856 ),
49-  textItem ("Email...." ),
57+  textItem ("Email...." , _emailController,  false ),
5058 SizedBox (
5159 height:  15 ,
5260 ),
53-  textItem ("Password..." ),
61+  textItem ("Password..." , _pwdController,  true ),
5462 SizedBox (
5563 height:  40 ,
5664 ),
@@ -68,12 +76,20 @@ class _SignUpPageState extends State<SignUpPage> {
6876 fontSize:  16 ,
6977 ),
7078 ),
71-  Text (
72-  "Login" ,
73-  style:  TextStyle (
74-  color:  Colors .white,
75-  fontSize:  16 ,
76-  fontWeight:  FontWeight .w600,
79+  InkWell (
80+  onTap:  () {
81+  Navigator .pushAndRemoveUntil (
82+  context,
83+  MaterialPageRoute (builder:  (builder) =>  SignInPage ()),
84+  (route) =>  false );
85+  },
86+  child:  Text (
87+  "Login" ,
88+  style:  TextStyle (
89+  color:  Colors .white,
90+  fontSize:  16 ,
91+  fontWeight:  FontWeight .w600,
92+  ),
7793 ),
7894 ),
7995 ],
@@ -86,21 +102,52 @@ class _SignUpPageState extends State<SignUpPage> {
86102 }
87103
88104 Widget  colorButton () {
89-  return  Container (
90-  width:  MediaQuery .of (context).size.width -  100 ,
91-  height:  60 ,
92-  decoration:  BoxDecoration (
93-  borderRadius:  BorderRadius .circular (20 ),
94-  gradient:  LinearGradient (
95-  colors:  [Color (0xfffd746c ), Color (0xffff9068 ), Color (0xfffd746c )]),
96-  ),
97-  child:  Center (
98-  child:  Text (
99-  "Sign Up" ,
100-  style:  TextStyle (
101-  color:  Colors .white,
102-  fontSize:  20 ,
103-  ),
105+  return  InkWell (
106+  onTap:  () async  {
107+  setState (() {
108+  circular =  true ;
109+  });
110+  try  {
111+  firebase_auth.UserCredential  userCredential = 
112+  await  firebaseAuth.createUserWithEmailAndPassword (
113+  email:  _emailController.text, password:  _pwdController.text);
114+  print (userCredential.user.email);
115+  setState (() {
116+  circular =  false ;
117+  });
118+  Navigator .pushAndRemoveUntil (
119+  context,
120+  MaterialPageRoute (builder:  (builder) =>  HomePage ()),
121+  (route) =>  false );
122+  } catch  (e) {
123+  final  snackbar =  SnackBar (content:  Text (e.toString ()));
124+  ScaffoldMessenger .of (context).showSnackBar (snackbar);
125+  setState (() {
126+  circular =  false ;
127+  });
128+  }
129+  },
130+  child:  Container (
131+  width:  MediaQuery .of (context).size.width -  100 ,
132+  height:  60 ,
133+  decoration:  BoxDecoration (
134+  borderRadius:  BorderRadius .circular (20 ),
135+  gradient:  LinearGradient (colors:  [
136+  Color (0xfffd746c ),
137+  Color (0xffff9068 ),
138+  Color (0xfffd746c )
139+  ]),
140+  ),
141+  child:  Center (
142+  child:  circular
143+  ?  CircularProgressIndicator ()
144+  :  Text (
145+  "Sign Up" ,
146+  style:  TextStyle (
147+  color:  Colors .white,
148+  fontSize:  20 ,
149+  ),
150+  ),
104151 ),
105152 ),
106153 );
@@ -144,17 +191,31 @@ class _SignUpPageState extends State<SignUpPage> {
144191 );
145192 }
146193
147-  Widget  textItem (String  labeltext) {
194+  Widget  textItem (
195+  String  labeltext, TextEditingController  controller, bool  obscureText) {
148196 return  Container (
149197 width:  MediaQuery .of (context).size.width -  70 ,
150198 height:  55 ,
151199 child:  TextFormField (
200+  controller:  controller,
201+  obscureText:  obscureText,
202+  style:  TextStyle (
203+  fontSize:  17 ,
204+  color:  Colors .white,
205+  ),
152206 decoration:  InputDecoration (
153207 labelText:  labeltext,
154208 labelStyle:  TextStyle (
155209 fontSize:  17 ,
156210 color:  Colors .white,
157211 ),
212+  focusedBorder:  OutlineInputBorder (
213+  borderRadius:  BorderRadius .circular (15 ),
214+  borderSide:  BorderSide (
215+  width:  1.5 ,
216+  color:  Colors .amber,
217+  ),
218+  ),
158219 enabledBorder:  OutlineInputBorder (
159220 borderRadius:  BorderRadius .circular (15 ),
160221 borderSide:  BorderSide (
0 commit comments