Skip to content

Commit

Permalink
Merge pull request #441 from SimformSolutionsPvtLtd/fix/analytics_issue
Browse files Browse the repository at this point in the history
fix: 🔨 Fixes analytics issue
  • Loading branch information
PRBaraiya authored Jan 2, 2025
2 parents c6cfe4a + 269dd05 commit 836953e
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 14 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
- Events are now hidden for days not in the current month when hideDaysNotInMonth = true
- Fixes right icon always shows default icon in `CalendarPageHeader` when providing custom icon. [#432](https://github.com/SimformSolutionsPvtLtd/flutter_calendar_view/issues/432)
- Adds `hideDaysNotInMonth` argument in `cellBuilder` in readme. [#433](https://github.com/SimformSolutionsPvtLtd/flutter_calendar_view/issues/433)
- Fixes `titleColor` of date for `hideDaysNotInMonth: false`.

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

Expand Down
10 changes: 6 additions & 4 deletions example/lib/extension.dart
Original file line number Diff line number Diff line change
Expand Up @@ -113,10 +113,12 @@ extension DateUtils on DateTime {
}

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

extension StringExt on String {
Expand Down
1 change: 0 additions & 1 deletion example/lib/widgets/month_view_widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ class MonthViewWidget extends StatelessWidget {
showWeekends: false,
startDay: WeekDays.friday,
useAvailableVerticalSpace: true,
hideDaysNotInMonth: true,
onEventTap: (event, date) {
Navigator.of(context).push(
MaterialPageRoute(
Expand Down
6 changes: 1 addition & 5 deletions lib/src/components/month_view_components.dart
Original file line number Diff line number Diff line change
Expand Up @@ -142,11 +142,7 @@ class FilledCell<T extends Object?> extends StatelessWidget {
child: Text(
dateStringBuilder?.call(date) ?? "${date.day}",
style: TextStyle(
color: shouldHighlight
? highlightedTitleColor
: isInMonth
? titleColor
: titleColor.withOpacity(0.4),
color: shouldHighlight ? highlightedTitleColor : titleColor,
fontSize: 12,
),
),
Expand Down
12 changes: 8 additions & 4 deletions lib/src/extensions.dart
Original file line number Diff line number Diff line change
Expand Up @@ -163,10 +163,14 @@ extension DateTimeExtensions on DateTime {
}

extension ColorExtension on Color {
Color get accent =>
(blue / 2 >= 255 / 2 || red / 2 >= 255 / 2 || green / 2 >= 255 / 2)
? Colors.black
: Colors.white;
/// TODO(Shubham): Update this getter as it uses `computeLuminance()`
/// which is computationally expensive
Color get accent {
final brightness = ThemeData.estimateBrightnessForColor(this);
return brightness == Brightness.light
? Color(0xff626262)
: Color(0xfff0f0f0);
}
}

extension MaterialColorExtension on MaterialColor {
Expand Down
3 changes: 3 additions & 0 deletions lib/src/month_view/month_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -584,6 +584,9 @@ class MonthViewState<T extends Object?> extends State<MonthView<T>> {
dateStringBuilder: widget.dateStringBuilder,
onTileDoubleTap: widget.onEventDoubleTap,
hideDaysNotInMonth: hideDaysNotInMonth,
titleColor: isInMonth
? Theme.of(context).colorScheme.onPrimaryContainer
: Theme.of(context).colorScheme.onSurfaceVariant.withAlpha(150),
);
}

Expand Down

0 comments on commit 836953e

Please sign in to comment.