@@ -319,12 +319,45 @@ extension NullableCallback3<A, B, C> on void Function(A, B, C)? {
319319}
320320
321321extension BuildContextExtension on BuildContext {
322- MonthViewTheme get monthViewColors =>
323- Theme .of (this ).extension < MonthViewTheme > () ?? MonthViewTheme .light ();
322+ /// Get [MonthViewThemeData] from theme, if null returns light theme.
323+ /// [MonthViewThemeData] needs to be added in [MaterialApp] theme extensions
324+ /// to get theme data with this type.
325+ MonthViewThemeData get monthViewColors =>
326+ Theme .of (this ).extension < MonthViewThemeData > () ??
327+ MonthViewThemeData .light ();
328+
329+ /// Get [DayViewThemeData] from theme, if null returns light theme.
330+ /// [DayViewThemeData] needs to be added in [MaterialApp] theme extensions
331+ /// to get theme data with this type.
332+ DayViewThemeData get dayViewColors =>
333+ Theme .of (this ).extension < DayViewThemeData > () ?? DayViewThemeData .light ();
334+
335+ /// Get [WeekViewThemeData] from theme, if null returns light theme.
336+ /// [WeekViewThemeData] needs to be added in [MaterialApp] theme extensions
337+ /// to get theme data with this type.
338+ WeekViewThemeData get weekViewColors =>
339+ Theme .of (this ).extension < WeekViewThemeData > () ??
340+ WeekViewThemeData .light ();
341+
342+ /// Get [MultiDayViewThemeData] from theme, if null returns light theme.
343+ /// [MultiDayViewThemeData] needs to be added in [MaterialApp] theme extensions
344+ /// to get theme data with this type.
345+ MultiDayViewThemeData get multiDayViewColors =>
346+ Theme .of (this ).extension < MultiDayViewThemeData > () ??
347+ MultiDayViewThemeData .light ();
348+ }
324349
325- DayViewTheme get dayViewColors =>
326- Theme .of (this ).extension < DayViewTheme > () ?? DayViewTheme .light ();
350+ extension BuildContextMultiDayViewThemeExtension on BuildContext {
351+ /// Get MultiDayViewTheme from Theme
352+ MultiDayViewThemeData get multiDayViewTheme {
353+ final theme = Theme .of (this ).extension < MultiDayViewThemeData > ();
354+ if (theme != null ) {
355+ return theme;
356+ }
327357
328- WeekViewTheme get weekViewColors =>
329- Theme .of (this ).extension < WeekViewTheme > () ?? WeekViewTheme .light ();
358+ // If no theme extension is available, return based on brightness
359+ return Theme .of (this ).brightness == Brightness .dark
360+ ? MultiDayViewThemeData .dark ()
361+ : MultiDayViewThemeData .light ();
362+ }
330363}
0 commit comments