animateToDuration method
Animate to specific offset in a day view using the start duration
Implementation
Future<void> animateToDuration(
Duration startDuration, {
Duration duration = const Duration(milliseconds: 200),
Curve curve = Curves.linear,
}) async {
final offSetForSingleMinute = _height / 24 / 60;
final startDurationInMinutes = startDuration.inMinutes;
// Added ternary condition below to take care if user passing duration
// above 24 hrs then we take it max as 24 hours only
final offset = offSetForSingleMinute *
(startDurationInMinutes > 3600 ? 3600 : startDurationInMinutes);
animateTo(
offset.toDouble(),
duration: duration,
curve: curve,
);
}