Skip to content

Commit

Permalink
Fixed schedule days
Browse files Browse the repository at this point in the history
  • Loading branch information
Eduarda Magno authored and bdmendes committed Dec 16, 2023
1 parent 5afe784 commit 3beb921
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions uni/lib/view/schedule/schedule.dart
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ class SchedulePageView extends StatefulWidget {
static List<Set<Lecture>> groupLecturesByDay(List<Lecture> schedule) {
final aggLectures = <Set<Lecture>>[];

for (var i = 0; i < 5; i++) {
for (var i = 0; i < 6; i++) {
final lectures = <Lecture>{};
for (var j = 0; j < schedule.length; j++) {
if (schedule[j].startTime.weekday - 1 == i) lectures.add(schedule[j]);
Expand All @@ -73,7 +73,7 @@ class SchedulePageViewState extends GeneralPageViewState<SchedulePageView>
super.initState();
tabController = TabController(
vsync: this,
length: 5,
length: 6,
);
final offset = (widget.weekDay > 5) ? 0 : (widget.weekDay - 1) % 5;
tabController?.animateTo(tabController!.index + offset);
Expand Down Expand Up @@ -124,10 +124,10 @@ class SchedulePageViewState extends GeneralPageViewState<SchedulePageView>
/// Returns a list of widgets empty with tabs for each day of the week.
List<Widget> createTabs(MediaQueryData queryData, BuildContext context) {
final tabs = <Widget>[];
final workWeekDays = Provider.of<LocaleNotifier>(context)
.getWeekdaysWithLocale()
.sublist(0, 5);
workWeekDays.asMap().forEach((index, day) {
final allDays = Provider.of<LocaleNotifier>(context).getWeekdaysWithLocale()
..removeAt(6);

allDays.asMap().forEach((index, day) {
tabs.add(
SizedBox(
width: (queryData.size.width * 1) / 4,
Expand All @@ -147,9 +147,9 @@ class SchedulePageViewState extends GeneralPageViewState<SchedulePageView>
RequestStatus scheduleStatus,
) {
final tabBarViewContent = <Widget>[];
for (var i = 0; i < 5; i++) {
for (var day = 0; day < 6; day++) {
tabBarViewContent
.add(createScheduleByDay(context, i, lectures, scheduleStatus));
.add(createScheduleByDay(context, day, lectures, scheduleStatus));
}
return tabBarViewContent;
}
Expand Down

0 comments on commit 3beb921

Please sign in to comment.