Removed zooming from timetable
This commit is contained in:
parent
7e8e49c2dd
commit
0b7908ec28
@ -4,9 +4,7 @@ part 'timetableSettings.g.dart';
|
||||
|
||||
@JsonSerializable()
|
||||
class TimetableSettings {
|
||||
double zoom;
|
||||
|
||||
TimetableSettings({required this.zoom});
|
||||
TimetableSettings();
|
||||
|
||||
factory TimetableSettings.fromJson(Map<String, dynamic> json) => _$TimetableSettingsFromJson(json);
|
||||
Map<String, dynamic> toJson() => _$TimetableSettingsToJson(this);
|
||||
|
@ -7,11 +7,7 @@ part of 'timetableSettings.dart';
|
||||
// **************************************************************************
|
||||
|
||||
TimetableSettings _$TimetableSettingsFromJson(Map<String, dynamic> json) =>
|
||||
TimetableSettings(
|
||||
zoom: (json['zoom'] as num).toDouble(),
|
||||
);
|
||||
TimetableSettings();
|
||||
|
||||
Map<String, dynamic> _$TimetableSettingsToJson(TimetableSettings instance) =>
|
||||
<String, dynamic>{
|
||||
'zoom': instance.zoom,
|
||||
};
|
||||
<String, dynamic>{};
|
||||
|
@ -34,16 +34,11 @@ enum CalendarActions { addEvent, viewEvents }
|
||||
class _TimetableState extends State<Timetable> {
|
||||
CalendarController controller = CalendarController();
|
||||
late Timer updateTimings;
|
||||
|
||||
double elementScale = 40;
|
||||
double baseElementScale = 40;
|
||||
|
||||
late final SettingsProvider settings;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
settings = Provider.of<SettingsProvider>(context, listen: false);
|
||||
elementScale = baseElementScale = settings.val().timetableSettings.zoom;
|
||||
|
||||
WidgetsBinding.instance.addPostFrameCallback((timeStamp) {
|
||||
Provider.of<TimetableProps>(context, listen: false).run();
|
||||
@ -132,17 +127,6 @@ class _TimetableState extends State<Timetable> {
|
||||
GetHolidaysResponse holidays = value.getHolidaysResponse;
|
||||
|
||||
return RefreshIndicator(
|
||||
child: GestureDetector(
|
||||
onScaleStart: (details) => baseElementScale = elementScale,
|
||||
onScaleUpdate: (details) {
|
||||
setState(() {
|
||||
elementScale = (baseElementScale * details.scale).clamp(40, 80);
|
||||
});
|
||||
},
|
||||
onScaleEnd: (details) {
|
||||
settings.val(write: true).timetableSettings.zoom = elementScale;
|
||||
},
|
||||
|
||||
child: SfCalendar(
|
||||
view: CalendarView.workWeek,
|
||||
dataSource: _buildTableEvents(value),
|
||||
@ -166,13 +150,13 @@ class _TimetableState extends State<Timetable> {
|
||||
|
||||
firstDayOfWeek: DateTime.monday,
|
||||
specialRegions: _buildSpecialTimeRegions(holidays),
|
||||
timeSlotViewSettings: TimeSlotViewSettings(
|
||||
timeSlotViewSettings: const TimeSlotViewSettings(
|
||||
startHour: 07.5,
|
||||
endHour: 16.5,
|
||||
timeInterval: const Duration(minutes: 30),
|
||||
timeInterval: Duration(minutes: 30),
|
||||
timeFormat: "HH:mm",
|
||||
dayFormat: "EE",
|
||||
timeIntervalHeight: elementScale,
|
||||
timeIntervalHeight: 40,
|
||||
),
|
||||
|
||||
timeRegionBuilder: (BuildContext context, TimeRegionDetails timeRegionDetails) => TimeRegionComponent(details: timeRegionDetails),
|
||||
@ -188,7 +172,6 @@ class _TimetableState extends State<Timetable> {
|
||||
allowDragAndDrop: false,
|
||||
allowViewNavigation: false,
|
||||
),
|
||||
),
|
||||
onRefresh: () async {
|
||||
Provider.of<TimetableProps>(context, listen: false).run(renew: true);
|
||||
return Future.delayed(const Duration(seconds: 3));
|
||||
|
@ -22,9 +22,7 @@ class DefaultSettings {
|
||||
askedForPreferredGradeSystem: false,
|
||||
inputs: []
|
||||
),
|
||||
timetableSettings: TimetableSettings(
|
||||
zoom: 40,
|
||||
),
|
||||
timetableSettings: TimetableSettings(),
|
||||
talkSettings: TalkSettings(
|
||||
sortFavoritesToTop: true,
|
||||
sortUnreadToTop: false,
|
||||
|
Loading…
x
Reference in New Issue
Block a user