Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Fixes issue #417: 🐛 Fixes calendar scroll physics for day & week view #418

Merged
merged 1 commit into from
Nov 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
- Added `mainAxisSize`, `mainAxisAlignment`, `rightIconConfig` and `leftIconConfig`.
- Adds additional configurations for `CalendarPageHeader`, `MonthPageHeader`, `DayPageHeader` and `WeekPageHeader`.
- Added `titleBuilder` to build custom title for header.
- Fixes issue calendar scroll physics for day & week view. [#417](https://github.com/SimformSolutionsPvtLtd/flutter_calendar_view/issues/417)
- `Deprecations`:
- deprecated `backgroundColor` and `iconColor` from `CalendarPageHeader`, `DayPageHeader`, `MonthPageHeader` and `WeekPageHeader`.
- **Solution:** use `headerStyle` instead.
Expand Down
1 change: 1 addition & 0 deletions example/lib/widgets/day_view_widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ class DayViewWidget extends StatelessWidget {
showHalfHours: true,
heightPerMinute: 3,
timeLineBuilder: _timeLineBuilder,
scrollPhysics: const BouncingScrollPhysics(),
hourIndicatorSettings: HourIndicatorSettings(
color: Theme.of(context).dividerColor,
),
Expand Down
1 change: 1 addition & 0 deletions example/lib/widgets/week_view_widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ class WeekViewWidget extends StatelessWidget {
width: width,
showLiveTimeLineInAllDays: true,
timeLineWidth: 65,
scrollPhysics: const BouncingScrollPhysics(),
liveTimeIndicatorSettings: LiveTimeIndicatorSettings(
color: Colors.redAccent,
showTime: true,
Expand Down
5 changes: 5 additions & 0 deletions lib/src/day_view/_internal_day_view_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,9 @@ class InternalDayViewPage<T extends Object?> extends StatefulWidget {
/// Flag to keep scrollOffset of pages on page change
final bool keepScrollOffset;

/// Use this field to disable the calendar scrolling
final ScrollPhysics? scrollPhysics;

/// Defines a single day page.
const InternalDayViewPage({
Key? key,
Expand Down Expand Up @@ -161,6 +164,7 @@ class InternalDayViewPage<T extends Object?> extends StatefulWidget {
required this.scrollNotifier,
required this.fullDayEventBuilder,
required this.dayViewScrollController,
required this.scrollPhysics,
required this.scrollListener,
this.lastScrollOffset = 0.0,
required this.dayDetectorBuilder,
Expand Down Expand Up @@ -223,6 +227,7 @@ class _InternalDayViewPageState<T extends Object?>
controller: widget.keepScrollOffset
? scrollController
: widget.dayViewScrollController,
physics: widget.scrollPhysics,
child: SizedBox(
height: widget.height,
width: widget.width,
Expand Down
1 change: 1 addition & 0 deletions lib/src/day_view/day_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -497,6 +497,7 @@ class DayViewState<T extends Object?> extends State<DayView<T>> {
widget.emulateVerticalOffsetBy,
lastScrollOffset: _lastScrollOffset,
dayViewScrollController: _scrollController,
scrollPhysics: widget.scrollPhysics,
scrollListener: _scrollPageListener,
keepScrollOffset: widget.keepScrollOffset,
),
Expand Down
5 changes: 5 additions & 0 deletions lib/src/week_view/_internal_week_view_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,9 @@ class InternalWeekViewPage<T extends Object?> extends StatefulWidget {
/// Flag to keep scrollOffset of pages on page change
final bool keepScrollOffset;

/// Use this field to disable the calendar scrolling
final ScrollPhysics? scrollPhysics;

/// A single page for week view.
const InternalWeekViewPage({
Key? key,
Expand Down Expand Up @@ -204,6 +207,7 @@ class InternalWeekViewPage<T extends Object?> extends StatefulWidget {
required this.endHour,
this.fullDayHeaderTitle = '',
required this.fullDayHeaderTextConfig,
required this.scrollPhysics,
required this.scrollListener,
required this.weekViewScrollController,
this.lastScrollOffset = 0.0,
Expand Down Expand Up @@ -339,6 +343,7 @@ class _InternalWeekViewPageState<T extends Object?>
controller: widget.keepScrollOffset
? scrollController
: widget.weekViewScrollController,
physics: widget.scrollPhysics,
child: SizedBox(
height: widget.height,
width: widget.width,
Expand Down
5 changes: 5 additions & 0 deletions lib/src/week_view/week_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,9 @@ class WeekView<T extends Object?> extends StatefulWidget {
/// If true this will show week day at bottom position.
final bool showWeekDayAtBottom;

/// Use this field to disable the calendar scrolling
final ScrollPhysics? scrollPhysics;

/// Defines scroll physics for a page of a week view.
///
/// This can be used to disable the horizontal scroll of a page.
Expand Down Expand Up @@ -273,6 +276,7 @@ class WeekView<T extends Object?> extends StatefulWidget {
this.weekDayBuilder,
this.weekNumberBuilder,
this.backgroundColor = Colors.white,
this.scrollPhysics,
this.scrollOffset = 0.0,
this.onEventTap,
this.onEventLongTap,
Expand Down Expand Up @@ -561,6 +565,7 @@ class WeekViewState<T extends Object?> extends State<WeekView<T>> {
fullDayHeaderTitle: _fullDayHeaderTitle,
fullDayHeaderTextConfig: _fullDayHeaderTextConfig,
lastScrollOffset: _lastScrollOffset,
scrollPhysics: widget.scrollPhysics,
scrollListener: _scrollPageListener,
keepScrollOffset: widget.keepScrollOffset,
),
Expand Down
Loading