From f183169c7583a3b0e31ca00c5c560c2713924100 Mon Sep 17 00:00:00 2001 From: Apurva-Simform <122270609+apurva010@users.noreply.github.com> Date: Fri, 10 May 2024 20:14:13 +0530 Subject: [PATCH] =?UTF-8?q?fix:=20=F0=9F=90=9B=20update=20lastOffset=20and?= =?UTF-8?q?=20fix=20full=20day=20event=20position=20when=20fullHeaderTitle?= =?UTF-8?q?=20is=20empty=20(#368)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/src/day_view/day_view.dart | 7 ++-- .../week_view/_internal_week_view_page.dart | 35 +++++++++++-------- 2 files changed, 24 insertions(+), 18 deletions(-) diff --git a/lib/src/day_view/day_view.dart b/lib/src/day_view/day_view.dart index 166c32d3..163b8937 100644 --- a/lib/src/day_view/day_view.dart +++ b/lib/src/day_view/day_view.dart @@ -354,7 +354,8 @@ class DayViewState extends State> { @override void initState() { super.initState(); - _lastScrollOffset = widget.scrollOffset ?? 0.0; + _lastScrollOffset = widget.scrollOffset ?? + widget.startDuration.inMinutes * widget.heightPerMinute; _reloadCallback = _reload; _setDateRange(); @@ -365,8 +366,8 @@ class DayViewState extends State> { _calculateHeights(); _scrollController = ScrollController( - initialScrollOffset: widget.scrollOffset ?? - widget.startDuration.inMinutes * widget.heightPerMinute); + initialScrollOffset: _lastScrollOffset, + ); _pageController = PageController(initialPage: _currentIndex); _eventArranger = widget.eventArranger ?? SideEventArranger(); _assignBuilders(); diff --git a/lib/src/week_view/_internal_week_view_page.dart b/lib/src/week_view/_internal_week_view_page.dart index e3b28255..ea2f570a 100644 --- a/lib/src/week_view/_internal_week_view_page.dart +++ b/lib/src/week_view/_internal_week_view_page.dart @@ -293,21 +293,26 @@ class _InternalWeekViewPageState 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) {