搜索插件、代码仓与 APP 分类

calendar_day_slot_navigator 封面
插件详情v0.0.2

calendar_day_slot_navigator

日历天槽导航器是一个可自定义的Flutter小部件,用于选择日期,支持多种颜色主题、日期选择场景和布局自定义。

AndroidiOSmacOSWindowsLinux
近 30 天下载
60
喜欢数
25
Pub 分数
150

安装插件

flutter pub add calendar_day_slot_navigator

插件介绍

基于插件公开信息、社区数据与项目使用情况整理的选型参考。

日历天数时段导航器是一个可自定义的Flutter小部件,旨在灵活布局选项和多种配色方案下选择日期。它支持各种日期选择场景,包括单选和多选,并允许开发者根据应用设计需求调整外观和行为。该组件在跨平台兼容性方面进行了设计,可在Android、iOS、macOS、Windows和Linux上无缝运行。该小部件非常适合需要直观日历交互且具有高度视觉自定义功能的应用。

适合场景

  • 日程安排应用中的日期选择
  • 预订系统与日期可用性
  • 活动策划界面
  • 生产力工具中的自定义日历视图
  • 用户资料设置,包含出生日期输入

主要特点

  • 多色彩调支持
  • 灵活的布局自定义
  • 跨平台兼容性
  • 支持单日期和多日期选择
  • 可配置的日期单元格外观

适合对象

  • 开发基于日历功能的开发者
  • 需要视觉上明显区分的日期选择器的应用程序
  • 需要跨平台日期选择的项目
  • 具有自定义UI需求的设计导向应用程序
  • 带有日期输入的交互式表单

使用建议

  • 需要理解 Flutter widget 组合
  • 可能需要额外的样式来支持复杂主题
  • 有限的内置本地化支持
  • 大日期范围的性能影响
  • 依赖外部包更新以修复错误

原始 README

以下为关联源码仓库的 README 原文快照,最新内容请访问源码仓库。

📅 Calendar_Day_Slot_Navigator

A powerful and highly customizable Flutter calendar widget that makes date selection beautiful and intuitive. Whether you're building a booking app, scheduling system, or any application that needs elegant date picking, CalendarSlot provides the flexibility and features you need.

✨ Features

  • 🌗 Theming Support

    • Seamless integration with both light and dark modes
    • Full control over colors and gradients
    • Customizable active and inactive states
  • 🎨 Advanced Customization

    • Flexible border radius for all elements
    • Custom header text and styling
    • Adjustable day box dimensions and borders
    • Support for custom fonts including Google Fonts
  • 📆 Powerful Selection Options

    • Single date selection
    • Date range selection
    • Customizable active/inactive date ranges
    • Multiple calendar layout options
  • 🎯 Flexible Display Modes

    • Inside box day display
    • Outside box day display
    • Adjustable slot length for different view sizes

🚀 Getting Started

Installation

Add calendar_day_slot_navigator to your project by including it in your pubspec.yaml:

dependencies:
  calendar_day_slot_navigator: ^0.0.1

Run pub get to install the package:

flutter pub get
Import

Import the package in your Dart file:

import 'package:calendar_day_slot_navigator/calendar_day_slot_navigator.dart';

💻 Usage Examples

Basic Implementation

Here's a simple example to get you started:

CalendarDaySlotNavigator(
  slotLength: 5,
  initialSelectedDate: DateTime.now(),
  dayDisplayMode: DayDisplayMode.outsideDateBox,
  headerText: "Select Date",
  onDateSelect: (selectedDate) {
    print("Selected date: $selectedDate");
  },
)
Custom Styling

Add beautiful gradients and custom styling:

CalendarDaySlotNavigator(
  slotLength: 7,
  dayBoxHeightAspectRatio: 8,
  initialSelectedDate: DateTime.now(),
  dayDisplayMode: DayDisplayMode.insideDateBox,
  isGradientColor: true,
  activeGradientColor: LinearGradient(
    colors: [
      Color(0xffb644ae),
      Color(0xff873999),
    ],
    begin: Alignment.topLeft,
    end: Alignment.bottomRight,
  ),
  monthYearTabBorderRadius: 15,
  dayBoxBorderRadius: 10,
  headerText: "Select Your Preferred Date",
  fontFamilyName: "Roboto",
  isGoogleFont: true,
  dayBorderWidth: 0.5,
  onDateSelect: (selectedDate) {
    print("Selected date: $selectedDate");
  },
)
Date Range Selection

