#10 Fixed gray background in timetable on days outside of given range
This commit is contained in:
parent
8db1139d0d
commit
395d74ed4e
@ -2,4 +2,8 @@ extension IsSameDay on DateTime {
|
||||
bool isSameDay(DateTime other) {
|
||||
return year == other.year && month == other.month && day == other.day;
|
||||
}
|
||||
|
||||
DateTime nextWeekday(int day) {
|
||||
return add(Duration(days: (day - weekday) % DateTime.daysPerWeek));
|
||||
}
|
||||
}
|
@ -12,16 +12,6 @@ import '../../api/webuntis/queries/getTimetable/getTimetableResponse.dart';
|
||||
import '../../api/webuntis/webuntisError.dart';
|
||||
import '../dataHolder.dart';
|
||||
|
||||
extension DateTimeExtension on DateTime {
|
||||
DateTime jumpToNextWeekDay(int day) {
|
||||
return add(
|
||||
Duration(
|
||||
days: (day - weekday) % DateTime.daysPerWeek,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class TimetableProps extends DataHolder {
|
||||
final _queryWeek = DateTime.now().add(const Duration(days: 2));
|
||||
|
||||
|
@ -102,8 +102,8 @@ class _TimetableState extends State<Timetable> {
|
||||
view: CalendarView.workWeek,
|
||||
dataSource: _buildTableEvents(value),
|
||||
|
||||
maxDate: DateTime.now().add(const Duration(days: 7)),
|
||||
minDate: DateTime.now().subtract(const Duration (days: 14)),
|
||||
maxDate: DateTime.now().add(const Duration(days: 7)).nextWeekday(DateTime.saturday),
|
||||
minDate: DateTime.now().subtract(const Duration (days: 14)).nextWeekday(DateTime.sunday),
|
||||
|
||||
controller: controller,
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user