-
Notifications
You must be signed in to change notification settings - Fork 14
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 #31 from IamMuuo/dev
Attendance
- Loading branch information
Showing
8 changed files
with
212 additions
and
56 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
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,61 @@ | ||
import 'package:academia/controllers/courses_page_controller.dart'; | ||
import 'package:flutter/cupertino.dart'; | ||
import 'package:flutter/material.dart'; | ||
import 'package:get/get.dart'; | ||
import 'package:get/get_connect/http/src/utils/utils.dart'; | ||
import 'package:loading_animation_widget/loading_animation_widget.dart'; | ||
|
||
class AttendancePage extends StatefulWidget { | ||
const AttendancePage({super.key}); | ||
|
||
@override | ||
State<AttendancePage> createState() => _AttendancePageState(); | ||
} | ||
|
||
class _AttendancePageState extends State<AttendancePage> { | ||
bool isLoading = false; | ||
late CoursesPageController controller; | ||
|
||
@override | ||
void initState() { | ||
controller = Get.find<CoursesPageController>(); | ||
super.initState(); | ||
} | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return Scaffold( | ||
appBar: AppBar( | ||
title: const Text("My Class Attendance"), | ||
), | ||
body: controller.hasProgress.value | ||
? Padding( | ||
padding: const EdgeInsets.all(2), | ||
child: GridView.count( | ||
crossAxisCount: 2, | ||
mainAxisSpacing: 2, | ||
crossAxisSpacing: 2, | ||
children: controller.buildProgressCards(), | ||
), | ||
) | ||
: const Center( | ||
child: Text("Seems you have no course progress"), | ||
), | ||
floatingActionButton: FloatingActionButton( | ||
onPressed: () async { | ||
setState(() { | ||
isLoading = true; | ||
}); | ||
await controller.updateProgress(); | ||
setState(() { | ||
isLoading = false; | ||
}); | ||
}, | ||
child: isLoading | ||
? LoadingAnimationWidget.horizontalRotatingDots( | ||
color: Colors.white, size: 20) | ||
: const Icon(Icons.refresh), | ||
), | ||
); | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
import 'package:academia/constants/common.dart'; | ||
import 'package:flutter/material.dart'; | ||
import 'package:percent_indicator/percent_indicator.dart'; | ||
|
||
class CourseAttendanceCard extends StatelessWidget { | ||
const CourseAttendanceCard({ | ||
super.key, | ||
required this.course, | ||
required this.percent, | ||
}); | ||
final String course; | ||
final double percent; | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return Container( | ||
padding: const EdgeInsets.all(16), | ||
decoration: BoxDecoration( | ||
border: Border.all( | ||
color: Theme.of(context).primaryColor, | ||
), | ||
), | ||
constraints: BoxConstraints( | ||
minWidth: MediaQuery.of(context).size.width * 0.38, | ||
maxWidth: MediaQuery.of(context).size.width * 0.4, | ||
), | ||
child: CircularPercentIndicator( | ||
animation: true, | ||
animationDuration: 1000, | ||
radius: 70, | ||
percent: percent / 100, | ||
lineWidth: 20, | ||
progressColor: Theme.of(context).primaryColor, | ||
circularStrokeCap: CircularStrokeCap.round, | ||
center: Text( | ||
"$percent%", | ||
style: h6, | ||
), | ||
footer: Text( | ||
course, | ||
overflow: TextOverflow.ellipsis, | ||
), | ||
), | ||
); | ||
} | ||
} |
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