Implement date range selection with specific active dates:

CalendarDaySlotNavigator(
  dateSelectionType: DateSelectionType.activeRangeDates,
  rangeDates: [
    DateTime(2024, 6, 1),
    DateTime(2024, 6, 2),
    DateTime(2024, 6, 3),
    DateTime(2024, 6, 4),
    DateTime(2024, 6, 5),
  ],
  onDateSelect: (selectedDate) {
    print("Selected date within range: $selectedDate");
  },
)

🛠️ Properties Guide

Essential Properties
Property Type Default Description
slotLength int? 7 📏 Determines how many days are displayed in each row. Useful for different screen sizes and layouts.
dayBoxHeightAspectRatio double? 6.0 📐 Controls the height of day boxes relative to their width. Higher values make boxes shorter.
dayDisplayMode DayDisplayMode outsideDateBox 🎯 Determines where day names appear relative to date boxes. Choose between outsideDateBox or insideDateBox.
Styling Properties
Property Type Default Description
activeColor Color? Theme primary 🎨 Background color for selected dates
deActiveColor Color? White ⚪️ Background color for unselected dates
isGradientColor bool? false 🌈 Enable gradient backgrounds for dates
activeGradientColor LinearGradient? null 🎨 Custom gradient for selected dates
deActiveGradientColor LinearGradient? null ⚪️ Custom gradient for unselected dates
monthYearTabBorderRadius double? 10.0 📏 Border radius for month/year selection tabs
dayBoxBorderRadius double? 8.0 📏 Border radius for individual day boxes
dayBorderWidth double? 1.0 ✏️ Width of borders around day boxes
Font Properties
Property Type Default Description
fontFamilyName String? System 🔤 Name of the font family to use
isGoogleFont bool? false 📱 Set to true when using Google Fonts
Selection Properties
Property Type Description
dateSelectionType DateSelectionType 🎯 Controls which dates can be selected
rangeDates List<DateTime>? 📅 List of dates for range-based selection types
onDateSelect Function(DateTime)? 🖱️ Callback function when a date is selected
initialSelectedDate DateTime 📍 Sets the default selected date when calendar first loads
Date Selection Types Explained
  1. activeAllDates

    • All dates in the calendar are selectable
    • Useful for unrestricted date picking
  2. activePastDates

    • Only dates before today are selectable
    • Perfect for selecting historical dates
  3. activeFutureDates

    • Only dates after today are selectable
    • Ideal for booking systems and scheduling
  4. activeTodayAndPastDates

    • Today and all past dates are selectable
    • Good for recording past events including today
  5. activeTodayAndFutureDates

    • Today and all future dates are selectable
    • Great for appointment scheduling
  6. activeRangeDates

    • Only specified dates in rangeDates are selectable
    • Useful for custom date ranges
  7. deActiveRangeDates

    • Specified dates in rangeDates are not selectable
    • Perfect for blocking out unavailable dates

📱 Display Modes

Outside Date Box Mode
dayDisplayMode: DayDisplayMode.outsideDateBox
  • Day names appear above the date boxes
  • Provides a clean, separated look
  • More space for date numbers
Inside Date Box Mode
dayDisplayMode: DayDisplayMode.insideDateBox
  • Day names appear inside the date boxes
  • More compact layout
  • Ideal for space-conscious designs

🎨 Styling Tips

  1. Color Combinations

    activeColor: Color(0xffb644ae),    // Purple for selected
    deActiveColor: Color(0xffF5F5F5),  // Light grey for unselected
    
  2. Gradient Effects

    isGradientColor: true,
    activeGradientColor: LinearGradient(
      colors: [Color(0xffb644ae), Color(0xff873999)],
      begin: Alignment.topLeft,
      end: Alignment.bottomRight,
    ),
    
  3. Border Styling

    dayBoxBorderRadius: 12,
    dayBorderWidth: 0.5,
    

💡 Best Practices

  1. Responsive Design

    • Adjust slotLength based on screen width
    • Use appropriate dayBoxHeightAspectRatio for different screen sizes
  2. Selection Types

    • Choose appropriate dateSelectionType for your use case
    • Always handle onDateSelect callback for user interactions
  3. Accessibility

    • Use sufficient color contrast
    • Provide clear header text
    • Consider font size and readability

🤝 Contributing


Made with ❤️ by the DevCodeSpace

所属分类

依赖

依赖清单 4 项

源码仓库

使用此插件的项目

暂无相关数据。