as_calendar 1.2.2

SDKflutter
Platformandroidioswindowslinuxmacosweb

Awesome calendar with customizations, range picking and event showing.

Here's the updated version of the README, reflecting the changes and structure according to your package:

# CrCalendar

A highly customizable Flutter calendar widget inspired by Google Calendar, supporting advanced features like date selection dialogs and customizable month views.

### Features:
- **Horizontal Scrollable Month View**: CrCalendar displays months horizontally with event lines over the days.
- **Date Selection Dialog**: Uses CrCalendar in range selection mode with full customization of buttons, texts, and the look of the CrCalendar widget.
- **Customizable Event Widgets**: Tailor how events are displayed over each day.

### Screenshots from the [example app](https://github.com/Cleveroad/cr_calendar/tree/main/example):
<img src="https://raw.githubusercontent.com/Cleveroad/cr_calendar/main/screenshots/screenshot-1.png" height="500">  <img src="https://raw.githubusercontent.com/Cleveroad/cr_calendar/main/screenshots/screenshot-2.png" height="500">  <img src="https://raw.githubusercontent.com/Cleveroad/cr_calendar/main/screenshots/screenshot-3.png" height="500">

<img src="https://raw.githubusercontent.com/Cleveroad/cr_calendar/main/screenshots/screenshot-4.png" height="500">  <img src="https://raw.githubusercontent.com/Cleveroad/cr_calendar/main/screenshots/screenshot-5.png" height="500">  <img src="https://raw.githubusercontent.com/Cleveroad/cr_calendar/main/screenshots/screenshot-6.png" height="500">

<img src="https://raw.githubusercontent.com/Cleveroad/cr_calendar/main/screenshots/screenshot-7.png" height="322">

---

### Installation
Add `cr_calendar` as a dependency in your `pubspec.yaml`.

```yaml
dependencies:
  cr_calendar: latest_version

Then import the package:

import 'package:cr_calendar/cr_calendar.dart';

CrCalendar Parameters

TypeNameDescriptionDefault Value
CrCalendarControllercontrollerThe calendar's controller-
DateTimeinitialDateInitial date to be displayed when the calendar is created-
OnTapCallbackonDayClickedCallback for tapping a day in singleTap touch mode-
WeekDaysfirstDayOfWeekDefines which day the week starts fromWeekDays.sunday
WeekDaysBuilderweekDaysBuilderCustom builder for the week days row at the top of the calendar-
DayItemBuilderdayItemBuilderCustom builder for day cells-
boolforceSixWeekForce the calendar to always display six rowsfalse
ColorbackgroundColorBackground color of the calendar-
intmaxEventLinesMaximum number of events to show on a day4
EventBuildereventBuilderCustom builder for event widgets-
TouchModetouchModeDefines the touch mode of the calendar (e.g., singleTap, range selection)-
doubleeventsTopPaddingPadding for event widgets-
OnRangeSelectedCallbackonRangeSelectedCallback for receiving the selected range in date picker mode-
intonSwipeCallbackDebounceMsDebounce time for swipe callback (in ms)-
DateTimeminDateEarliest allowable date-
DateTimemaxDateLatest allowable date-

Basic Usage

class MyApp extends StatefulWidget {
  @override
  _MyAppState createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  final CrCalendarController _controller = CrCalendarController();

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        body: CrCalendar(
          initialDate: DateTime.now(),
          controller: _controller,
        ),
      ),
    );
  }
}

Note: Avoid frequent setState calls on the page where the CrCalendar widget is used to maintain performance.


CrCalendar Date Picker Dialog

The CrCalendar date picker dialog allows users to select a date range for events with customizable options.

DatePickerProperties Parameters

TypeNameDescriptionDefault Value
ColorbackgroundColorBackground color for the date picker and year selectionColors.white
DateTimeinitialPickerDateInitial date shown when the dialog opens-
EdgeInsetspaddingPadding for the picker dialogEdgeInsets.all(8)
DayItemBuilderdayItemBuilderBuilder for individual day items-
TouchModepickerModeMode for date selection (e.g., singleTap, range selection)-
WeekDaysBuilderweekDaysBuilderBuilder for the week days row-
DateTitleBuilderpickerTitleBuilderTitle builder for the picker widget-
AlignmentpickerTitleAlignInLandscapeAlignment of the picker title in landscape modeAlignment.centerLeft
WidgetbackButtonBack button for the control bar-
WidgetforwardButtonForward button for the control bar-
DateTitleBuildercontrolBarTitleBuilderTitle for the control bar between back and forward buttons-
boolshowControlBarWhether to show the control bartrue
YearPickerItemBuilderyearPickerItemBuilderCustom builder for year selection items-
PickerButtonBuilderokButtonBuilderBuilder for the confirm selection button-
PickerButtonBuildercancelButtonBuilderBuilder for the cancel button-
boolforceSixWeekForces six weeks to be displayed in month viewfalse
WeekDaysfirstWeekDayFirst day of the week for the date picker calendarWeekDays.sunday
DateTimeminDateEarliest selectable date-
DateTimemaxDateLatest selectable date-
LandscapeDaysResizeModelandscapeDaysResizeModeMode for resizing day cells in landscape (adaptive or scrollable)LandscapeDaysResizeMode.adaptive

Example Usage

void _showDatePicker(BuildContext context) {
  showCrDatePicker(
    context,
    properties: DatePickerProperties(
      firstWeekDay: WeekDays.monday,
      okButtonBuilder: (onPress) =>
          ElevatedButton(child: const Text('OK'), onPressed: onPress),
      cancelButtonBuilder: (onPress) =>
          OutlinedButton(child: const Text('CANCEL'), onPressed: onPress),
      initialPickerDate: DateTime.now(),
    ),
  );
}

For more information, visit the documentation.


This version aligns with your package updates and provides a clearer structure and descriptions for the features and usage examples.