syncfusion-flutter-calendar-datepicker

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Syncfusion Flutter Calendar & Date Range Picker

Syncfusion Flutter 日历与日期范围选择器

This skill covers two related Syncfusion Flutter components for date and calendar functionality: SfCalendar (Event Calendar) and SfDateRangePicker (Date Range Picker). While they share many visual and configuration features, they serve different primary purposes.
本技能介绍两款用于实现日期和日历功能的Syncfusion Flutter相关组件:SfCalendar(事件日历)和SfDateRangePicker(日期范围选择器)。二者共享许多视觉和配置特性,但核心用途不同。

When to Use This Skill

适用场景

Use this skill when you need to:
  • Implement event calendars with appointments, scheduling, and time management
  • Add date selection to forms, filters, or booking interfaces
  • Display calendar views (month, week, day, year, decade, timeline, schedule)
  • Handle date range selection for reports, analytics, or filtering
  • Create appointment/booking systems with recurring events and time zones
  • Build scheduling interfaces with drag-drop, resizing, and resource views
  • Enable date navigation with various view modes and restrictions
  • Customize calendar appearance with builders, themes, and styling
  • Support multiple date selection modes (single, multiple, range, multi-range)
  • Integrate calendar localization with RTL support and accessibility
当你需要实现以下需求时可使用本技能:
  • 实现事件日历,支持预约、日程安排和时间管理
  • 为表单、筛选器或预订界面添加日期选择功能
  • 展示日历视图(月、周、日、年、十年、时间轴、日程)
  • 为报表、分析或筛选处理日期范围选择
  • 创建预约/预订系统,支持重复事件和时区配置
  • 构建调度界面,支持拖拽、调整大小和资源视图
  • 支持多种视图模式和限制规则的日期导航
  • 通过构建器、主题和样式自定义日历外观
  • 支持多种日期选择模式(单选、多选、范围选择、多范围选择)
  • 集成日历本地化,支持RTL(从右到左)布局和无障碍访问

Choosing the Right Component

如何选择合适的组件

Use SfCalendar (Event Calendar) when:

选择SfCalendar(事件日历)的场景:

  • You need to display and manage appointments/events
  • Your app requires scheduling functionality (booking, meetings, tasks)
  • You need timeline views or schedule views for event management
  • Time-based views are important (day, week, workweek with time slots)
  • You need recurring events, time zones, or resource allocation
  • Drag-and-drop or appointment resizing is required
  • Building calendars for: meeting schedulers, appointment books, task managers, event planners
  • 你需要展示和管理预约/事件
  • 你的应用需要调度功能(预订、会议、任务)
  • 你需要时间轴视图日程视图来管理事件
  • 基于时间的视图很重要(带时间槽的日、周、工作周视图)
  • 你需要重复事件时区资源分配能力
  • 需要拖拽预约时长调整功能
  • 适用场景:会议调度器、预约本、任务管理器、活动规划器

Use SfDateRangePicker (Date Range Picker) when:

选择SfDateRangePicker(日期范围选择器)的场景:

  • You need date selection without appointment management
  • Your primary goal is picking dates or date ranges for forms/filters
  • You need flexible selection modes (single, multiple, range, multi-range)
  • Simplified date input for booking start/end dates, report periods, etc.
  • You want action buttons (confirm/cancel) for date selection dialogs
  • Building UI for: date filters, booking dates, report date ranges, form date inputs
  • 你只需要日期选择,不需要预约管理功能
  • 你的核心需求是为表单/筛选器选择日期或日期范围
  • 你需要灵活的选择模式(单选、多选、范围选择、多范围选择)
  • 用于预订起止日期、报表周期等场景的轻量化日期输入
  • 你需要日期选择弹窗的操作按钮(确认/取消)
  • 适用场景:日期筛选器、预订日期选择、报表日期范围、表单日期输入

Key Differences Summary:

核心差异汇总:

