Skip to content

✨ Fixes issue #331: Add auto-scroll to current time for Day, Week, and Multi-Day views#550

Open
lavigarg-simform wants to merge 1 commit into
fix/scroll_exception_issuefrom
feature/add-auto-scroll-to-current-time
Open

✨ Fixes issue #331: Add auto-scroll to current time for Day, Week, and Multi-Day views#550
lavigarg-simform wants to merge 1 commit into
fix/scroll_exception_issuefrom
feature/add-auto-scroll-to-current-time

Conversation

@lavigarg-simform

@lavigarg-simform lavigarg-simform commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

Description

This PR implements auto-scroll functionality for the Day, Week, and Multi-Day views to automatically scroll to the current time when the calendar is loaded or when the view is updated. This addresses the long-standing enhancement request from issue #331, where users requested the ability to have the widget automatically scroll and center the present time on the screen.

Changes Made

  • Added auto-scroll logic to Day, Week, and Multi-Day calendar views
  • Implements automatic scroll positioning to center the current time on screen
  • Updates applied across 10 files with 570 additions and 12 deletions

Existing Behavior

Previously, users had to manually scroll to find the current time on the calendar, which was inconvenient for quickly viewing what's happening at the present moment.

New Behavior

The calendar now automatically scrolls to and highlights the current time, providing a better user experience by immediately showing the present time context when the view loads.

Checklist

  • The title of my PR starts with a Conventional Commit prefix ( for features)
  • I have followed the Contributor Guide when preparing my PR
  • I have updated/added tests for ALL new/updated/fixed functionality
  • I have updated/added relevant documentation in docs and added dartdoc comments with ///
  • I have updated/added relevant examples in examples or docs

Breaking Change?

  • Yes, this PR is a breaking change
  • No, this PR is not a breaking change

Related Issues

Closes #331

@lavigarg-simform lavigarg-simform force-pushed the feature/add-auto-scroll-to-current-time branch from 5cc0298 to 371730f Compare June 12, 2026 12:31
@kavantrivedi kavantrivedi requested a review from Copilot June 12, 2026 12:40

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds an opt-in “auto scroll to current time” capability for the timeline-based calendar views (DayView, WeekView, MultiDayView), including new imperative APIs on the corresponding *ViewState classes and tests/docs/examples to demonstrate the behavior.

Changes:

  • Introduces scrollToCurrentTime (default false) on Day/Week/MultiDay views to auto-center the current time after initial layout.
  • Adds ScrollToCurrentTimeMixin to share the time-to-offset math plus jumpToCurrentTime() / animateToCurrentTime() state APIs.
  • Adds widget tests and updates examples, documentation, and changelog to cover the new feature.

Reviewed changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
test/scroll_to_current_time_test.dart Adds widget tests for initial auto-centering and the new imperative APIs.
lib/src/scroll_to_current_time_mixin.dart New shared mixin implementing current-time offset computation and scrolling helpers.
lib/src/day_view/day_view.dart Adds scrollToCurrentTime flag and mixes in shared scroll-to-now functionality for DayView.
lib/src/week_view/week_view.dart Adds scrollToCurrentTime flag and mixes in shared scroll-to-now functionality for WeekView.
lib/src/multi_day_view/multi_day_view.dart Adds scrollToCurrentTime flag and mixes in shared scroll-to-now functionality for MultiDayView.
example/lib/widgets/day_view_widget.dart Enables scrollToCurrentTime in the DayView example.
example/lib/widgets/week_view_widget.dart Enables scrollToCurrentTime in the WeekView example.
example/lib/widgets/multi_day_view_widget.dart Enables scrollToCurrentTime in the MultiDayView example.
doc/documentation.md Documents the new scrollToCurrentTime parameter in usage snippets.
CHANGELOG.md Notes the new parameter and state APIs in the changelog.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread lib/src/scroll_to_current_time_mixin.dart
Comment thread example/lib/widgets/day_view_widget.dart
Comment thread test/scroll_to_current_time_test.dart Outdated
@lavigarg-simform lavigarg-simform force-pushed the feature/add-auto-scroll-to-current-time branch from 371730f to 8d6576b Compare June 15, 2026 08:18
@lavigarg-simform lavigarg-simform marked this pull request as ready for review June 15, 2026 08:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants