-
Notifications
You must be signed in to change notification settings - Fork 0
/
Signup.dart
268 lines (248 loc) · 10.3 KB
/
Signup.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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
import 'package:flutter/cupertino.dart';
import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart';
import 'package:find_me/Home.dart';
import 'package:find_me/Help.dart';
import 'package:find_me/main.dart';
class Signup extends StatefulWidget {
@override
_SignupState createState() => _SignupState();
}
class _SignupState extends State<Signup> {
@override
Widget build(BuildContext context) {
return SafeArea(child: Scaffold(body: MyForm(),)
);
}
}
class MyForm extends StatefulWidget {
@override
_MyFormState createState() => _MyFormState();
}
class _MyFormState extends State<MyForm> {
TextEditingController EmailAddressController, PasswordController;
final _FormKey = GlobalKey<FormState>();
bool _value = false;
@override
void initState() {
// TODO: implement initState
super.initState();
EmailAddressController = TextEditingController() ;
PasswordController = TextEditingController() ;
}
@override
Widget build(BuildContext context) {
return Form(
key: _FormKey,
child: SafeArea(
child: Container(
constraints: BoxConstraints.expand(),
decoration: BoxDecoration(
image: DecorationImage(
image: AssetImage('images/screen1.jpg'),
fit: BoxFit.cover,
),
),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Flexible(
flex: 4,
child: SizedBox(
width: 20.0,
height: 160,
),),
Flexible(
flex: 2,
child: Text('SignUp',style: TextStyle(fontSize: 50,fontFamily: 'Merriweather',color: Colors.white),),
),
SizedBox(
height: 20,
),
// SignUP email
Flexible(
flex: 2,
child: Container(
child: Padding(
padding: EdgeInsets.symmetric(horizontal: 50.0),
child: TextFormField(
controller: EmailAddressController,
style: TextStyle(color: Colors.white,fontSize: 18.0),
decoration: InputDecoration(
fillColor: Colors.black38,
focusColor: Colors.white,
filled: true,
hintStyle: TextStyle(color: Colors.white),
enabledBorder: OutlineInputBorder(
borderRadius: BorderRadius.all(Radius.circular(10.0)),
borderSide: BorderSide(color: Colors.black38),
),
hintText: "Email Address",
),
textAlign: TextAlign.center,
validator: (value){
if(value.isEmpty & !RegExp(
r"[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?")
.hasMatch(value)){
return 'Please enter a valid email address';
}
return null;
},
),
),
),
),
// LOGIN PASSWORD
Flexible(
flex: 2,
child: Container(
child: Padding(
padding: EdgeInsets.symmetric(horizontal: 50.0,vertical: 10.0) ,
child: TextFormField(
controller: PasswordController,
style: TextStyle(color: Colors.white,fontSize: 18.0),
decoration: InputDecoration(
focusColor: Colors.white,
filled: true,
fillColor: Colors.black38,
hintStyle: TextStyle(color: Colors.white),
enabledBorder: OutlineInputBorder(
borderRadius: BorderRadius.all(Radius.circular(10.0)),
borderSide: BorderSide(color: Colors.black38),
),
hintText: "Password",
),
textAlign: TextAlign.center,
validator: (value){
if(value.isEmpty){
return 'Password Required';
}
if(value.length < 8){
return "8 CHARACTERS LONG CODEWORD";
}
return null;
},
obscureText: true,
),
),
),
),
Flexible(
flex: 1,
child: CheckboxListTile(
title: RichText(
text: TextSpan(
children: <TextSpan> [
TextSpan(text: 'I agree to the ',style: TextStyle(fontSize: 18.0,color: Colors.white)),
TextSpan(
text: 'Terms of Services ',
style: TextStyle(fontSize: 18.0,fontWeight: FontWeight.bold,color: Colors.white,decoration: TextDecoration.underline),
recognizer: TapGestureRecognizer()
..onTap = (){
print('Terms');
Navigator.push(context, MaterialPageRoute(builder: (context)=> new Signup()));
},
),
TextSpan(text: 'and ',style: TextStyle(fontSize: 18.0,color: Colors.white)),
TextSpan(
text: 'Privacy Policy',
style: TextStyle(fontSize: 18.0,fontWeight: FontWeight.bold,color: Colors.white,decoration: TextDecoration.underline),
recognizer: TapGestureRecognizer()
..onTap = (){
print('Privacy');
Navigator.push(context, MaterialPageRoute(builder: (context)=> new Signup()));
},
),
],
),
),
controlAffinity: ListTileControlAffinity.leading,
checkColor: Colors.black,
activeColor: Colors.white,
value: _value,
onChanged: (value){
setState(() {
print(value);
_value = value;
});
},
),
),
SizedBox(
height: 20,
),
//Button
Flexible(
flex: 1,
child: ButtonTheme(
minWidth: 100.0,
child: RaisedButton(
shape: new RoundedRectangleBorder(
borderRadius: new BorderRadius.circular(10.0),
),
color: Colors.white54,
onPressed: (){
print('ho raha hai');
if(EmailAddressController != null && PasswordController != null && _FormKey.currentState.validate()) {
Navigator.push(context, MaterialPageRoute(builder: (context)=> new Home()));
}
},
child: Text("Sign Up",style: TextStyle(color: Colors.white,fontSize: 20.0)),
padding: EdgeInsets.symmetric(vertical: 5.0),
),
),
),
// Log in line
Flexible(
flex: 1,
child: Center(
child: RichText(
text: TextSpan(
children: <TextSpan> [
TextSpan(text: 'Already have an account?',style: TextStyle(fontSize: 18.0,color: Colors.white)),
TextSpan(
text: 'Log in',
style: TextStyle(fontSize: 18.0,fontWeight: FontWeight.bold,color: Colors.white,decoration: TextDecoration.underline),
recognizer: TapGestureRecognizer()
..onTap = (){
print('Log in');
Navigator.pop(context);
},
),
],
),
),
),
),
Flexible(
flex: 2,
child: SizedBox(
width: 20.0,
height: 150,
),),
//help icon button
Expanded(
child: Container(
child: Align(
alignment: Alignment.bottomRight,
child: IconButton(
iconSize: 40.0,
icon: Icon(
Icons.help,
color: Colors.black,
),
onPressed: (){
print("what");
Navigator.push(context, MaterialPageRoute(builder: (context)=> new Help()));
},
),
),
),
),
],
),
),
));
}
}