From 193837f7eaadb9190e8d290fd8d28091039025f4 Mon Sep 17 00:00:00 2001 From: Parth Baraiya Date: Sat, 14 Sep 2024 18:47:24 +0530 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20Fixes=20issue=20in=20quarter=20h?= =?UTF-8?q?ours=20when=20startHour=20is=20provided.=20#387?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 4 ++++ example/pubspec.yaml | 5 +++-- lib/src/components/_internal_components.dart | 12 ++++++------ lib/src/week_view/_internal_week_view_page.dart | 8 ++++++-- 4 files changed, 19 insertions(+), 10 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 64b04e1c..45bb32e6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +# [1.2.1 - Unreleased] + +- Fixes issue in showing quarter hours when startHour is provided. [#387](https://github.com/SimformSolutionsPvtLtd/flutter_calendar_view/issues/387) + # [1.2.0 - 10 May 2024](https://github.com/SimformSolutionsPvtLtd/flutter_calendar_view/tree/1.2.0) - Fixed issue when adding full-day events to WeekView, event is not display at correct date. [#259](https://github.com/SimformSolutionsPvtLtd/flutter_calendar_view/issues/259) diff --git a/example/pubspec.yaml b/example/pubspec.yaml index 94dd2276..8c8fe21e 100644 --- a/example/pubspec.yaml +++ b/example/pubspec.yaml @@ -18,7 +18,8 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev version: 1.0.0+1 environment: - sdk: ">=2.18.0 <4.0.0" + sdk: ">=3.5.3 <4.0.0" + flutter: 3.24.3 dependencies: flutter: @@ -29,7 +30,7 @@ dependencies: # Use with the CupertinoIcons class for iOS style icons. cupertino_icons: ^1.0.2 intl: - flutter_colorpicker: ^0.6.0 + flutter_colorpicker: ^1.1.0 calendar_view: path: ../ diff --git a/lib/src/components/_internal_components.dart b/lib/src/components/_internal_components.dart index 129e84c1..d764d858 100644 --- a/lib/src/components/_internal_components.dart +++ b/lib/src/components/_internal_components.dart @@ -175,7 +175,7 @@ class TimeLine extends StatefulWidget { required this.height, required this.timeLineOffset, required this.timeLineBuilder, - required this.startHour, + this.startHour = 0, this.showHalfHours = false, this.showQuarterHours = false, required this.liveTimeIndicatorSettings, @@ -248,14 +248,14 @@ class _TimeLineState extends State { minutes: 30, ), if (widget.showQuarterHours) - for (int i = 0; i < widget.endHour; i++) ...[ + for (int i = widget.startHour; i < widget.endHour; i++) ...[ /// this is for 15 minutes _timelinePositioned( - topPosition: widget.hourHeight * i - + topPosition: widget.hourHeight * (i - widget.startHour) - widget.timeLineOffset + widget.hourHeight * 0.25, bottomPosition: widget.height - - (widget.hourHeight * (i + 1)) + + (widget.hourHeight * (i - widget.startHour + 1)) + widget.timeLineOffset, hour: i, minutes: 15, @@ -263,11 +263,11 @@ class _TimeLineState extends State { /// this is for 45 minutes _timelinePositioned( - topPosition: widget.hourHeight * i - + topPosition: widget.hourHeight * (i - widget.startHour) - widget.timeLineOffset + widget.hourHeight * 0.75, bottomPosition: widget.height - - (widget.hourHeight * (i + 1)) + + (widget.hourHeight * (i - widget.startHour + 1)) + widget.timeLineOffset, hour: i, minutes: 45, diff --git a/lib/src/week_view/_internal_week_view_page.dart b/lib/src/week_view/_internal_week_view_page.dart index 2603e890..bc7e5ab0 100644 --- a/lib/src/week_view/_internal_week_view_page.dart +++ b/lib/src/week_view/_internal_week_view_page.dart @@ -5,8 +5,8 @@ import 'package:flutter/material.dart'; import '../components/_internal_components.dart'; -import '../components/week_view_components.dart'; import '../components/event_scroll_notifier.dart'; +import '../components/week_view_components.dart'; import '../enumerations.dart'; import '../event_arrangers/event_arrangers.dart'; import '../event_controller.dart'; @@ -353,8 +353,12 @@ class _InternalWeekViewPageState minuteHeight: widget.heightPerMinute, verticalLineOffset: widget.verticalLineOffset, showVerticalLine: widget.showVerticalLine, - startHour: widget.startHour, + lineStyle: widget.hourIndicatorSettings.lineStyle, + dashWidth: widget.hourIndicatorSettings.dashWidth, + dashSpaceWidth: + widget.hourIndicatorSettings.dashSpaceWidth, emulateVerticalOffsetBy: widget.emulateVerticalOffsetBy, + startHour: widget.startHour, endHour: widget.endHour, ), ),