11import 'package:flutter/material.dart' ;
2+ import 'package:flutter/cupertino.dart' ;
23import 'package:assignment6/AppDrawer.dart' ;
34
45class AddRecord extends StatefulWidget {
@@ -7,6 +8,12 @@ class AddRecord extends StatefulWidget {
78}
89
910class NewRecordList extends State <AddRecord > {
11+ TextEditingController firstName = new TextEditingController ();
12+ TextEditingController lastName = new TextEditingController ();
13+ TextEditingController gender = new TextEditingController ();
14+ TextEditingController email = new TextEditingController ();
15+ TextEditingController phoneNum = new TextEditingController ();
16+ 1017 @override
1118 Widget build (BuildContext context) {
1219 return MaterialApp (
@@ -16,9 +23,202 @@ class NewRecordList extends State<AddRecord> {
1623 drawer: DrawerList (),
1724 body: SingleChildScrollView (
1825 child: ConstrainedBox (
19- constraints: BoxConstraints (),
20- child: Text ('Add Record' ),
21- ),
26+ constraints: BoxConstraints (),
27+ child: Center (
28+ child: Card (
29+ margin: EdgeInsets .only (top: 30 ),
30+ child: Container (
31+ width: 350 ,
32+ padding: EdgeInsets .only (top: 40 , bottom: 20 ),
33+ child: Column (
34+ children: [
35+ Container (
36+ child: Text (
37+ 'Enter following fields' ,
38+ textAlign: TextAlign .center,
39+ style: TextStyle (
40+ fontFamily: 'Raleway' ,
41+ fontSize: 22 ,
42+ ),
43+ ),
44+ ),
45+ // first name
46+ Container (
47+ padding:
48+ EdgeInsets .only (top: 40 , bottom: 10 , left: 30 ),
49+ child: Row (children: [
50+ Container (
51+ padding: EdgeInsets .only (right: 30 ),
52+ child: Text (
53+ 'First Name' ,
54+ style: TextStyle (
55+ fontFamily: 'Raleway' ,
56+ fontSize: 14 ,
57+ color: Colors .grey[600 ],
58+ ),
59+ ),
60+ ),
61+ Container (
62+ width: 200 ,
63+ child: TextField (
64+ controller: firstName,
65+ decoration: InputDecoration (
66+ border: OutlineInputBorder (),
67+ labelText: 'Enter your first name...' ,
68+ ),
69+ keyboardType: TextInputType .number,
70+ ),
71+ )
72+ ])),
73+ // last name
74+ Container (
75+ padding:
76+ EdgeInsets .only (top: 10 , bottom: 10 , left: 30 ),
77+ child: Row (children: [
78+ Container (
79+ padding: EdgeInsets .only (right: 33 ),
80+ child: Text (
81+ 'Last Name' ,
82+ style: TextStyle (
83+ fontFamily: 'Raleway' ,
84+ fontSize: 14 ,
85+ color: Colors .grey[600 ],
86+ ),
87+ ),
88+ ),
89+ Container (
90+ width: 200 ,
91+ child: TextField (
92+ controller: lastName,
93+ decoration: InputDecoration (
94+ border: OutlineInputBorder (),
95+ labelText: 'Enter your last name...' ,
96+ ),
97+ keyboardType: TextInputType .number,
98+ ),
99+ )
100+ ])),
101+ // gender
102+ Container (
103+ padding: EdgeInsets .only (
104+ top: 10 ,
105+ bottom: 10 ,
106+ left: 30 ,
107+ ),
108+ child: Row (children: [
109+ Container (
110+ padding: EdgeInsets .only (right: 50 ),
111+ child: Text (
112+ 'Gender' ,
113+ style: TextStyle (
114+ fontFamily: 'Raleway' ,
115+ fontSize: 14 ,
116+ color: Colors .grey[600 ],
117+ ),
118+ ),
119+ ),
120+ Container (
121+ width: 200 ,
122+ child: TextField (
123+ controller: gender,
124+ decoration: InputDecoration (
125+ border: OutlineInputBorder (),
126+ labelText: 'Enter your gender...' ,
127+ ),
128+ keyboardType: TextInputType .number,
129+ ),
130+ )
131+ ])),
132+ // email
133+ Container (
134+ padding:
135+ EdgeInsets .only (top: 10 , bottom: 10 , left: 30 ),
136+ child: Row (children: [
137+ Container (
138+ padding: EdgeInsets .only (right: 58 ),
139+ child: Text (
140+ 'Email' ,
141+ style: TextStyle (
142+ fontFamily: 'Raleway' ,
143+ fontSize: 14 ,
144+ color: Colors .grey[600 ],
145+ ),
146+ ),
147+ ),
148+ Container (
149+ width: 200 ,
150+ child: TextField (
151+ controller: email,
152+ decoration: InputDecoration (
153+ border: OutlineInputBorder (),
154+ labelText: 'Enter your email...' ,
155+ ),
156+ keyboardType: TextInputType .number,
157+ ),
158+ )
159+ ])),
160+ // phone number
161+ Container (
162+ padding:
163+ EdgeInsets .only (top: 10 , bottom: 10 , left: 30 ),
164+ child: Row (children: [
165+ Container (
166+ padding: EdgeInsets .only (right: 10 ),
167+ child: Text (
168+ 'Phone Number' ,
169+ style: TextStyle (
170+ fontFamily: 'Raleway' ,
171+ fontSize: 14 ,
172+ color: Colors .grey[600 ],
173+ ),
174+ ),
175+ ),
176+ Container (
177+ width: 200 ,
178+ child: TextField (
179+ controller: phoneNum,
180+ decoration: InputDecoration (
181+ border: OutlineInputBorder (),
182+ labelText: 'Enter your phone number...' ,
183+ ),
184+ keyboardType: TextInputType .number,
185+ ),
186+ )
187+ ])),
188+ Container (
189+ margin: EdgeInsets .only (top: 10 ),
190+ child: ElevatedButton (
191+ child: Text ('Add Records' ),
192+ style: ElevatedButton .styleFrom (
193+ onPrimary: Colors .white,
194+ elevation: 5 ,
195+ ),
196+ onPressed: () async {
197+ return showDialog (
198+ context: context,
199+ builder: (BuildContext context) {
200+ return CupertinoAlertDialog (
201+ title: Text ('Record Added' ,
202+ style: TextStyle (
203+ fontFamily: 'Raleway' ,
204+ fontSize: 24 ,
205+ )),
206+ actions: [
207+ TextButton (
208+ onPressed: () {
209+ Navigator .pop (context);
210+ },
211+ child: Text ('Ok' ))
212+ ],
213+ );
214+ });
215+ }),
216+ )
217+ ],
218+ ),
219+ ),
220+ ),
221+ )),
22222 ),
23223 ),
24224 );
0 commit comments