FeatureSfCalendarSfDateRangePicker
Primary PurposeEvent scheduling & displayDate selection
Appointments/Events✅ Full support❌ Not supported
View Types9 views (day, week, timeline, etc.)4 views (month, year, decade, century)
Selection ModesSingle date/time slotSingle, multiple, range, multi-range
Time Slots✅ Yes (with time)❌ Dates only
Action Buttons❌ No✅ Confirm/Cancel buttons
Recurring Events✅ Yes❌ No
Time Zones✅ Yes❌ No
Resource View✅ Yes❌ No
Drag & Drop✅ Yes❌ No
功能SfCalendarSfDateRangePicker
主要用途事件调度与展示日期选择
预约/事件✅ 完全支持❌ 不支持
视图类型9种视图(日、周、时间轴等)4种视图(月、年、十年、世纪)
选择模式单日期/时间槽选择单选、多选、范围选择、多范围选择
时间槽✅ 支持(带时间)❌ 仅支持日期
操作按钮❌ 无✅ 支持确认/取消按钮
重复事件✅ 支持❌ 不支持
时区✅ 支持❌ 不支持
资源视图✅ 支持❌ 不支持
拖拽功能✅ 支持❌ 不支持

Documentation and Navigation Guide

文档与导航指南

Getting Started

入门指南

📄 Read: references/getting-started.md
  • Installation and package setup for both components
  • Basic SfCalendar implementation
  • Basic SfDateRangePicker implementation
  • Package dependencies and imports
  • Quick comparison and first examples
📄 阅读: references/getting-started.md
  • 两个组件的安装与包配置
  • 基础SfCalendar实现
  • 基础SfDateRangePicker实现
  • 包依赖与导入
  • 快速对比与入门示例

Component Overview

组件概览

📄 For Calendar: references/calendar-overview.md
  • SfCalendar widget overview and features
  • When to use Calendar vs Date Range Picker
  • Nine calendar view types explained
  • Calendar-specific capabilities
  • Basic calendar configuration
📄 For Date Range Picker: references/datepicker-overview.md
  • SfDateRangePicker widget overview and features
  • When to use Date Range Picker vs Calendar
  • Four picker view types explained
  • Date picker-specific capabilities
  • Multi-picker view (side by side)
📄 日历相关: references/calendar-overview.md
  • SfCalendar组件概览与特性
  • 日历与日期范围选择器的适用场景差异
  • 9种日历视图类型说明
  • 日历专属能力介绍
  • 基础日历配置
📄 日期范围选择器相关: references/datepicker-overview.md
  • SfDateRangePicker组件概览与特性
  • 日期范围选择器与日历的适用场景差异
  • 4种选择器视图类型说明
  • 日期选择器专属能力介绍
  • 多选择器视图(并排展示)

View Types and Navigation

视图类型与导航

📄 Read: references/views.md
  • Month view (both components)
  • Year, decade, century views (Date Range Picker)
  • Day, week, workweek views (Calendar)
  • Schedule view (Calendar)
  • Timeline views: day, week, workweek, month (Calendar)
  • Month agenda view (Calendar)
  • View switching and navigation
  • Week number display
  • First day of week configuration
📄 Read: references/date-navigations.md
  • Forward and backward navigation
  • Programmatic date navigation
  • Initial display date configuration
  • Navigation arrows
  • View mode switching controls
  • Min/max date restrictions
  • Blackout dates (disabled dates)
📄 阅读: references/views.md
  • 月视图(两个组件均支持)
  • 年、十年、世纪视图(日期范围选择器)
  • 日、周、工作周视图(日历)
  • 日程视图(日历)
  • 时间轴视图:日、周、工作周、月(日历)
  • 月议程视图(日历)
  • 视图切换与导航
  • 周数展示
  • 周首日配置
📄 阅读: references/date-navigations.md
  • 前后导航
  • 编程式日期导航
  • 初始展示日期配置
  • 导航箭头
  • 视图模式切换控件
  • 最小/最大日期限制
  • 禁用日期(黑名单日期)

Calendar-Specific Features

日历专属特性

📄 Read: references/appointments.md
  • Calendar appointments (events/scheduling)
  • Appointment class and properties
  • CalendarDataSource setup and mapping
  • Custom appointment objects
  • All-day appointments
  • Recurring appointments and rules
  • Appointment display modes
  • Time zone support for appointments
  • Appointment customization
📄 阅读: references/appointments.md
  • 日历预约(事件/调度)
  • 预约类与属性
  • CalendarDataSource配置与映射
  • 自定义预约对象
  • 全天预约
  • 重复预约与规则
  • 预约展示模式
  • 预约时区支持
  • 预约自定义

