Skip to content

Commit

Permalink
Merge pull request #173 from SimformSolutionsPvtLtd/feat/calendar_eve…
Browse files Browse the repository at this point in the history
…nt_data_text_color

feat: ✨ Added text style and description style in CalendarEventData #147
  • Loading branch information
ShwetaChauhan18 authored Feb 16, 2023
2 parents 75edbd3 + 9d7ee22 commit 5cf5985
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 9 deletions.
1 change: 0 additions & 1 deletion analysis_options.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ linter:
empty_statements: true
empty_constructor_bodies: true
hash_and_equals: true
invariant_booleans: true
iterable_contains_unrelated_type: true
list_remove_unrelated_type: true
literal_only_boolean_expressions: true
Expand Down
10 changes: 10 additions & 0 deletions lib/src/calendar_event_data.dart
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,12 @@ class CalendarEventData<T extends Object?> {

final DateTime? _endDate;

/// Define style of title.
final TextStyle? titleStyle;

/// Define style of description.
final TextStyle? descriptionStyle;

/// Stores all the events on [date]
const CalendarEventData({
required this.title,
Expand All @@ -45,6 +51,8 @@ class CalendarEventData<T extends Object?> {
this.color = Colors.blue,
this.startTime,
this.endTime,
this.titleStyle,
this.descriptionStyle,
DateTime? endDate,
required this.date,
}) : _endDate = endDate;
Expand Down Expand Up @@ -81,6 +89,8 @@ class CalendarEventData<T extends Object?> {
endTime!.hasSameTimeAs(other.endTime!))) &&
title == other.title &&
color == other.color &&
titleStyle == other.titleStyle &&
descriptionStyle == other.descriptionStyle &&
description == other.description;
}

Expand Down
9 changes: 5 additions & 4 deletions lib/src/components/month_view_components.dart
Original file line number Diff line number Diff line change
Expand Up @@ -172,10 +172,11 @@ class FilledCell<T extends Object?> extends StatelessWidget {
events[index].title,
overflow: TextOverflow.clip,
maxLines: 1,
style: TextStyle(
color: events[index].color.accent,
fontSize: 12,
),
style: events[0].titleStyle ??
TextStyle(
color: events[index].color.accent,
fontSize: 12,
),
),
),
],
Expand Down
2 changes: 2 additions & 0 deletions lib/src/day_view/day_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -590,6 +590,8 @@ class DayViewState<T extends Object?> extends State<DayView<T>> {
padding: EdgeInsets.all(10.0),
backgroundColor: events[0].color,
margin: EdgeInsets.all(2.0),
titleStyle: events[0].titleStyle,
descriptionStyle: events[0].descriptionStyle,
);
else
return SizedBox.shrink();
Expand Down
10 changes: 6 additions & 4 deletions lib/src/week_view/week_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -694,10 +694,12 @@ class WeekViewState<T extends Object?> extends State<WeekView<T>> {
return RoundedEventTile(
borderRadius: BorderRadius.circular(6.0),
title: events[0].title,
titleStyle: TextStyle(
fontSize: 12,
color: events[0].color.accent,
),
titleStyle: events[0].titleStyle ??
TextStyle(
fontSize: 12,
color: events[0].color.accent,
),
descriptionStyle: events[0].descriptionStyle,
totalEvents: events.length,
padding: EdgeInsets.all(7.0),
backgroundColor: events[0].color,
Expand Down

0 comments on commit 5cf5985

Please sign in to comment.