Skip to content

Commit

Permalink
fix: 🐛 update lastOffset and fix full day event position when fullHea…
Browse files Browse the repository at this point in the history
…derTitle is empty (#368)
  • Loading branch information
apurva010 authored May 10, 2024
1 parent 21dfbe0 commit f183169
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 18 deletions.
7 changes: 4 additions & 3 deletions lib/src/day_view/day_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,8 @@ class DayViewState<T extends Object?> extends State<DayView<T>> {
@override
void initState() {
super.initState();
_lastScrollOffset = widget.scrollOffset ?? 0.0;
_lastScrollOffset = widget.scrollOffset ??
widget.startDuration.inMinutes * widget.heightPerMinute;

_reloadCallback = _reload;
_setDateRange();
Expand All @@ -365,8 +366,8 @@ class DayViewState<T extends Object?> extends State<DayView<T>> {

_calculateHeights();
_scrollController = ScrollController(
initialScrollOffset: widget.scrollOffset ??
widget.startDuration.inMinutes * widget.heightPerMinute);
initialScrollOffset: _lastScrollOffset,
);
_pageController = PageController(initialPage: _currentIndex);
_eventArranger = widget.eventArranger ?? SideEventArranger<T>();
_assignBuilders();
Expand Down
35 changes: 20 additions & 15 deletions lib/src/week_view/_internal_week_view_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -293,21 +293,26 @@ class _InternalWeekViewPageState<T extends Object?>
child: Row(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
if (widget.fullDayHeaderTitle.isNotEmpty)
Container(
width: widget.timeLineWidth +
widget.hourIndicatorSettings.offset,
padding: const EdgeInsets.symmetric(
vertical: 2,
horizontal: 1,
),
child: Text(
widget.fullDayHeaderTitle,
textAlign: widget.fullDayHeaderTextConfig.textAlign,
maxLines: widget.fullDayHeaderTextConfig.maxLines,
overflow: widget.fullDayHeaderTextConfig.textOverflow,
),
),
SizedBox(
width: widget.timeLineWidth +
widget.hourIndicatorSettings.offset,
child: widget.fullDayHeaderTitle.isNotEmpty
? Padding(
padding: const EdgeInsets.symmetric(
vertical: 2,
horizontal: 1,
),
child: Text(
widget.fullDayHeaderTitle,
textAlign:
widget.fullDayHeaderTextConfig.textAlign,
maxLines: widget.fullDayHeaderTextConfig.maxLines,
overflow:
widget.fullDayHeaderTextConfig.textOverflow,
),
)
: SizedBox.shrink(),
),
...List.generate(
filteredDates.length,
(index) {
Expand Down

0 comments on commit f183169

Please sign in to comment.