Skip to content

Commit

Permalink
Merge pull request #404 from SimformSolutionsPvtLtd/fix/387
Browse files Browse the repository at this point in the history
🐛 Fixes issue in quarter hours when startHour is provided. #387
  • Loading branch information
PRBaraiya authored Sep 16, 2024
2 parents 73d880a + bf780fb commit 126ecd2
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 10 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# [1.2.1 - Unreleased]

- Fixes issue in showing quarter hours when startHour is provided. [#387](https://github.com/SimformSolutionsPvtLtd/flutter_calendar_view/issues/387)
- Use `hourLinePainter` in `DayView` [#386](https://github.com/SimformSolutionsPvtLtd/flutter_calendar_view/issues/386)

# [1.2.0 - 10 May 2024](https://github.com/SimformSolutionsPvtLtd/flutter_calendar_view/tree/1.2.0)
Expand Down
5 changes: 3 additions & 2 deletions example/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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: ../

Expand Down
12 changes: 6 additions & 6 deletions lib/src/components/_internal_components.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -248,26 +248,26 @@ class _TimeLineState extends State<TimeLine> {
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,
),

/// 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,
Expand Down
8 changes: 6 additions & 2 deletions lib/src/week_view/_internal_week_view_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -353,8 +353,12 @@ class _InternalWeekViewPageState<T extends Object?>
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,
),
),
Expand Down

0 comments on commit 126ecd2

Please sign in to comment.