diff --git a/lib/src/day_view/day_view.dart b/lib/src/day_view/day_view.dart index 98006562..82f7641b 100644 --- a/lib/src/day_view/day_view.dart +++ b/lib/src/day_view/day_view.dart @@ -414,6 +414,9 @@ class DayViewState extends State> { child: LayoutBuilder(builder: (context, constraint) { _width = widget.width ?? constraint.maxWidth; _updateViewDimensions(); + if (widget.showLiveTimeLineInAllDays) { + animateToLiveTimeLineIndicator(); + } return SizedBox( width: _width, child: Column( @@ -554,6 +557,23 @@ class DayViewState extends State> { "quarterHourIndicator height must be less than minuteHeight * 60"); } + void animateToLiveTimeLineIndicator() { + final offSetForSingleMinute = _height / 24 / 60; + final currentTime = TimeOfDay.now(); + final currentDuration = + Duration(hours: currentTime.hour, minutes: currentTime.minute) + .inMinutes; + var offset = offSetForSingleMinute * + (currentDuration > 3600 ? 3600 : currentDuration); + Future.delayed(Duration(milliseconds: 500), () { + animateTo( + offset.toDouble() - (MediaQuery.of(context).size.height / 2), + duration: Duration(milliseconds: 600), + curve: Curves.easeInOut, + ); + }); + } + void _calculateHeights() { _hourHeight = widget.heightPerMinute * 60; _height = _hourHeight * (Constants.hoursADay - _startHour); @@ -887,6 +907,7 @@ class DayViewState extends State> { // above 24 hrs then we take it max as 24 hours only final offset = offSetForSingleMinute * (startDurationInMinutes > 3600 ? 3600 : startDurationInMinutes); + animateTo( offset.toDouble(), duration: duration,