1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586 |
- import 'package:flutter/material.dart';
- /// 迷你日历的日期数据结构
- class MiniViewDayStructure {
- final int index; // 下标
- final DateTime date; // 日期
- final bool isToday; // 是否是当天
- final bool isCurrentMonth; // 是否是当月
- bool hasSchedule; // 是否包含日程
- bool isSelected; // 是否选中
- MiniViewDayStructure({
- required this.index,
- required this.date,
- this.isToday = false,
- this.isCurrentMonth = true,
- this.isSelected = false,
- this.hasSchedule = false,
- });
- setSelected() {
- isSelected = true;
- }
- setUnselected() {
- isSelected = false;
- }
- }
- /// 月视图的日期数据结构
- class MonthViewDayStructure {
- final int index; // 下标
- final DateTime date; // 日期
- final bool isToday; // 是否是当天
- final bool isCurrentMonth; // 是否是当月
- bool isSelected; // 是否选中
- List<Schedule> scheduleList; // 日程列表
- MonthViewDayStructure({
- required this.index,
- required this.date,
- this.isToday = false,
- this.isCurrentMonth = true,
- this.isSelected = false,
- this.scheduleList = const [],
- });
- setSelected() {
- isSelected = true;
- }
- setUnselected() {
- isSelected = false;
- }
- }
- /// 结构化的日程类型数据:类型名称,类型是否选中,类型颜色
- class ScheduleType {
- final String typeName; // 类型名称
- final Color color; // 类型颜色
- bool isSelected; // 类型是否选中
- ScheduleType({
- required this.typeName,
- required this.isSelected,
- required this.color,
- });
- }
- class Schedule {
- final String title; // 日程标题
- final String content; // 日程内容
- final DateTime day; // 日程日期
- final ScheduleType type; // 日程类型
- final DateTime? startTime; // 日程开始时间
- final DateTime? endTime; // 日程结束时间
- Schedule({
- required this.title,
- required this.content,
- required this.day,
- required this.type,
- this.startTime,
- this.endTime,
- });
- }
|