Date Range Picker-Specific Features

日期范围选择器专属特性

📄 Read: references/selections.md
  • Selection modes (single, multiple, range, multi-range, extendable)
  • Single date selection
  • Multiple date selection
  • Range selection (start and end dates)
  • Multi-range selection (multiple ranges)
  • Programmatic selection
  • Selection changed callbacks
  • Initial selected date
  • Selection decoration and styling
📄 阅读: references/selections.md
  • 选择模式(单选、多选、范围选择、多范围选择、可扩展范围)
  • 单日期选择
  • 多日期选择
  • 范围选择(起止日期)
  • 多范围选择(多个范围)
  • 编程式选择
  • 选择变更回调
  • 初始选中日期
  • 选择装饰与样式

Customization and Styling

自定义与样式

📄 Read: references/customization.md
  • Visual appearance customization
  • Cell styling and colors
  • Header customization
  • Today highlight color
  • Cell border color and background
  • Selection decoration
  • Theme integration
  • Special time regions (Calendar)
  • Month cell appearance
📄 Read: references/builders.md
  • Custom cell builders
  • Month cell builder
  • Year cell builder
  • Appointment builder (Calendar)
  • Time region builder (Calendar)
  • Resource header builder (Calendar)
  • Builder patterns and examples
📄 阅读: references/customization.md
  • 视觉外观自定义
  • 单元格样式与颜色
  • 头部自定义
  • 今日高亮颜色
  • 单元格边框颜色与背景
  • 选择装饰
  • 主题集成
  • 特殊时间区域(日历)
  • 月单元格外观
📄 阅读: references/builders.md
  • 自定义单元格构建器
  • 月单元格构建器
  • 年单元格构建器
  • 预约构建器(日历)
  • 时间区域构建器(日历)
  • 资源头部构建器(日历)
  • 构建器模式与示例

Event Handling

事件处理

📄 Read: references/callbacks.md
  • onSelectionChanged (both components)
  • onViewChanged (both components)
  • onTap and onLongPress (Calendar)
  • onSubmit and onCancel (Date Range Picker)
  • Calendar-specific callbacks (appointment interactions)
  • Callback argument types
  • Event handling patterns
📄 阅读: references/callbacks.md
  • onSelectionChanged(两个组件均支持)
  • onViewChanged(两个组件均支持)
  • onTap和onLongPress(日历)
  • onSubmit和onCancel(日期范围选择器)
  • 日历专属回调(预约交互)
  • 回调参数类型
  • 事件处理模式

Localization and Accessibility

本地化与无障碍访问

📄 Read: references/localization.md
  • Internationalization support
  • Locale configuration
  • Date format customization
  • Header and cell formats
  • Globalization examples
  • Right-to-left (RTL) support
📄 Read: references/accessibility.md
  • Screen reader support
  • Semantic labels
  • Keyboard navigation
  • WCAG compliance
  • Focus indicators
  • Accessible date selection
📄 阅读: references/localization.md
  • 国际化支持
  • 区域设置配置
  • 日期格式自定义
  • 头部与单元格格式
  • 全球化示例
  • RTL(从右到左)布局支持
📄 阅读: references/accessibility.md
  • 屏幕阅读器支持
  • 语义标签
  • 键盘导航
  • WCAG合规
  • 焦点指示器
  • 无障碍日期选择

Advanced Features

高级特性

📄 Read: references/advanced-features.md
  • Time zones (Calendar)
  • Resource view (Calendar)
  • Drag and drop (Calendar)
  • Appointment resizing (Calendar)
  • Load more appointments (Calendar)
  • Hijri calendar support (Date Range Picker)
  • Date restrictions and constraints (Date Range Picker)
  • Action buttons (Date Range Picker)
  • Current time indicator (Calendar)
📄 阅读: references/advanced-features.md
  • 时区(日历)
  • 资源视图(日历)
  • 拖拽功能(日历)
  • 预约大小调整(日历)
  • 加载更多预约(日历)
  • Hijri日历支持(日期范围选择器)
  • 日期限制与约束(日期范围选择器)
  • 操作按钮(日期范围选择器)
  • 当前时间指示器(日历)

Quick Start Examples

