diff --git a/CHANGELOG.md b/CHANGELOG.md index 510f9bd6..767ae495 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,5 @@ - # [1.1.1] (UnReleased) +- Added support for horizontal scroll physics of week and month view page. [#314](https://github.com/SimformSolutionsPvtLtd/flutter_calendar_view/issues/314) - Fixed issue related to onDateTap no triggered in WeekView and dayView. [#332](https://github.com/SimformSolutionsPvtLtd/flutter_calendar_view/issues/332) # [1.1.0 - 28 Feb 2024](https://github.com/SimformSolutionsPvtLtd/flutter_calendar_view/tree/1.1.0) - Fixed issue related to Hiding Header [#299](https://github.com/SimformSolutionsPvtLtd/flutter_calendar_view/pull/299) diff --git a/lib/src/month_view/month_view.dart b/lib/src/month_view/month_view.dart index f0a0b65d..2b1f148e 100644 --- a/lib/src/month_view/month_view.dart +++ b/lib/src/month_view/month_view.dart @@ -147,6 +147,11 @@ class MonthView extends StatefulWidget { /// Default value is [ClampingScrollPhysics]. final ScrollPhysics pagePhysics; + /// Defines scroll physics for a page of a month view. + /// + /// This can be used to disable the horizontal scroll of a page. + final ScrollPhysics? pageViewPhysics; + /// Main [Widget] to display month view. const MonthView({ Key? key, @@ -177,6 +182,7 @@ class MonthView extends StatefulWidget { this.safeAreaOption = const SafeAreaOption(), this.onHeaderTitleTap, this.pagePhysics = const ClampingScrollPhysics(), + this.pageViewPhysics, }) : assert(!(onHeaderTitleTap != null && headerBuilder != null), "can't use [onHeaderTitleTap] & [headerBuilder] simultaneously"), super(key: key); @@ -306,6 +312,7 @@ class MonthViewState extends State> { Expanded( child: PageView.builder( controller: _pageController, + physics: widget.pageViewPhysics, onPageChanged: _onPageChange, itemBuilder: (_, index) { final date = DateTime(_minDate.year, _minDate.month + index); diff --git a/lib/src/week_view/week_view.dart b/lib/src/week_view/week_view.dart index b9aa7e94..6e94bc8f 100644 --- a/lib/src/week_view/week_view.dart +++ b/lib/src/week_view/week_view.dart @@ -217,6 +217,11 @@ class WeekView extends StatefulWidget { /// If true this will show week day at bottom position. final bool showWeekDayAtBottom; + /// Defines scroll physics for a page of a week view. + /// + /// This can be used to disable the horizontal scroll of a page. + final ScrollPhysics? pageViewPhysics; + /// Main widget for week view. const WeekView({ Key? key, @@ -268,6 +273,7 @@ class WeekView extends StatefulWidget { this.showQuarterHours = false, this.emulateVerticalOffsetBy = 0, this.showWeekDayAtBottom = false, + this.pageViewPhysics, }) : assert(!(onHeaderTitleTap != null && weekPageHeaderBuilder != null), "can't use [onHeaderTitleTap] & [weekPageHeaderBuilder] simultaneously"), assert((timeLineOffset) >= 0, @@ -450,6 +456,7 @@ class WeekViewState extends State> { child: PageView.builder( itemCount: _totalWeeks, controller: _pageController, + physics: widget.pageViewPhysics, onPageChanged: _onPageChange, itemBuilder: (_, index) { final dates = DateTime(_minDate.year, _minDate.month,