Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: 🐛 onDateTap return wrong date when startHour is set #341 #350

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion lib/src/components/common_components.dart
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ class DefaultPressDetector extends StatelessWidget {
required this.minuteSlotSize,
this.onDateTap,
this.onDateLongPress,
this.startHour = 0,
});

final DateTime date;
Expand All @@ -142,6 +143,7 @@ class DefaultPressDetector extends StatelessWidget {
final MinuteSlotSize minuteSlotSize;
final DateTapCallback? onDateTap;
final DatePressCallback? onDateLongPress;
final int startHour;

@override
Widget build(BuildContext context) {
Expand Down Expand Up @@ -183,7 +185,7 @@ class DefaultPressDetector extends StatelessWidget {
date.month,
date.day,
0,
(minuteSlotSize.minutes * slot),
(minuteSlotSize.minutes * slot) + (startHour * 60),
);
}

Expand Down
1 change: 1 addition & 0 deletions lib/src/day_view/day_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -621,6 +621,7 @@ class DayViewState<T extends Object?> extends State<DayView<T>> {
minuteSlotSize: minuteSlotSize,
onDateTap: widget.onDateTap,
onDateLongPress: widget.onDateLongPress,
startHour: _startHour,
);

/// Default timeline builder this builder will be used if
Expand Down
1 change: 1 addition & 0 deletions lib/src/week_view/week_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -686,6 +686,7 @@ class WeekViewState<T extends Object?> extends State<WeekView<T>> {
minuteSlotSize: minuteSlotSize,
onDateTap: widget.onDateTap,
onDateLongPress: widget.onDateLongPress,
startHour: _startHour,
);

/// Default builder for week line.
Expand Down
Loading