搜尋套件、儲存庫與 APP 分類

cr_calendar 封面
套件詳情v1.3.0

cr_calendar

功能強大的日曆,支援自訂、範圍選擇與事件顯示。

AndroidiOSWebmacOSWindowsLinux
近 30 天下載
158
喜歡數
113
Pub 分數
150

安裝套件

flutter pub add cr_calendar

套件介紹

根據套件公開資料產生的選型評估,僅供參考。

cr_calendar 是一個可自訂的 Flutter 日曆套件,支援範圍選擇、事件強調以及廣泛的樣式選項。它提供了一個乾淨現代的介面,可在 Android、iOS、Web、macOS、Windows 和 Linux 等多個平台顯示日期與事件。此套件讓開發者能根據各種使用情境(如排程、預約系統或個人規劃)調整日曆的外觀與行為。內建對日期範圍與事件標記的支援,簡化了 Flutter 應用中的日期管理。

適用情境

  • 安排預約
  • 預訂系統
  • 事件追蹤
  • 個人計畫
  • 日期範圍選擇
  • 基於日曆的儀表板

主要特色

  • 可自訂的 UI
  • 範圍日期選擇
  • 事件標記
  • 多平台支援
  • 靈活的日期格式化
  • 主題整合

適合對象

  • 開發預約應用的開發者
  • 建立預訂介面的團隊
  • 需要日期可視化的應用
  • 具有日曆需求的Flutter專案
  • 以使用者介面為重點的日期選擇器

使用建議

  • 需要手動管理事件資料
  • 有限的內建本地化支援
  • 無原生時間選擇
  • 樣式可能需要自定義程式碼
  • 平台特定的渲染細微差異
  • 依賴外部狀態管理

原始 README

以下為關聯原始碼儲存庫的 README 原文快照,最新內容請造訪原始碼儲存庫。

CrCalendar

Customizable Flutter calendar inspired by Google Calendar app.

Features:
  • CrCalendar widget for displaying horizontally scrollable month view, with events lines over days.
  • date selection dialog (uses CrCalendar widget in range selection mode) with customization of buttons, texts and look of the CrCalendar widget.
Screenshots of example app:

Installation

Add cr_calendar as a dependency in pubspec.yaml.

Then import it to your project:

import 'package:cr_calendar/src/cr_calendar.dart';


Usage of CrCalendar
CrCalendar parameters:
Type Name Description Default value
CrCalendarController controller Calendar controller -
DateTime initialDate Initial date to be showed when calendar created -
OnTapCallback onDayClicked Callback fired when calendar day is tapped in calendar with TouchMode.singleTap touch mode. -
WeekDays firstDayOfWeek Sets day from which week begins WeekDays.sunday
WeekDaysBuilder weekDaysBuilder Builder for customization week days row at top of the calendar widget. -
DayItemBuilder dayItemBuilder Builder for customization of days cells. -
bool forceSixWeek Force calendar to display sixth row in month view even if this week is not in current month. false
Color backgroundColor Background color of the calendar -
int maxEventLines Number of events widgets to be displayed over day item cell 4
EventBuilder eventBuilder Event widget builder -
TouchMode touchMode Touch mode of calendar. -
double eventsTopPadding Padding over events widgets to for correction of their alignment. -
OnRangeSelectedCallback onRangeSelected Callback for receiving selected range when calendar is used as date picker. -
int onSwipeCallbackDebounceMs Time in milliseconds for debounce CrCalendarController onSwipe callback. -
DateTime minDate Earliest allowable date. -
DateTime maxDate Latest allowable date. -
Base usage:
class MyApp extends StatefulWidget {
  @override
  _MyAppState createState() => _MyAppState();
}

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

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

Note: avoid using setState calls frequently on the page where the CrCalendar widget is used to improve performance.

Usage of CrCalendar date picker dialog
DatePickerProperties parameters:
Type Name Description Default value
Color backgroundColor Background color for date picker dialog and year selection widget. Colors.white
DateTime initialPickerDate Initial date to be opened on dialog creation. -
EdgeInsets padding Picker dialog padding. EdgeInsets.all(8)
DayItemBuilder dayItemBuilder Builder for day item in dialog. -
TouchMode pickerMode Picker selection mode. -
WeekDaysBuilder weekDaysBuilder Builder for row of days over month view. -
DateTitleBuilder pickerTitleBuilder Title builder for widget on top of picker dialog. -
Alignment pickerTitleAlignInLandscape Alignment of picker title in landscape mode. Alignment.centerLeft
Widget backButton Back button for picker control bar. -
Widget forwardButton Forward button for picker control bar. -
DateTitleBuilder controlBarTitleBuilder Builder for control bar title showed between backButton and forwardButton. -
bool showControlBar Option for hiding control bar. true
YearPickerItemBuilder yearPickerItemBuilder Builder for confirm selection button. -
PickerButtonBuilder okButtonBuilder Builder for confirm selection button. -
PickerButtonBuilder cancelButtonBuilder Builder for cancel button. -
bool forceSixWeek Force showing six week rows in month view. false
WeekDays firstWeekDay First day of date picker calendar. WeekDays.sunday
DateTime minDate Earliest allowable date. -
DateTime maxDate Latest allowable date. -
LandscapeDaysResizeMode landscapeDaysResizeMode LandscapeDaysResizeMode.adaptive - days cells will change their height according to parent height LandscapeDaysResizeMode.scrollable - days cells will change their height according to parent height as long as it is larger than the cells width. The month scrolls if there is not enough space LandscapeDaysResizeMode.adaptive
Base usage:
  /// Show calendar in pop up dialog for selecting date range for calendar event.
  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(),
      ),
    );
  }

所屬分類

依賴

依賴清單 3 項

原始碼儲存庫

使用此套件的專案

暫無相關資料。