v0.0.1calendar_day_slot_navigator
日曆天槽導航器是一個可自訂的Flutter組件,用於選擇日期,支援多種色彩主題、日期選擇情境與佈局自訂。
日曆日期槽導航器
{"sdk":"flutter"}^6.0.0^8.1.0^0.20.2^1.1.3{"sdk":"flutter"}以下為英文專案原文快照,最新內容請造訪 GitHub。
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.
https://raw.githubusercontent.com/DevCodeSpace/calendar_day_slot_navigator/main/assets/banner1.png🌗 Theming Support
🎨 Advanced Customization
📆 Powerful Selection Options
🎯 Flexible Display Modes
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 the package in your Dart file:
import 'package:calendar_day_slot_navigator/calendar_day_slot_navigator.dart';
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");
},
)
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");
},
)
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");
},
)
| 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. |
| 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 |
| Property | Type | Default | Description |
|---|---|---|---|
| fontFamilyName | String? |
System | 🔤 Name of the font family to use |
| isGoogleFont | bool? |
false | 📱 Set to true when using Google Fonts |
| 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 |
activeAllDates
activePastDates
activeFutureDates
activeTodayAndPastDates
activeTodayAndFutureDates
activeRangeDates
rangeDates are selectabledeActiveRangeDates
rangeDates are not selectabledayDisplayMode: DayDisplayMode.outsideDateBox
dayDisplayMode: DayDisplayMode.insideDateBox
Color Combinations
activeColor: Color(0xffb644ae), // Purple for selected
deActiveColor: Color(0xffF5F5F5), // Light grey for unselected
Gradient Effects
isGradientColor: true,
activeGradientColor: LinearGradient(
colors: [Color(0xffb644ae), Color(0xff873999)],
begin: Alignment.topLeft,
end: Alignment.bottomRight,
),
Border Styling
dayBoxBorderRadius: 12,
dayBorderWidth: 0.5,
Responsive Design
slotLength based on screen widthdayBoxHeightAspectRatio for different screen sizesSelection Types
dateSelectionType for your use caseonDateSelect callback for user interactionsAccessibility
Made with ❤️ by the DevCodeSpace