快速入门示例

Basic Calendar with Appointments

带预约的基础日历

dart
import 'package:flutter/material.dart';
import 'package:syncfusion_flutter_calendar/calendar.dart';

class MyCalendar extends StatelessWidget {
  
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(title: Text('My Calendar')),
      body: SfCalendar(
        view: CalendarView.month,
        dataSource: MeetingDataSource(_getDataSource()),
        monthViewSettings: MonthViewSettings(
          appointmentDisplayMode: MonthAppointmentDisplayMode.appointment
        ),
      ),
    );
  }

  List<Meeting> _getDataSource() {
    final List<Meeting> meetings = <Meeting>[];
    final DateTime today = DateTime.now();
    final DateTime startTime = DateTime(today.year, today.month, today.day, 9, 0, 0);
    final DateTime endTime = startTime.add(Duration(hours: 2));
    
    meetings.add(Meeting(
      'Conference',
      startTime,
      endTime,
      Color(0xFF0F8644),
      false
    ));
    
    return meetings;
  }
}

class MeetingDataSource extends CalendarDataSource {
  MeetingDataSource(List<Meeting> source) {
    appointments = source;
  }

  
  DateTime getStartTime(int index) => appointments![index].from;
  
  
  DateTime getEndTime(int index) => appointments![index].to;
  
  
  String getSubject(int index) => appointments![index].eventName;
  
  
  Color getColor(int index) => appointments![index].background;
  
  
  bool isAllDay(int index) => appointments![index].isAllDay;
}

class Meeting {
  Meeting(this.eventName, this.from, this.to, this.background, this.isAllDay);
  
  String eventName;
  DateTime from;
  DateTime to;
  Color background;
  bool isAllDay;
}
dart
import 'package:flutter/material.dart';
import 'package:syncfusion_flutter_calendar/calendar.dart';

class MyCalendar extends StatelessWidget {
  
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(title: Text('My Calendar')),
      body: SfCalendar(
        view: CalendarView.month,
        dataSource: MeetingDataSource(_getDataSource()),
        monthViewSettings: MonthViewSettings(
          appointmentDisplayMode: MonthAppointmentDisplayMode.appointment
        ),
      ),
    );
  }

  List<Meeting> _getDataSource() {
    final List<Meeting> meetings = <Meeting>[];
    final DateTime today = DateTime.now();
    final DateTime startTime = DateTime(today.year, today.month, today.day, 9, 0, 0);
    final DateTime endTime = startTime.add(Duration(hours: 2));
    
    meetings.add(Meeting(
      'Conference',
      startTime,
      endTime,
      Color(0xFF0F8644),
      false
    ));
    
    return meetings;
  }
}

class MeetingDataSource extends CalendarDataSource {
  MeetingDataSource(List<Meeting> source) {
    appointments = source;
  }

  
  DateTime getStartTime(int index) => appointments![index].from;
  
  
  DateTime getEndTime(int index) => appointments![index].to;
  
  
  String getSubject(int index) => appointments![index].eventName;
  
  
  Color getColor(int index) => appointments![index].background;
  
  
  bool isAllDay(int index) => appointments![index].isAllDay;
}

class Meeting {
  Meeting(this.eventName, this.from, this.to, this.background, this.isAllDay);
  
  String eventName;
  DateTime from;
  DateTime to;
  Color background;
  bool isAllDay;
}

Basic Date Range Picker

基础日期范围选择器

dart
import 'package:flutter/material.dart';
import 'package:syncfusion_flutter_datepicker/datepicker.dart';

class MyDatePicker extends StatelessWidget {
  
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(title: Text('Select Date Range')),
      body: SfDateRangePicker(
        view: DateRangePickerView.month,
        selectionMode: DateRangePickerSelectionMode.range,
        onSelectionChanged: _onSelectionChanged,
        showActionButtons: true,
      ),
    );
  }

  void _onSelectionChanged(DateRangePickerSelectionChangedArgs args) {
    if (args.value is PickerDateRange) {
      final DateTime startDate = args.value.startDate;
      final DateTime? endDate = args.value.endDate;
      print('Selected range: $startDate to $endDate');
    }
  }
}
dart
import 'package:flutter/material.dart';
import 'package:syncfusion_flutter_datepicker/datepicker.dart';

