Skip to content

Commit 51ef28c

Browse files
committed
modified: app flow, introdued: db
1 parent 4e5c2cd commit 51ef28c

File tree

13 files changed

+1155
-239
lines changed

13 files changed

+1155
-239
lines changed

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,3 +41,7 @@ app.*.map.json
4141
/android/app/debug
4242
/android/app/profile
4343
/android/app/release
44+
45+
#emails and qrs
46+
/scripts/mail-scripts/qrcodes
47+
/scripts/mail-scripts/emails.json

lib/screens/attendance_screen.dart

Lines changed: 195 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,63 +1,221 @@
11
import 'package:attendx/screens/id_screen.dart';
2+
import 'package:attendx/screens/qr_screen.dart';
23
import 'package:attendx/screens/success_screen.dart';
4+
import 'package:attendx/services/postGres_services.dart';
35
import 'package:flutter/material.dart';
46
import 'package:flutter/services.dart';
57

68
class AttendanceScreen extends StatefulWidget {
7-
const AttendanceScreen({Key? key}) : super(key: key);
9+
final String code;
10+
const AttendanceScreen({
11+
Key? key,
12+
required this.code,
13+
}) : super(key: key);
814

915
@override
1016
State<AttendanceScreen> createState() => _AttendanceScreenState();
1117
}
1218

1319
class _AttendanceScreenState extends State<AttendanceScreen> {
20+
int selectedDay = 1;
21+
bool isLoading = false;
22+
23+
markAttendance() async {
24+
setState(() {
25+
isLoading = true;
26+
});
27+
print("Selected day: $selectedDay");
28+
selectedDay == 1
29+
? await markAttendance1(widget.code)
30+
: selectedDay == 2
31+
? await markAttendance2(widget.code)
32+
: await markAttendance3(widget.code);
33+
34+
Navigator.of(context).pushReplacement(MaterialPageRoute(
35+
builder: (_) => SuccessScreen(
36+
day: selectedDay,
37+
),
38+
));
39+
}
40+
1441
@override
1542
Widget build(BuildContext context) {
1643
return Scaffold(
17-
body: Stack(
44+
backgroundColor: bgColor,
45+
appBar: AppBar(
46+
leading: IconButton(
47+
onPressed: () {
48+
Navigator.of(context).pushReplacement(MaterialPageRoute(
49+
builder: (_) => const QrScreen(),
50+
));
51+
},
52+
icon: const Icon(
53+
Icons.arrow_back_ios_new_rounded,
54+
color: Colors.black87,
55+
),
56+
),
57+
centerTitle: true,
58+
title: const Text(
59+
"AttendX",
60+
style: TextStyle(
61+
color: Colors.black87,
62+
fontSize: 24,
63+
fontWeight: FontWeight.bold,
64+
letterSpacing: 1,
65+
),
66+
),
67+
),
68+
body: Column(
1869
children: [
19-
Container(
20-
height: MediaQuery.of(context).size.height,
21-
width: MediaQuery.of(context).size.width,
22-
decoration: const BoxDecoration(
23-
image: DecorationImage(
24-
image: AssetImage("assets/attendance.png"),
25-
fit: BoxFit.cover,
70+
const SizedBox(
71+
height: 20,
72+
),
73+
const Center(
74+
child: Text(
75+
"Choose Slot for attendance",
76+
textAlign: TextAlign.center,
77+
style: TextStyle(
78+
fontSize: 40,
79+
fontWeight: FontWeight.bold,
80+
color: Colors.black87,
2681
),
2782
),
2883
),
29-
Positioned(
30-
bottom: 100,
31-
right: 55,
32-
child: InkWell(
33-
onTap: () {
34-
Navigator.of(context).pushReplacement(MaterialPageRoute(
35-
builder: (_) => const SuccessScreen(),
36-
));
37-
},
38-
child: Container(
39-
width: 250,
40-
height: 50,
41-
decoration: const BoxDecoration(
42-
color: Colors.transparent,
84+
const SizedBox(
85+
height: 20,
86+
),
87+
Padding(
88+
padding: const EdgeInsets.all(8.0),
89+
child: Container(
90+
decoration: const ShapeDecoration(
91+
shape: RoundedRectangleBorder(
92+
borderRadius: BorderRadius.all(
93+
Radius.circular(20),
94+
),
4395
),
96+
color: Color.fromARGB(255, 235, 230, 230),
97+
),
98+
child: Column(
99+
children: [
100+
const SizedBox(
101+
height: 20,
102+
),
103+
InkWell(
104+
onTap: () {
105+
setState(() {
106+
selectedDay = 1;
107+
});
108+
},
109+
child: Container(
110+
height: 40,
111+
width: MediaQuery.of(context).size.width,
112+
decoration: BoxDecoration(
113+
color: selectedDay == 1
114+
? const Color.fromARGB(255, 34, 122, 88)
115+
: const Color.fromARGB(255, 235, 230, 230),
116+
),
117+
child: Text(
118+
"Day 1",
119+
textAlign: TextAlign.center,
120+
style: TextStyle(
121+
fontSize: 30,
122+
color: selectedDay == 1 ? Colors.white : Colors.black,
123+
),
124+
),
125+
),
126+
),
127+
const SizedBox(
128+
height: 10,
129+
),
130+
// const Divider(),
131+
InkWell(
132+
onTap: () {
133+
setState(() {
134+
selectedDay = 2;
135+
});
136+
},
137+
child: Container(
138+
height: 40,
139+
width: MediaQuery.of(context).size.width,
140+
decoration: BoxDecoration(
141+
color: selectedDay == 2
142+
? const Color.fromARGB(255, 34, 122, 88)
143+
: const Color.fromARGB(255, 235, 230, 230),
144+
),
145+
child: Text(
146+
"Day 2",
147+
textAlign: TextAlign.center,
148+
style: TextStyle(
149+
fontSize: 30,
150+
color:
151+
selectedDay == 2 ? Colors.white : Colors.black),
152+
),
153+
),
154+
),
155+
// const Divider(),
156+
const SizedBox(
157+
height: 10,
158+
),
159+
InkWell(
160+
onTap: () {
161+
setState(() {
162+
selectedDay = 3;
163+
});
164+
},
165+
child: Container(
166+
height: 40,
167+
width: MediaQuery.of(context).size.width,
168+
decoration: BoxDecoration(
169+
color: selectedDay == 3
170+
? const Color.fromARGB(255, 34, 122, 88)
171+
: const Color.fromARGB(255, 235, 230, 230),
172+
),
173+
child: Text(
174+
"Day 3",
175+
textAlign: TextAlign.center,
176+
style: TextStyle(
177+
fontSize: 30,
178+
color:
179+
selectedDay == 3 ? Colors.white : Colors.black),
180+
),
181+
),
182+
),
183+
const SizedBox(
184+
height: 20,
185+
),
186+
],
44187
),
45188
),
46189
),
47-
Positioned(
48-
bottom: 20,
49-
left: 20,
50-
child: InkWell(
51-
onTap: () {
52-
Navigator.of(context).pushReplacement(MaterialPageRoute(
53-
builder: (_) => const IdScreen(),
54-
));
55-
},
56-
child: Container(
57-
width: 100,
58-
height: 50,
59-
decoration: const BoxDecoration(
60-
color: Colors.transparent,
190+
const SizedBox(
191+
height: 40,
192+
),
193+
isLoading
194+
? const CircularProgressIndicator(
195+
color: Color.fromARGB(255, 34, 122, 88),
196+
)
197+
: Container(),
198+
const SizedBox(
199+
height: 20,
200+
),
201+
InkWell(
202+
onTap: markAttendance,
203+
child: Container(
204+
width: 200,
205+
height: 70,
206+
decoration: const BoxDecoration(
207+
color: Color.fromARGB(255, 34, 122, 88),
208+
borderRadius: BorderRadius.all(Radius.circular(12)),
209+
),
210+
child: const Center(
211+
child: Text(
212+
"Mark Attendance",
213+
textAlign: TextAlign.center,
214+
style: TextStyle(
215+
color: Colors.white,
216+
fontSize: 24,
217+
fontWeight: FontWeight.bold,
218+
),
61219
),
62220
),
63221
),

0 commit comments

Comments
 (0)