Skip to content

Commit 0cc89e4

Browse files
kavantrivediPRBaraiya
authored andcommitted
docs: improve documentation comments for clarity and consistency across calendar components
1 parent 4761d42 commit 0cc89e4

12 files changed

Lines changed: 34 additions & 21 deletions

lib/calendar_view.dart

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22
// Use of this source code is governed by a MIT-style license
33
// that can be found in the LICENSE file.
44

5+
/// Calendar widgets, models, themes, and utilities for building day, week,
6+
/// multi-day, and month calendar UIs in Flutter.
7+
///
8+
/// Import this library to access the public API of the package.
59
library calendar_view;
610

711
export './src/calendar_constants.dart';

lib/src/calendar_event_data.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import '../calendar_view.dart';
88

99
@immutable
1010

11-
/// {@macro calendar_event_data_doc}
11+
/// Stores metadata for a calendar event and its date/time boundaries.
1212
class CalendarEventData<T extends Object?> {
1313
/// Specifies date on which all these events are.
1414
final DateTime date;
@@ -47,7 +47,7 @@ class CalendarEventData<T extends Object?> {
4747
/// Define reoccurrence settings
4848
final RecurrenceSettings? recurrenceSettings;
4949

50-
/// {@macro calendar_event_data_doc}
50+
/// Creates an event model used by day, week, multi-day, and month views.
5151
CalendarEventData({
5252
required this.title,
5353
required DateTime date,

lib/src/day_view/day_view.dart

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1012,7 +1012,8 @@ class DayViewState<T extends Object?> extends State<DayView<T>> {
10121012

10131013
/// Animate to next page (next day).
10141014
///
1015-
/// Transitions with animation using [pageTransitionDuration] and [pageTransitionCurve].
1015+
/// Transitions with animation using [DayView.pageTransitionDuration] and
1016+
/// [DayView.pageTransitionCurve].
10161017
///
10171018
/// See also: [previousPage], [jumpToDate], [animateToDate]
10181019
void nextPage({Duration? duration, Curve? curve}) => _pageController.nextPage(
@@ -1022,7 +1023,8 @@ class DayViewState<T extends Object?> extends State<DayView<T>> {
10221023

10231024
/// Animate to previous page (previous day).
10241025
///
1025-
/// Transitions with animation using [pageTransitionDuration] and [pageTransitionCurve].
1026+
/// Transitions with animation using [DayView.pageTransitionDuration] and
1027+
/// [DayView.pageTransitionCurve].
10261028
///
10271029
/// See also: [nextPage], [jumpToDate], [animateToDate]
10281030
void previousPage({Duration? duration, Curve? curve}) =>
@@ -1056,20 +1058,21 @@ class DayViewState<T extends Object?> extends State<DayView<T>> {
10561058
duration: duration ?? widget.pageTransitionDuration,
10571059
curve: curve ?? widget.pageTransitionCurve);
10581060

1059-
/// Returns current page index (number of days since [minDay]).
1061+
/// Returns current page index (number of days since [DayView.minDay]).
10601062
int get currentPage => _currentIndex;
10611063

10621064
/// Jumps to page which gives day calendar for [date]
10631065
///
10641066
/// This is the preferred way to navigate to a specific date. It automatically
1065-
/// calculates the correct page index based on the [minDay] parameter.
1067+
/// calculates the correct page index based on [DayView.minDay].
10661068
///
10671069
/// **Example:**
10681070
/// ```dart
10691071
/// dayViewState.jumpToDate(DateTime(2024, 5, 15));
10701072
/// ```
10711073
///
1072-
/// **Note:** The [date] must be within the range [minDay] to [maxDay],
1074+
/// **Note:** The [date] must be within the range [DayView.minDay] to
1075+
/// [DayView.maxDay],
10731076
/// otherwise an exception will be thrown.
10741077
///
10751078
/// Throws an exception if [date] is outside the valid date range.
@@ -1082,10 +1085,12 @@ class DayViewState<T extends Object?> extends State<DayView<T>> {
10821085

10831086
/// Animate to page which gives day calendar for [date].
10841087
///
1085-
/// Calculates the correct page index based on [minDay] and animates to it.
1088+
/// Calculates the correct page index based on [DayView.minDay] and animates
1089+
/// to it.
10861090
/// Arguments [duration] and [curve] override default transition values.
10871091
///
1088-
/// Throws an exception if [date] is outside the [minDay] to [maxDay] range.
1092+
/// Throws an exception if [date] is outside the [DayView.minDay] to
1093+
/// [DayView.maxDay] range.
10891094
Future<void> animateToDate(DateTime date,
10901095
{Duration? duration, Curve? curve}) async {
10911096
if (date.isBefore(_minDate) || date.isAfter(_maxDate)) {

lib/src/event_arrangers/event_arrangers.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ abstract class EventArranger<T extends Object?> {
2626
///
2727
/// There are three predefined class that implements of [EventArranger].
2828
///
29-
/// [_StackEventArranger], [SideEventArranger] and [MergeEventArranger].
29+
/// [SideEventArranger], and [MergeEventArranger].
3030
///
3131
const EventArranger();
3232

lib/src/event_controller.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ class EventController<T extends Object?> extends ChangeNotifier {
117117
notifyListeners();
118118
}
119119

120-
/// Adds a single event in [_events]
120+
/// Adds a single event to this controller.
121121
void add(CalendarEventData<T> event) {
122122
_calendarData.addEvent(event);
123123
notifyListeners();

lib/src/extensions.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ extension DateTimeExtensions on DateTime {
6969
///
7070
/// ex: if Current Date instance is 8th and day is wednesday then weekDates
7171
/// will return dates
72-
/// [6,7,8,9,10,11,12]
72+
/// 6, 7, 8, 9, 10, 11, 12.
7373
/// Where on 6th there will be monday and on 12th there will be Sunday
7474
List<DateTime> datesOfWeek({
7575
WeekDays start = WeekDays.monday,

lib/src/modals.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ class LiveTimeIndicatorSettings {
147147
///
148148
/// [startDate]: Defines start date of repeating events.
149149
/// [endDate]: Defines end date of repeating events.
150-
/// [occurrence]: Defines repetition of an event for the given number of
150+
/// [occurrences]: Defines repetition of an event for the given number of
151151
/// occurrences.
152152
///
153153
/// [frequency]: Defines mode of repetition like repeat daily, weekly, monthly

lib/src/month_view/month_view.dart

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -738,7 +738,8 @@ class MonthViewState<T extends Object?> extends State<MonthView<T>> {
738738
);
739739
}
740740

741-
/// Returns current page index (number of months since [minMonth]).
741+
/// Returns current page index (number of months since
742+
/// [MonthViewStyle.minMonth]).
742743
///
743744
/// Use [currentDate] to get the current month as a DateTime.
744745
///

lib/src/month_view/month_view_builders.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ class MonthViewBuilders<T extends Object?> {
7070

7171
/// This function will generate WeekDayString in weekday view.
7272
/// Useful for I18n
73-
/// Ex : ['Mon','Tue','Wed','Thu','Fri','Sat','Sun']
73+
/// Example: Mon, Tue, Wed, Thu, Fri, Sat, Sun.
7474
final String Function(int)? weekDayStringBuilder;
7575

7676
/// Called when user changes month.

lib/src/month_view/month_view_style.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,11 +71,11 @@ class MonthViewStyle {
7171
final Color? borderColor;
7272

7373
/// Page transition duration used when user try to change page using
74-
/// [MonthView.nextPage] or [MonthView.previousPage]
74+
/// [MonthViewState.nextPage] or [MonthViewState.previousPage].
7575
final Duration pageTransitionDuration;
7676

7777
/// Page transition curve used when user try to change page using
78-
/// [MonthView.nextPage] or [MonthView.previousPage]
78+
/// [MonthViewState.nextPage] or [MonthViewState.previousPage].
7979
final Curve pageTransitionCurve;
8080

8181
/// Defines width of default border

0 commit comments

Comments
 (0)