class MyDatePicker extends StatelessWidget {
  
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(title: Text('Select Date Range')),
      body: SfDateRangePicker(
        view: DateRangePickerView.month,
        selectionMode: DateRangePickerSelectionMode.range,
        onSelectionChanged: _onSelectionChanged,
        showActionButtons: true,
      ),
    );
  }

  void _onSelectionChanged(DateRangePickerSelectionChangedArgs args) {
    if (args.value is PickerDateRange) {
      final DateTime startDate = args.value.startDate;
      final DateTime? endDate = args.value.endDate;
      print('Selected range: $startDate to $endDate');
    }
  }
}

Date Picker with Multiple Selection

多选日期选择器

dart
SfDateRangePicker(
  view: DateRangePickerView.month,
  selectionMode: DateRangePickerSelectionMode.multiple,
  initialSelectedDates: [
    DateTime.now(),
    DateTime.now().add(Duration(days: 2)),
    DateTime.now().add(Duration(days: 5)),
  ],
  onSelectionChanged: (DateRangePickerSelectionChangedArgs args) {
    final List<DateTime> selectedDates = args.value;
    print('Selected ${selectedDates.length} dates');
  },
)
dart
SfDateRangePicker(
  view: DateRangePickerView.month,
  selectionMode: DateRangePickerSelectionMode.multiple,
  initialSelectedDates: [
    DateTime.now(),
    DateTime.now().add(Duration(days: 2)),
    DateTime.now().add(Duration(days: 5)),
  ],
  onSelectionChanged: (DateRangePickerSelectionChangedArgs args) {
    final List<DateTime> selectedDates = args.value;
    print('Selected ${selectedDates.length} dates');
  },
)

Common Patterns

常用模式

Pattern 1: Calendar with Different Views

模式1:多视图切换日历

dart
// Switch between day, week, month, and schedule views
CalendarView _calendarView = CalendarView.month;

SfCalendar(
  view: _calendarView,
  dataSource: MeetingDataSource(_appointments),
  onViewChanged: (ViewChangedDetails details) {
    // Handle view changes
  },
)

// Toggle view with buttons
void _changeView(CalendarView view) {
  setState(() {
    _calendarView = view;
  });
}
dart
// 在日、周、月、日程视图之间切换
CalendarView _calendarView = CalendarView.month;

SfCalendar(
  view: _calendarView,
  dataSource: MeetingDataSource(_appointments),
  onViewChanged: (ViewChangedDetails details) {
    // 处理视图变更
  },
)

// 用按钮切换视图
void _changeView(CalendarView view) {
  setState(() {
    _calendarView = view;
  });
}

Pattern 2: Date Range Filter for Reports

模式2:报表日期范围筛选器

dart
// Common pattern for selecting date ranges in analytics/reports
PickerDateRange? _selectedRange;

SfDateRangePicker(
  selectionMode: DateRangePickerSelectionMode.range,
  onSelectionChanged: (DateRangePickerSelectionChangedArgs args) {
    setState(() {
      _selectedRange = args.value;
    });
  },
  showActionButtons: true,
  onSubmit: (Object? value) {
    if (_selectedRange != null) {
      _loadReportData(_selectedRange!.startDate, _selectedRange!.endDate);
    }
    Navigator.pop(context);
  },
)
dart
// 分析/报表场景常用的日期范围选择模式
PickerDateRange? _selectedRange;

SfDateRangePicker(
  selectionMode: DateRangePickerSelectionMode.range,
  onSelectionChanged: (DateRangePickerSelectionChangedArgs args) {
    setState(() {
      _selectedRange = args.value;
    });
  },
  showActionButtons: true,
  onSubmit: (Object? value) {
    if (_selectedRange != null) {
      _loadReportData(_selectedRange!.startDate, _selectedRange!.endDate);
    }
    Navigator.pop(context);
  },
)

Pattern 3: Customized Cell Appearance

模式3:自定义单元格外观

dart
// Custom styling for both components
SfCalendar(
  view: CalendarView.month,
  todayHighlightColor: Colors.blue,
  cellBorderColor: Colors.grey[300],
  backgroundColor: Colors.white,
  selectionDecoration: BoxDecoration(
    color: Colors.transparent,
    border: Border.all(color: Colors.blue, width: 2),
    borderRadius: BorderRadius.circular(4),
  ),
)

