From 189d10e07080c03e846320cb2d05a168fa780a6a Mon Sep 17 00:00:00 2001 From: Apurva-Simform <122270609+apurva010@users.noreply.github.com> Date: Wed, 1 May 2024 11:27:30 +0530 Subject: [PATCH] =?UTF-8?q?fix:=20=F0=9F=90=9B=20onDateTap=20return=20wron?= =?UTF-8?q?g=20date=20when=20startHour=20is=20set=20#341=20(#350)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - add startHour minutes (startHour * 60) to DateTime which then passed as arguments to onDateTap --- lib/src/components/common_components.dart | 4 +++- lib/src/day_view/day_view.dart | 1 + lib/src/week_view/week_view.dart | 1 + 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/src/components/common_components.dart b/lib/src/components/common_components.dart index d0a1d828..227fc001 100644 --- a/lib/src/components/common_components.dart +++ b/lib/src/components/common_components.dart @@ -133,6 +133,7 @@ class DefaultPressDetector extends StatelessWidget { required this.minuteSlotSize, this.onDateTap, this.onDateLongPress, + this.startHour = 0, }); final DateTime date; @@ -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) { @@ -183,7 +185,7 @@ class DefaultPressDetector extends StatelessWidget { date.month, date.day, 0, - (minuteSlotSize.minutes * slot), + (minuteSlotSize.minutes * slot) + (startHour * 60), ); } diff --git a/lib/src/day_view/day_view.dart b/lib/src/day_view/day_view.dart index ece19e73..3b35afdb 100644 --- a/lib/src/day_view/day_view.dart +++ b/lib/src/day_view/day_view.dart @@ -621,6 +621,7 @@ class DayViewState extends State> { minuteSlotSize: minuteSlotSize, onDateTap: widget.onDateTap, onDateLongPress: widget.onDateLongPress, + startHour: _startHour, ); /// Default timeline builder this builder will be used if diff --git a/lib/src/week_view/week_view.dart b/lib/src/week_view/week_view.dart index e922a78e..b9aa7e94 100644 --- a/lib/src/week_view/week_view.dart +++ b/lib/src/week_view/week_view.dart @@ -686,6 +686,7 @@ class WeekViewState extends State> { minuteSlotSize: minuteSlotSize, onDateTap: widget.onDateTap, onDateLongPress: widget.onDateLongPress, + startHour: _startHour, ); /// Default builder for week line.