Skip to content

Commit 836953e

Browse files
authored
Merge pull request #441 from SimformSolutionsPvtLtd/fix/analytics_issue
fix: 🔨 Fixes analytics issue
2 parents c6cfe4a + 269dd05 commit 836953e

File tree

6 files changed

+19
-14
lines changed

6 files changed

+19
-14
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
- Events are now hidden for days not in the current month when hideDaysNotInMonth = true
55
- Fixes right icon always shows default icon in `CalendarPageHeader` when providing custom icon. [#432](https://github.com/SimformSolutionsPvtLtd/flutter_calendar_view/issues/432)
66
- Adds `hideDaysNotInMonth` argument in `cellBuilder` in readme. [#433](https://github.com/SimformSolutionsPvtLtd/flutter_calendar_view/issues/433)
7+
- Fixes `titleColor` of date for `hideDaysNotInMonth: false`.
78

89
# [1.3.0 - 12 Nov 2024](https://github.com/SimformSolutionsPvtLtd/flutter_calendar_view/tree/1.3.0)
910

example/lib/extension.dart

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -113,10 +113,12 @@ extension DateUtils on DateTime {
113113
}
114114

115115
extension ColorExtension on Color {
116-
Color get accentColor =>
117-
(blue / 2 >= 255 / 2 || red / 2 >= 255 / 2 || green / 2 >= 255 / 2)
118-
? AppColors.black
119-
: AppColors.white;
116+
/// TODO(Shubham): Update this getter as it uses `computeLuminance()`
117+
/// which is computationally expensive
118+
Color get accentColor {
119+
final brightness = ThemeData.estimateBrightnessForColor(this);
120+
return brightness == Brightness.light ? AppColors.black : AppColors.white;
121+
}
120122
}
121123

122124
extension StringExt on String {

example/lib/widgets/month_view_widget.dart

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ class MonthViewWidget extends StatelessWidget {
2121
showWeekends: false,
2222
startDay: WeekDays.friday,
2323
useAvailableVerticalSpace: true,
24-
hideDaysNotInMonth: true,
2524
onEventTap: (event, date) {
2625
Navigator.of(context).push(
2726
MaterialPageRoute(

lib/src/components/month_view_components.dart

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -142,11 +142,7 @@ class FilledCell<T extends Object?> extends StatelessWidget {
142142
child: Text(
143143
dateStringBuilder?.call(date) ?? "${date.day}",
144144
style: TextStyle(
145-
color: shouldHighlight
146-
? highlightedTitleColor
147-
: isInMonth
148-
? titleColor
149-
: titleColor.withOpacity(0.4),
145+
color: shouldHighlight ? highlightedTitleColor : titleColor,
150146
fontSize: 12,
151147
),
152148
),

lib/src/extensions.dart

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -163,10 +163,14 @@ extension DateTimeExtensions on DateTime {
163163
}
164164

165165
extension ColorExtension on Color {
166-
Color get accent =>
167-
(blue / 2 >= 255 / 2 || red / 2 >= 255 / 2 || green / 2 >= 255 / 2)
168-
? Colors.black
169-
: Colors.white;
166+
/// TODO(Shubham): Update this getter as it uses `computeLuminance()`
167+
/// which is computationally expensive
168+
Color get accent {
169+
final brightness = ThemeData.estimateBrightnessForColor(this);
170+
return brightness == Brightness.light
171+
? Color(0xff626262)
172+
: Color(0xfff0f0f0);
173+
}
170174
}
171175

172176
extension MaterialColorExtension on MaterialColor {

lib/src/month_view/month_view.dart

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -584,6 +584,9 @@ class MonthViewState<T extends Object?> extends State<MonthView<T>> {
584584
dateStringBuilder: widget.dateStringBuilder,
585585
onTileDoubleTap: widget.onEventDoubleTap,
586586
hideDaysNotInMonth: hideDaysNotInMonth,
587+
titleColor: isInMonth
588+
? Theme.of(context).colorScheme.onPrimaryContainer
589+
: Theme.of(context).colorScheme.onSurfaceVariant.withAlpha(150),
587590
);
588591
}
589592

0 commit comments

Comments
 (0)