CalendarAnimations class

Opt-in animation configuration for MCalendar views.

Animations are disabled by default: pass a CalendarAnimations instance to MCalendar, MCalendar.monthly, MCalendar.weekly, or MCalendar.horizontal to enable them. Use CalendarAnimations.none to explicitly disable animation when a value is required.

All durations are automatically forced to Duration.zero when the platform requests reduced motion (MediaQueryData.disableAnimations), so the calendar remains accessible without extra work from the caller.

MCalendar(
  selectedMonth: DateTime.now(),
  animations: const CalendarAnimations(),
  onUserPicked: (dates) => print(dates),
)

Constructors

CalendarAnimations({Duration selectionDuration = const Duration(milliseconds: 180), Curve selectionCurve = Curves.easeOut, Duration monthTransitionDuration = const Duration(milliseconds: 250), Curve monthTransitionCurve = Curves.easeOutCubic, Duration sizeDuration = const Duration(milliseconds: 200)})
Creates an animation configuration.
const

Properties

hashCode int
The hash code for this object.
no setterinherited
monthTransitionCurve Curve
Curve applied to the month-change transition.
final
monthTransitionDuration Duration
Duration of the fade + slide transition played when the displayed month changes in the monthly and weekly grids.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
selectionCurve Curve
Curve applied to selection decoration transitions.
final
selectionDuration Duration
Duration of cell/selection decoration transitions (monthly, weekly, horizontal, and month-picker tiles).
final
sizeDuration Duration
Duration used when the grid animates between different row counts (for example a 5-row month followed by a 6-row month).
final

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Methods

monthTransitionOf(BuildContext context, CalendarAnimations? animations) Duration
Convenience accessor for the resolved month-transition duration.
resolve(BuildContext context, Duration? duration) Duration
Resolves duration to Duration.zero when it is null (animations are opted out) or when the platform requests reduced motion.
selectionOf(BuildContext context, CalendarAnimations? animations) Duration
Convenience accessor for the resolved selection duration of animations.
sizeOf(BuildContext context, CalendarAnimations? animations) Duration
Convenience accessor for the resolved grid resize duration.

Constants

none → const CalendarAnimations
A configuration that disables every animation (instant updates).