Skip to content

Commit

Permalink
fix: SimformSolutionsPvtLtd#446 week view doesn't reflect changes to …
Browse files Browse the repository at this point in the history
…startHour and endHour.
  • Loading branch information
bsutton committed Jan 4, 2025
1 parent c16ba5a commit 800dd20
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 6 deletions.
25 changes: 19 additions & 6 deletions lib/src/week_view/_internal_week_view_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -227,13 +227,19 @@ class _InternalWeekViewPageState<T extends Object?>
extends State<InternalWeekViewPage<T>> {
late ScrollController scrollController;

late int startHour;
late int endHour;

@override
void initState() {
super.initState();
scrollController = ScrollController(
initialScrollOffset: widget.lastScrollOffset,
);
scrollController.addListener(_scrollControllerListener);

startHour = widget.startHour;
endHour = widget.endHour;
}

@override
Expand All @@ -248,6 +254,13 @@ class _InternalWeekViewPageState<T extends Object?>
widget.scrollListener(scrollController);
}

@override
void didUpdateWidget(InternalWeekViewPage<T> oldWidget) {
startHour = widget.startHour;
endHour = widget.endHour;
super.didUpdateWidget(oldWidget);
}

@override
Widget build(BuildContext context) {
final filteredDates = _filteredDate();
Expand Down Expand Up @@ -368,8 +381,8 @@ class _InternalWeekViewPageState<T extends Object?>
dashSpaceWidth:
widget.hourIndicatorSettings.dashSpaceWidth,
emulateVerticalOffsetBy: widget.emulateVerticalOffsetBy,
startHour: widget.startHour,
endHour: widget.endHour,
startHour: startHour,
endHour: endHour,
),
),
if (widget.showHalfHours)
Expand Down Expand Up @@ -451,13 +464,13 @@ class _InternalWeekViewPageState<T extends Object?>
eventTileBuilder: widget.eventTileBuilder,
scrollNotifier:
widget.scrollConfiguration,
startHour: widget.startHour,
startHour: startHour,
events: widget.controller.getEventsOnDay(
filteredDates[index],
includeFullDayEvents: false,
),
heightPerMinute: widget.heightPerMinute,
endHour: widget.endHour,
endHour: endHour,
),
],
),
Expand All @@ -473,7 +486,7 @@ class _InternalWeekViewPageState<T extends Object?>
height: widget.height,
timeLineOffset: widget.timeLineOffset,
timeLineBuilder: widget.timeLineBuilder,
startHour: widget.startHour,
startHour: startHour,
showHalfHours: widget.showHalfHours,
showQuarterHours: widget.showQuarterHours,
liveTimeIndicatorSettings:
Expand All @@ -490,7 +503,7 @@ class _InternalWeekViewPageState<T extends Object?>
height: widget.height,
heightPerMinute: widget.heightPerMinute,
timeLineWidth: widget.timeLineWidth,
startHour: widget.startHour,
startHour: startHour,
endHour: widget.endHour,
),
],
Expand Down
3 changes: 3 additions & 0 deletions lib/src/week_view/week_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -469,6 +469,9 @@ class WeekViewState<T extends Object?> extends State<WeekView<T>> {

_eventArranger = widget.eventArranger ?? SideEventArranger<T>();

_startHour = widget.startHour;
_endHour = widget.endHour;

// Update heights.
_calculateHeights();

Expand Down

0 comments on commit 800dd20

Please sign in to comment.