Skip to content

Commit

Permalink
Merge pull request #210 from CosmicRaptor/main
Browse files Browse the repository at this point in the history
added attendance screen
  • Loading branch information
CosmicRaptor authored Jul 19, 2024
2 parents 7a9a084 + 69ef71d commit 6dc1fd7
Show file tree
Hide file tree
Showing 4 changed files with 159 additions and 1 deletion.
66 changes: 66 additions & 0 deletions lib/new_ui/screens/attendance_screen/attendance_screen.dart
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),
],
),
),
);
}
}
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)),
),
),
],
)
],
),
)
);
}
}
10 changes: 9 additions & 1 deletion lib/new_ui/screens/main_screen/main_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:go_router/go_router.dart';
import 'package:tsec_app/models/user_model/user_model.dart';
import 'package:tsec_app/new_ui/colors.dart';
import 'package:tsec_app/new_ui/screens/attendance_screen/attendance_screen.dart';
import 'package:tsec_app/new_ui/screens/bug_report_screen/bug_report_screen.dart';
import 'package:tsec_app/new_ui/screens/coming_soon_screen/coming_soon.dart';
import 'package:tsec_app/new_ui/screens/about_us_screen/about_us.dart';
Expand Down Expand Up @@ -82,6 +83,7 @@ class _MainScreenState extends ConsumerState<MainScreen> {
),
"notes": const NotesScreen(),
"timetable": const TimeTable(),
"attendance": const AttendanceScreen(),
"concession": const RailwayConcessionScreen(),
"profile": ProfilePage(
justLoggedIn: false,
Expand Down Expand Up @@ -161,6 +163,7 @@ class _MainScreenState extends ConsumerState<MainScreen> {
),
const NotesScreen(),
ProfilePage(justLoggedIn: false),
const AttendanceScreen(),
const RailwayConcessionScreen(),
const TPCScreen(),
const CommitteesScreen(),
Expand All @@ -182,6 +185,7 @@ class _MainScreenState extends ConsumerState<MainScreen> {
},
),
const NotesScreen(),
const AttendanceScreen(),
const RailwayConcessionScreen(),
ProfilePage(justLoggedIn: false),
const TPCScreen(),
Expand Down Expand Up @@ -868,6 +872,8 @@ class _MainScreenState extends ConsumerState<MainScreen> {
case 1:
return "Notes";
case 2:
return "Attendance";
case 3:
return "Profile";
default:
return "";
Expand All @@ -879,8 +885,10 @@ class _MainScreenState extends ConsumerState<MainScreen> {
case 1:
return "Notes";
case 2:
return "Railway";
return "Attendance";
case 3:
return "Railway";
case 4:
return "Profile";
default:
return "";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:tsec_app/models/user_model/user_model.dart';
import 'package:tsec_app/new_ui/colors.dart';
import 'package:tsec_app/new_ui/screens/attendance_screen/attendance_screen.dart';
import 'package:tsec_app/new_ui/screens/erp_screen/erp_screen.dart';
import 'package:tsec_app/new_ui/screens/home_screen/widgets/home_widget.dart';
import 'package:tsec_app/new_ui/screens/railway_screen/railway_screen.dart';
Expand Down Expand Up @@ -55,6 +56,7 @@ class _HomeScreenState extends ConsumerState<MainBottomNavBar> {
),
"notes": NotesScreen(),
"timetable": const TimeTable(),
"attendance": const AttendanceScreen(),
"concession": const RailwayConcessionScreen(),
"profile": ProfilePage(
justLoggedIn: false,
Expand Down Expand Up @@ -112,6 +114,12 @@ class _HomeScreenState extends ConsumerState<MainBottomNavBar> {
icon: Icon(Icons.notes_outlined),
label: "Notes",
),
BottomNavigationBarItem(
backgroundColor: Colors.transparent,
activeIcon: Icon(Icons.pentagon),
icon: Icon(Icons.pentagon_outlined),
label: "Attendance",
),
BottomNavigationBarItem(
backgroundColor: Colors.transparent,
icon: Stack(
Expand Down

0 comments on commit 6dc1fd7

Please sign in to comment.