horizontal_calendar

Build Status codecov SoluteLabs Twitter Follow

Easy to use, highly customizable horizontal calendar.

Features

  • x Custom date range (First & Last Date)
  • x Single or up to x days selection
  • x onDateSelected, onDateUnSelected, onDateLongTap, onMaxDateSelectionReached events.
  • x Support custom ScrollController
  • x Initial selected dates
  • x Granular control to disable dates.
  • x Internationalization support
  • x Month / Date / Week Day label order customization
  • x Month / Week day label hide / show
  • x Custom TextStyles for Month, Date, WeekDay
  • x Custom TextStyles for selected Month, selected Date, selected WeekDay
  • x Customizable month format (e.g. MM,MMM)
  • x Customizable date format (e.g. dd,d)
  • x Customizable week day format (e.g. EE,EEE)
  • x Default date cell Decoration
  • x Selected date cell Decoration
  • x Disabled date cell Decoration

Properties

Property NameProperty TypeDescriptionDefault value
heightdoubleHeight of widget100
firstDateDateTimeFirst Date of calendar-
lastDateDateTimeLast Date of calendar-
maxSelectedDateCountintCount of max selectable dates1
onDateSelectedFunction(DateTime dateTime)Callback when date is selected-
onDateLongTapFunction(DateTime dateTime)Callback when date cell is long pressed-
onDateUnSelectedFunction(DateTime dateTime)Callback when date is unselected-
onMaxDateSelectionReachedVoidCallbackCallback when max date selection count is reached-
initialSelectedDatesList<DateTime>List of initially selected datesEmpty List
isDateDisabledbool Function(DateTime dateTime)Function that returns bool to check if particular date is disabled-
labelOrderList<LabelType>Order of labels LabelType.month, LabelType.date, LabelType.weekday
scrollControllerScrollControllerScroll Controller of horizontal list-
monthTextStyleTextStyleMonth label TextStyletitleTheme
selectedMonthTextStyleTextStyleSelected Month label TextStylemonthTextStyle
monthFormatStringFormat of monthMMM
dateTextStyleTextStyleDate label TextStylesubTitleTheme
selectedDateTextStyleTextStyleSelected Date label TextStyledateTextStyle
dateFormatStringFormat of datedd
weekDayTextStyleTextStyleWeek day label TextStylesubTitleTheme
selectedWeekDayTextStyleTextStyleSelected Week day label TextStyledateTextStyle
weekDayFormatStringFormat of week dayEEE
defaultDecorationDecorationDefault Decoration to be applied to date cell-
selectedDecorationDecorationDecoration to be applied to selected date cell-
disabledDecorationDecorationDecoration to be applied to disabled date cell-
spacingBetweenDatesdoubleSpacing between two cells of date8.0
paddingEdgeInsetsGeometryPadding to date cellEdgeInsets.all(8.0)

State Management in horizontal_calendar

initialSelectedDates will only be taken when the widget built for the first time. horizontal_calendar will manage the Subsequent dates selection and un selection.

To get the initial control over the host app, one can pass the UniqueKey.

e.g.

    HorizontalCalendar(
      key: UniqueKey(),
    );

Issues and Feedback

  • For any issue and feedback please create issue on Github repo.

Libraries

date_helper
date_widget
horizontal_calendar