Added refreshindicator for timetable
This commit is contained in:
parent
b18aa5a99e
commit
c2f05da96e
@ -99,63 +99,69 @@ class _TimetableState extends State<Timetable> {
|
|||||||
|
|
||||||
GetHolidaysResponse holidays = value.getHolidaysResponse;
|
GetHolidaysResponse holidays = value.getHolidaysResponse;
|
||||||
|
|
||||||
return GestureDetector(
|
return RefreshIndicator(
|
||||||
onScaleStart: (details) => baseElementScale = elementScale,
|
child: GestureDetector(
|
||||||
onScaleUpdate: (details) {
|
onScaleStart: (details) => baseElementScale = elementScale,
|
||||||
setState(() {
|
onScaleUpdate: (details) {
|
||||||
elementScale = (baseElementScale * details.scale).clamp(40, 80);
|
setState(() {
|
||||||
});
|
elementScale = (baseElementScale * details.scale).clamp(40, 80);
|
||||||
},
|
});
|
||||||
onScaleEnd: (details) {
|
},
|
||||||
settings.val(write: true).timetableSettings.zoom = elementScale;
|
onScaleEnd: (details) {
|
||||||
},
|
settings.val(write: true).timetableSettings.zoom = elementScale;
|
||||||
|
},
|
||||||
|
|
||||||
child: SfCalendar(
|
child: SfCalendar(
|
||||||
view: CalendarView.workWeek,
|
view: CalendarView.workWeek,
|
||||||
dataSource: _buildTableEvents(value),
|
dataSource: _buildTableEvents(value),
|
||||||
|
|
||||||
maxDate: DateTime.now().add(const Duration(days: 7)).nextWeekday(DateTime.saturday),
|
maxDate: DateTime.now().add(const Duration(days: 7)).nextWeekday(DateTime.saturday),
|
||||||
minDate: DateTime.now().subtract(const Duration (days: 14)).nextWeekday(DateTime.sunday),
|
minDate: DateTime.now().subtract(const Duration (days: 14)).nextWeekday(DateTime.sunday),
|
||||||
|
|
||||||
controller: controller,
|
controller: controller,
|
||||||
|
|
||||||
onViewChanged: (ViewChangedDetails details) {
|
onViewChanged: (ViewChangedDetails details) {
|
||||||
WidgetsBinding.instance.addPostFrameCallback((timeStamp) {
|
WidgetsBinding.instance.addPostFrameCallback((timeStamp) {
|
||||||
Provider.of<TimetableProps>(context, listen: false).updateWeek(details.visibleDates.first, details.visibleDates.last);
|
Provider.of<TimetableProps>(context, listen: false).updateWeek(details.visibleDates.first, details.visibleDates.last);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
onTap: (calendarTapDetails) {
|
onTap: (calendarTapDetails) {
|
||||||
if(calendarTapDetails.appointments == null) return;
|
if(calendarTapDetails.appointments == null) return;
|
||||||
Appointment tapped = calendarTapDetails.appointments!.first;
|
Appointment tapped = calendarTapDetails.appointments!.first;
|
||||||
AppointmentDetails.show(context, value, tapped);
|
AppointmentDetails.show(context, value, tapped);
|
||||||
},
|
},
|
||||||
|
|
||||||
firstDayOfWeek: DateTime.monday,
|
firstDayOfWeek: DateTime.monday,
|
||||||
specialRegions: _buildSpecialTimeRegions(holidays),
|
specialRegions: _buildSpecialTimeRegions(holidays),
|
||||||
timeSlotViewSettings: TimeSlotViewSettings(
|
timeSlotViewSettings: TimeSlotViewSettings(
|
||||||
startHour: 07.5,
|
startHour: 07.5,
|
||||||
endHour: 16.5,
|
endHour: 16.5,
|
||||||
timeInterval: const Duration(minutes: 30),
|
timeInterval: const Duration(minutes: 30),
|
||||||
timeFormat: "HH:mm",
|
timeFormat: "HH:mm",
|
||||||
dayFormat: "EE",
|
dayFormat: "EE",
|
||||||
timeIntervalHeight: elementScale,
|
timeIntervalHeight: elementScale,
|
||||||
|
),
|
||||||
|
|
||||||
|
timeRegionBuilder: (BuildContext context, TimeRegionDetails timeRegionDetails) => TimeRegionComponent(details: timeRegionDetails),
|
||||||
|
appointmentBuilder: (BuildContext context, CalendarAppointmentDetails details) => AppointmentComponent(
|
||||||
|
details: details,
|
||||||
|
crossedOut: _isCrossedOut(details)
|
||||||
|
),
|
||||||
|
|
||||||
|
headerHeight: 0,
|
||||||
|
selectionDecoration: const BoxDecoration(),
|
||||||
|
|
||||||
|
allowAppointmentResize: false,
|
||||||
|
allowDragAndDrop: false,
|
||||||
|
allowViewNavigation: false,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
|
onRefresh: () async {
|
||||||
timeRegionBuilder: (BuildContext context, TimeRegionDetails timeRegionDetails) => TimeRegionComponent(details: timeRegionDetails),
|
Provider.of<TimetableProps>(context, listen: false).run(renew: true);
|
||||||
appointmentBuilder: (BuildContext context, CalendarAppointmentDetails details) => AppointmentComponent(
|
return Future.delayed(const Duration(seconds: 3));
|
||||||
details: details,
|
}
|
||||||
crossedOut: _isCrossedOut(details)
|
);
|
||||||
),
|
|
||||||
|
|
||||||
headerHeight: 0,
|
|
||||||
selectionDecoration: const BoxDecoration(),
|
|
||||||
|
|
||||||
allowAppointmentResize: false,
|
|
||||||
allowDragAndDrop: false,
|
|
||||||
allowViewNavigation: false,
|
|
||||||
),
|
|
||||||
);
|
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user