SfDateRangePicker(
  todayHighlightColor: Colors.green,
  selectionColor: Colors.blue,
  rangeSelectionColor: Colors.blue.withOpacity(0.3),
  startRangeSelectionColor: Colors.blue,
  endRangeSelectionColor: Colors.blue,
)
dart
// 两个组件通用的自定义样式
SfCalendar(
  view: CalendarView.month,
  todayHighlightColor: Colors.blue,
  cellBorderColor: Colors.grey[300],
  backgroundColor: Colors.white,
  selectionDecoration: BoxDecoration(
    color: Colors.transparent,
    border: Border.all(color: Colors.blue, width: 2),
    borderRadius: BorderRadius.circular(4),
  ),
)

SfDateRangePicker(
  todayHighlightColor: Colors.green,
  selectionColor: Colors.blue,
  rangeSelectionColor: Colors.blue.withOpacity(0.3),
  startRangeSelectionColor: Colors.blue,
  endRangeSelectionColor: Colors.blue,
)

Pattern 4: Restricting Date Selection

模式4:限制日期选择范围

dart
// Disable past dates and weekends
SfDateRangePicker(
  minDate: DateTime.now(),
  maxDate: DateTime.now().add(Duration(days: 365)),
  selectableDayPredicate: (DateTime date) {
    // Disable weekends
    return date.weekday != DateTime.saturday && 
           date.weekday != DateTime.sunday;
  },
)
dart
// 禁用过去日期和周末
SfDateRangePicker(
  minDate: DateTime.now(),
  maxDate: DateTime.now().add(Duration(days: 365)),
  selectableDayPredicate: (DateTime date) {
    // 禁用周末
    return date.weekday != DateTime.saturday && 
           date.weekday != DateTime.sunday;
  },
)

Key Properties

核心属性

SfCalendar Essential Properties

SfCalendar核心属性

  • view
    - Calendar view type (day, week, month, schedule, timeline, etc.)
  • dataSource
    - CalendarDataSource with appointments
  • initialDisplayDate
    - Date to display initially
  • initialSelectedDate
    - Initially selected date/time
  • monthViewSettings
    - Configuration for month view
  • timeSlotViewSettings
    - Configuration for day/week views
  • scheduleViewSettings
    - Configuration for schedule view
  • todayHighlightColor
    - Color for today's date
  • selectionDecoration
    - Selection styling
  • onTap
    - Callback when cell is tapped
  • onLongPress
    - Callback for long press
  • onViewChanged
    - Callback when view changes
  • onSelectionChanged
    - Callback when selection changes
  • showNavigationArrow
    - Show forward/backward arrows
  • showCurrentTimeIndicator
    - Show current time line
  • allowViewNavigation
    - Allow switching between views
  • firstDayOfWeek
    - First day of week (1-7)
  • blackoutDates
    - Dates to disable
  • minDate
    /
    maxDate
    - Date range restrictions
  • view
    - 日历视图类型(日、周、月、日程、时间轴等)
  • dataSource
    - 包含预约数据的CalendarDataSource
  • initialDisplayDate
    - 初始展示的日期
  • initialSelectedDate
    - 初始选中的日期/时间
  • monthViewSettings
    - 月视图配置
  • timeSlotViewSettings
    - 日/周视图配置
  • scheduleViewSettings
    - 日程视图配置
  • todayHighlightColor
    - 今日日期高亮颜色
  • selectionDecoration
    - 选中样式
  • onTap
    - 单元格点击回调
  • onLongPress
    - 单元格长按回调
  • onViewChanged
    - 视图变更回调
  • onSelectionChanged
    - 选中内容变更回调
  • showNavigationArrow
    - 展示前后导航箭头
  • showCurrentTimeIndicator
    - 展示当前时间线
  • allowViewNavigation
    - 允许在视图之间切换
  • firstDayOfWeek
    - 周首日(1-7)
  • blackoutDates
    - 禁用的日期
  • minDate
    /
    maxDate
    - 可选日期范围限制

SfDateRangePicker Essential Properties

SfDateRangePicker核心属性

  • view
    - Picker view type (month, year, decade, century)
  • selectionMode
    - Selection mode (single, multiple, range, multiRange, extendableRange)
  • initialSelectedDate
    - Initially selected date
  • initialSelectedDates
    - Initially selected dates (multiple mode)
  • initialSelectedRange
    - Initially selected range
  • initialSelectedRanges
    - Initially selected ranges (multi-range mode)
  • initialDisplayDate
    - Date to display initially
  • monthViewSettings
    - Configuration for month view
  • yearViewSettings
    - Configuration for year view
  • todayHighlightColor
    - Color for today's date
  • selectionColor
    - Selection color
  • rangeSelectionColor
    - Range selection color
  • startRangeSelectionColor
    - Start date color
  • endRangeSelectionColor
    - End date color
  • onSelectionChanged
    - Callback when selection changes
  • onViewChanged
    - Callback when view changes
  • onSubmit
    - Callback when confirm button pressed
  • onCancel
    - Callback when cancel button pressed
  • showActionButtons
    - Show confirm/cancel buttons
  • showTodayButton
    - Show today button
  • allowViewNavigation
    - Allow switching between views
  • enablePastDates
    - Enable past date selection
  • minDate
    /
    maxDate
    - Date range restrictions
  • selectableDayPredicate
    - Custom date validation
  • monthCellStyle
    - Month cell styling
  • yearCellStyle
    - Year cell styling
  • view
    - 选择器视图类型(月、年、十年、世纪)
  • selectionMode
    - 选择模式(单选、多选、范围选择、多范围选择、可扩展范围)
  • initialSelectedDate
    - 初始选中的日期
  • initialSelectedDates
    - 初始选中的日期列表(多选模式)
  • initialSelectedRange
    - 初始选中的范围
  • initialSelectedRanges
    - 初始选中的范围列表(多范围模式)
  • initialDisplayDate
    - 初始展示的日期
  • monthViewSettings
    - 月视图配置
  • yearViewSettings
    - 年视图配置
  • todayHighlightColor
    - 今日日期高亮颜色
  • selectionColor
    - 选中颜色
  • rangeSelectionColor
    - 范围选中颜色
  • startRangeSelectionColor
    - 范围起始日期颜色
  • endRangeSelectionColor
    - 范围结束日期颜色
  • onSelectionChanged
    - 选中内容变更回调
  • onViewChanged
    - 视图变更回调
  • onSubmit
    - 确认按钮点击回调
  • onCancel
    - 取消按钮点击回调
  • showActionButtons
    - 展示确认/取消按钮
  • showTodayButton
    - 展示今日按钮
  • allowViewNavigation
    - 允许在视图之间切换
  • enablePastDates
    - 允许选择过去的日期
  • minDate
    /
    maxDate
    - 可选日期范围限制
  • selectableDayPredicate
    - 自定义日期校验规则
  • monthCellStyle
    - 月单元格样式
  • yearCellStyle
    - 年单元格样式

Common Use Cases

常见使用场景

  1. Meeting Scheduler - Use SfCalendar with schedule view
  2. Event Manager - Use SfCalendar with month view, recurring events, and drag-drop
  3. Booking System - Use SfDateRangePicker with range selection and date restrictions
  4. Date Filter - Use SfDateRangePicker with range/multi-range selection for reports
  5. Task Manager - Use SfCalendar with schedule view and all-day appointments
  6. Vacation Planner - Use SfDateRangePicker with multiple selection and blackout dates
  7. Resource Scheduler - Use SfCalendar with resource view and timeline
  8. Simple Date Input - Use SfDateRangePicker with single selection mode
  1. 会议调度器 - 使用带日程视图的SfCalendar
  2. 活动管理器 - 使用带月视图、重复事件和拖拽功能的SfCalendar
  3. 预订系统 - 使用带范围选择和日期限制的SfDateRangePicker
  4. 日期筛选器 - 使用带范围/多范围选择的SfDateRangePicker用于报表
  5. 任务管理器 - 使用带日程视图和全天预约的SfCalendar
  6. 假期规划器 - 使用带多选和禁用日期的SfDateRangePicker
  7. 资源调度器 - 使用带资源视图和时间轴的SfCalendar
  8. 简易日期输入 - 使用单选模式的SfDateRangePicker