horizontal_calendar_widget 1.0.1

  • Readme
  • Changelog
  • Example
  • Installing
  • 83

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.

[1.0.1] #

  • Changed intl from main to transitive dependency to avoid version conflicts.

[1.0.0] Initial Release #

  • [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

example/README.md

horizontal_calendar #

An Example Application that demonstrate all features provided by horizontal_calendar

Getting Started #

To watch demo, clone repo and execute

cd example/
flutter run

To use in your application:

class HorizontalCalendarDemo extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return HorizontalCalendar(
      firstDate: DateTime.now(),
      lastDate: DateTime.now().add(
        Duration(days: 15),
      ),
      //pass other properties as required
    );
  }
}

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  horizontal_calendar_widget: ^1.0.1

2. Install it

You can install packages from the command line:

with Flutter:


$ flutter pub get

Alternatively, your editor might support flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:horizontal_calendar_widget/date_helper.dart';
import 'package:horizontal_calendar_widget/date_widget.dart';
import 'package:horizontal_calendar_widget/horizontal_calendar.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
65
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100
Overall:
Weighted score of the above. [more]
83
Learn more about scoring.

We analyzed this package on Feb 27, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.7.1
  • pana: 0.13.5
  • Flutter: 1.12.13+hotfix.8

Health issues and suggestions

Document public APIs. (-0.12 points)

64 out of 66 API elements have no dartdoc comment.Providing good documentation for libraries, classes, functions, and other API elements improves code readability and helps developers find and use your API.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.2.2 <3.0.0
flutter 0.0.0
flutter_localizations 0.0.0
Transitive dependencies
collection 1.14.11 1.14.12
intl 0.16.0 0.16.1
meta 1.1.8
path 1.6.4
sky_engine 0.0.99
typed_data 1.1.6
vector_math 2.0.8
Dev dependencies
flutter_test