-
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 #210 from CosmicRaptor/main
added attendance screen
- Loading branch information
Showing
4 changed files
with
159 additions
and
1 deletion.
There are no files selected for viewing
66 changes: 66 additions & 0 deletions
66
lib/new_ui/screens/attendance_screen/attendance_screen.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,66 @@ | ||
import 'package:flutter/material.dart'; | ||
import 'package:tsec_app/new_ui/screens/attendance_screen/widgets/attendance_subject_widget.dart'; | ||
|
||
//make this a consumer widget later | ||
class AttendanceScreen extends StatelessWidget { | ||
const AttendanceScreen({super.key}); | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
//put the attendance from a provider here | ||
double attendance = 0.5; | ||
var size = MediaQuery.of(context).size; | ||
return SingleChildScrollView( | ||
child: Padding( | ||
padding: const EdgeInsets.all(8.0), | ||
child: Column( | ||
children: [ | ||
const SizedBox(height: 20,), | ||
Text( | ||
attendance < 0.75 ? 'Your attendance is low' : 'Your attendance is good', | ||
style: TextStyle(color: Colors.white, fontSize: 20), | ||
), | ||
const SizedBox(height: 30,), | ||
Stack( | ||
children: [ | ||
Positioned.fill( | ||
child: Align( | ||
alignment: Alignment.center, | ||
child: Text( | ||
'${attendance * 100} %' , | ||
style: TextStyle(color: Colors.white, fontSize: 50), | ||
), | ||
), | ||
), | ||
SizedBox( | ||
width: size.width * 0.8, | ||
height: size.height * 0.4, | ||
child: CircularProgressIndicator( | ||
value: attendance, | ||
backgroundColor: Colors.white, | ||
valueColor: AlwaysStoppedAnimation<Color>(Colors.blue), | ||
strokeWidth: 20, | ||
strokeCap: StrokeCap.round, | ||
), | ||
), | ||
], | ||
), | ||
const SizedBox(height: 20,), | ||
Row( | ||
mainAxisAlignment: MainAxisAlignment.spaceBetween, | ||
children: [ | ||
Text("Present: 5", style: TextStyle(color: Colors.white),), | ||
Text("Absent: 5", style: TextStyle(color: Colors.white),), | ||
], | ||
), | ||
const SizedBox(height: 20,), | ||
//put the subject attendance cards from here | ||
AttendanceSubjectWidget(attendance: 0.5), | ||
const SizedBox(height: 10,), | ||
AttendanceSubjectWidget(attendance: 0.75), | ||
], | ||
), | ||
), | ||
); | ||
} | ||
} |
76 changes: 76 additions & 0 deletions
76
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 |
---|---|---|
@@ -0,0 +1,76 @@ | ||
import 'package:flutter/material.dart'; | ||
|
||
class AttendanceSubjectWidget extends StatelessWidget { | ||
final double attendance; | ||
const AttendanceSubjectWidget({super.key, required this.attendance}); | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return Card( | ||
color: const Color(0xff464544), | ||
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,), | ||
Text( | ||
'5/10', | ||
style: TextStyle(color: Colors.white, fontSize: 12), | ||
), | ||
Expanded( | ||
child: Row( | ||
mainAxisAlignment: MainAxisAlignment.end, | ||
children: [ | ||
Text( | ||
'50%', | ||
style: TextStyle(color: Colors.white, fontSize: 16), | ||
), | ||
], | ||
), | ||
), | ||
], | ||
), | ||
const SizedBox(height: 10,), | ||
const Text("Not accepted", style: TextStyle(color: Colors.white, fontSize: 12),), | ||
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: Colors.green, | ||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(20)), | ||
), | ||
), | ||
ElevatedButton( | ||
onPressed: (){}, | ||
child: const Text('Absent', style: TextStyle(color: Colors.white),), | ||
style: ElevatedButton.styleFrom( | ||
backgroundColor: Colors.red, | ||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(20)), | ||
), | ||
), | ||
], | ||
) | ||
], | ||
), | ||
) | ||
); | ||
} | ||
} |
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