-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #213 from SayedZeeshanHyder/main
Changes Made in Notes Screen and Added Stream Builder in Attendance S…
- Loading branch information
Showing
7 changed files
with
172 additions
and
125 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
105 changes: 0 additions & 105 deletions
105
lib/new_ui/screens/attendance_screen/widgets/attendance_subject_widget.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,105 +0,0 @@ | ||
import 'package:flutter/material.dart'; | ||
import 'package:tsec_app/new_ui/colors.dart'; | ||
|
||
class AttendanceSubjectWidget extends StatelessWidget { | ||
final double attendance; | ||
const AttendanceSubjectWidget({super.key, required this.attendance}); | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
var size = MediaQuery.of(context).size; | ||
|
||
return Card( | ||
child: Container( | ||
decoration: BoxDecoration( | ||
border: Border.all(color: timePickerBorder, width: 1.0), // Change the color and width as needed | ||
borderRadius: BorderRadius.circular(10.0), | ||
color: timePickerBg, | ||
), | ||
child: Padding( | ||
padding: const EdgeInsets.all(8.0), | ||
child: Column( | ||
crossAxisAlignment: CrossAxisAlignment.start, | ||
children: [ | ||
const Row( | ||
//crossAxisAlignment: CrossAxisAlignment.end, | ||
children: [ | ||
Text( | ||
'Subject Name', | ||
style: TextStyle(color: Colors.white, fontSize: 20, fontWeight: FontWeight.bold), | ||
), | ||
SizedBox(width: 5,), | ||
], | ||
), | ||
const SizedBox(height: 10,), | ||
Row( | ||
mainAxisAlignment: MainAxisAlignment.spaceBetween, | ||
children: [ | ||
Text( | ||
'5/10', | ||
style: TextStyle(color: Colors.white, fontSize: 14), | ||
), | ||
Text( | ||
'50%', | ||
style: TextStyle(color: Colors.white, fontSize: 14), | ||
), | ||
], | ||
), | ||
const SizedBox(height: 10,), | ||
LinearProgressIndicator( | ||
value: attendance, | ||
backgroundColor: Colors.white, | ||
valueColor: const AlwaysStoppedAnimation<Color>(Colors.blue), | ||
), | ||
const SizedBox(height: 15,), | ||
Row( | ||
mainAxisAlignment: MainAxisAlignment.spaceBetween, | ||
children: [ | ||
ElevatedButton( | ||
onPressed: (){}, | ||
child: const Text('Present', style: TextStyle(color: Colors.white),), | ||
style: ElevatedButton.styleFrom( | ||
backgroundColor: commonbgL3ightblack, | ||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(5)), | ||
), | ||
), | ||
ElevatedButton( | ||
onPressed: (){}, | ||
child: Transform( | ||
alignment: Alignment.center, | ||
transform: Matrix4.identity()..scale(-1.0, 1.0, 1.0), // Flip horizontally | ||
child: Icon(Icons.refresh_outlined, color: Colors.white), | ||
) | ||
, | ||
style: ElevatedButton.styleFrom( | ||
backgroundColor: commonbgL3ightblack, | ||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(5)), | ||
), | ||
), | ||
ElevatedButton( | ||
onPressed: (){}, | ||
child: const Text('Absent', style: TextStyle(color: Colors.white),), | ||
style: ElevatedButton.styleFrom( | ||
backgroundColor: commonbgL3ightblack, | ||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(5)), | ||
), | ||
), | ||
|
||
], | ||
), | ||
const SizedBox(height: 10,), | ||
Center( | ||
child: Container( | ||
height: 1, | ||
width: size.width*0.88, | ||
color: commonbgL4ightblack, | ||
), | ||
), | ||
const SizedBox(height: 10,), | ||
], | ||
), | ||
), | ||
) | ||
); | ||
} | ||
} | ||
21 changes: 21 additions & 0 deletions
21
lib/new_ui/screens/attendance_screen/widgets/attendanceservice.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import 'package:cloud_firestore/cloud_firestore.dart'; | ||
import 'package:firebase_auth/firebase_auth.dart'; | ||
|
||
class AttendanceService{ | ||
|
||
static FirebaseAuth auth = FirebaseAuth.instance; | ||
static CollectionReference firestore = FirebaseFirestore.instance.collection("Attendance"); | ||
|
||
static markPresent(List attendanceList,int index){ | ||
attendanceList[index]['present']++; | ||
print(attendanceList[index]['present']); | ||
firestore.doc(auth.currentUser!.uid).set({"attendance":attendanceList}); | ||
} | ||
|
||
static markAbsent(List attendanceList,int index){ | ||
attendanceList[index]['total']++; | ||
print(attendanceList[index]['total']); | ||
firestore.doc(auth.currentUser!.uid).set({"attendance":attendanceList}); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters