Skip to content

Commit

Permalink
回復「修課人數」並且新增「學生清單」標題 (#233)
Browse files Browse the repository at this point in the history
* Implement: Improved UI and add student count

* Chore: Format

* refactor: Use final for local variables in course info page

---------

Co-authored-by: Riley Ho <[email protected]>
  • Loading branch information
ntut-xuan and rileychh authored Jan 31, 2025
1 parent e6b5a61 commit 31930fd
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions lib/ui/pages/coursedetail/screen/course_info_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,9 @@ class _CourseInfoPageState extends State<CourseInfoPage> with AutomaticKeepAlive
courseExtraInfo = task.result;
}
widget.courseInfo.extra = courseExtraInfo;
final List<CourseStudent> students = await _getCourseStudent();
final Map<String, String> departmentMap = await _getCourseDepartmentMap();

courseData.add(_buildCourseInfo(sprintf("%s: %s", [R.current.courseId, courseMainInfo.course.id])));
courseData.add(_buildCourseInfo(sprintf("%s: %s", [R.current.courseName, courseMainInfo.course.name])));
courseData.add(_buildCourseInfo(sprintf("%s: %s ", [R.current.credit, courseMainInfo.course.credits])));
Expand All @@ -88,15 +91,15 @@ class _CourseInfoPageState extends State<CourseInfoPage> with AutomaticKeepAlive
courseMainInfo.getClassroomNameList(),
courseMainInfo.getClassroomHrefList(),
));
courseData.add(_buildCourseInfo(sprintf("%s: %s", [R.current.numberOfStudent, students.length])));

listItem.removeRange(0, listItem.length);
listItem.add(_buildInfoTitle(R.current.courseData));
listItem.addAll(courseData);

List<CourseStudent> students = await _getCourseStudent();
Map<String, String> departmentMap = await _getCourseDepartmentMap();

if (students.isNotEmpty) {
listItem.add(_buildInfoTitle(""));
listItem.add(_buildInfoTitle(R.current.studentList));
listItem.add(
Padding(
padding: const EdgeInsets.symmetric(vertical: 4, horizontal: 0),
Expand Down

0 comments on commit 31930fd

Please sign in to comment.