-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsignup.dart
157 lines (150 loc) · 5.31 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
import 'package:edubot/login_screen.dart';
import 'package:edubot/home_page.dart';
import 'package:flutter/material.dart';
class Signup extends StatefulWidget {
Signup({Key? key}) : super(key: key);
@override
State<Signup> createState() => _SignupState();
}
class _SignupState extends State<Signup> {
final _usernameController = TextEditingController();
//final _passwordController = TextEditingController();
final _formKey = GlobalKey<FormState>();
@override
Widget build(BuildContext context) {
return Scaffold(
body: Stack(
children: [
// Background image
Container(
width: double.infinity,
height: double.infinity,
decoration: const BoxDecoration(
image: DecorationImage(
image: AssetImage('assets/wall.jpg'),
fit: BoxFit.cover,
),
),
),
// Icon position
Positioned(
top: 0,
left: 0,
right: 0,
child: Align(
alignment: Alignment.topCenter,
child: Padding(
padding: const EdgeInsets.only(top: 20.0),
child: Image.asset(
'assets/icon.png',
width: 300,
height: 300,
),
),
),
),
// Column containing text fields and signup button
Align(
alignment: Alignment.topCenter,
child: Padding(
padding: const EdgeInsets.all(20.0),
child: Form(
key: _formKey,
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
TextFormField(
controller: _usernameController,
style: const TextStyle(color: Colors.white),
decoration: const InputDecoration(
labelText: 'Email adress',
labelStyle: TextStyle(color: Colors.white),
),
validator: (value) {
if (value == null || value.isEmpty) {
return 'Email address is required';
} else if (!RegExp(r'^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$').hasMatch(value)) {
return 'Please enter a valid email address';
}else{
return null;
}
},
),
SizedBox(height: 20),
ElevatedButton(
style: ButtonStyle(
backgroundColor:
MaterialStateProperty.all(Colors.yellow),
),
onPressed: () {
if (_formKey.currentState!.validate()) {
// Perform signup action
// For demonstration purposes, simply navigate to the home screen
Navigator.of(context).pushReplacement(
MaterialPageRoute(builder: (ctx1) => HomeScreen()));
}
},
child: const Text(
'Proceed',
style: TextStyle(
color: Color.fromARGB(255, 53, 52, 45),
fontSize: 15,
fontWeight: FontWeight.w500,
),
),
),
],
),
),
),
),
// Positioned widget for "Already have an account?" text
Positioned(
bottom: 100,
left: 0,
right: 0,
child: Align(
alignment: Alignment.bottomLeft,
child: Text(
'Already have an account?',
style: TextStyle(
color: Color.fromARGB(255, 255, 255, 254),
fontSize: 20,
fontWeight: FontWeight.w800,
),
),
),
),
// Positioned widget for "Login" button
Positioned(
bottom: 50,
left: 0,
right: 0,
child: Align(
alignment: Alignment.bottomCenter,
child: TextButton(
onPressed: () {
// Navigate to the login screen
// Replace 'LoginPage()' with your actual login screen widget
Navigator.of(context).pushReplacement(MaterialPageRoute(
builder: (context) => LoginPage(),
));
},
child: const Text(
'Login',
style: TextStyle(
color: Color.fromARGB(255, 231, 231, 104),
fontSize: 15,
fontWeight: FontWeight.w500,
decoration: TextDecoration.underline,
decorationColor: Color.fromARGB(255, 231, 231, 104),
),
),
),
),
),
],
),
);
}
}