From ab16d9bf9e2cd8a8acb92efee56954732e302c4b Mon Sep 17 00:00:00 2001 From: ravilsimform <97508406+ravilsimform@users.noreply.github.com> Date: Thu, 22 Feb 2024 15:37:41 +0530 Subject: [PATCH] =?UTF-8?q?fix:=20=F0=9F=90=9BHeader=20view=20hidden=20fun?= =?UTF-8?q?ctionality=20added=20#299.=20(#324)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - In DayView, MonthView and WeekView hidden method added for hiding header. --- CHANGELOG.md | 2 +- README.md | 7 +++++-- lib/src/day_view/day_view.dart | 5 +++++ lib/src/month_view/month_view.dart | 5 +++++ lib/src/week_view/week_view.dart | 5 +++++ 5 files changed, 21 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4cd10dec..58beea44 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,5 @@ # [1.0.5] (UnReleased) - +- Fixed issue related to Hiding Header [#299](https://github.com/SimformSolutionsPvtLtd/flutter_calendar_view/pull/299) - Fixed issue related to auto scroll to initial duration for day view. [#269](https://github.com/SimformSolutionsPvtLtd/flutter_calendar_view/issues/269) - Added diff --git a/README.md b/README.md index d91d8c98..a5267943 100644 --- a/README.md +++ b/README.md @@ -149,6 +149,7 @@ MonthView( // This callback will only work if cellBuilder is null. onEventTap: (event, date) => print(event), onDateLongPress: (date) => print(date), + headerBuilder: MonthHeader.hidden // To hide month header ); ``` @@ -177,7 +178,8 @@ DayView( startHour: 5 // To set the first hour displayed (ex: 05:00) hourLinePainter: (lineColor, lineHeight, offset, minuteHeight, showVerticalLine, verticalLineOffset) { return //Your custom painter. - } + }, + dayTitleBuilder: DayHeader.hidden // To Hide day header ); ``` @@ -208,7 +210,8 @@ WeekView( showVerticalLines: false, // Show the vertical line between days. hourLinePainter: (lineColor, lineHeight, offset, minuteHeight, showVerticalLine, verticalLineOffset) { return //Your custom painter. - } + }, + weekPageHeaderBuilder: WeekHeader.hidden // To hide week header ); ``` diff --git a/lib/src/day_view/day_view.dart b/lib/src/day_view/day_view.dart index 98006562..e687c3c8 100644 --- a/lib/src/day_view/day_view.dart +++ b/lib/src/day_view/day_view.dart @@ -911,3 +911,8 @@ class DayViewState extends State> { DateTime get currentDate => DateTime(_currentDate.year, _currentDate.month, _currentDate.day); } + +class DayHeader { + /// Hide Header Widget + static Widget hidden(DateTime date) => SizedBox.shrink(); +} diff --git a/lib/src/month_view/month_view.dart b/lib/src/month_view/month_view.dart index 2966adfd..f0a0b65d 100644 --- a/lib/src/month_view/month_view.dart +++ b/lib/src/month_view/month_view.dart @@ -667,3 +667,8 @@ class _MonthPageBuilder extends StatelessWidget { ); } } + +class MonthHeader { + /// Hide Header Widget + static Widget hidden(DateTime date) => SizedBox.shrink(); +} diff --git a/lib/src/week_view/week_view.dart b/lib/src/week_view/week_view.dart index 2147774b..667ef2b4 100644 --- a/lib/src/week_view/week_view.dart +++ b/lib/src/week_view/week_view.dart @@ -1003,3 +1003,8 @@ class WeekViewState extends State> { bool _showLiveTimeIndicator(List dates) => dates.any((date) => date.compareWithoutTime(DateTime.now())); } + +class WeekHeader { + /// Hide Header Widget + static Widget hidden(DateTime date, DateTime date1) => SizedBox.shrink(); +}