Skip to content

Commit

Permalink
🐛 Fixes issue in quarter hours when startHour is provided. #387
Browse files Browse the repository at this point in the history
  • Loading branch information
ParthBaraiya committed Sep 14, 2024
1 parent 76c5430 commit 72b6ae7
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 10 deletions.
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 72b6ae7

Please sign in to comment.