feat(calendar): 支持阴历、阳历类型 (#717)#902
Merged
zflyluo merged 10 commits intoTencent:developfrom Mar 30, 2026
Merged
Conversation
added 6 commits
March 21, 2026 11:07
- 新增 TDCalendarDateType 枚举支持阳历/农历切换 - 新增 TDCalendarDataSource 接口供外部实现农历转换 - 新增 showLunarInfo 参数支持阳历模式下显示农历副标题 - 完全向后兼容,不影响现有 API - 包含完整测试用例和示例代码 Close Tencent#717
- 修改 TDCalendar 添加 dateType, dataSource, showLunarInfo 参数 - 修改 TDCalendarBody 支持数据源并注入农历信息到 TDate - 修改 TDCalendarCell 实现农历显示逻辑 - TDate 新增 lunarInfo 字段存储农历信息 - 完全向后兼容,默认参数保持原有行为
修正 _buildDefaultCell 方法中的类型错误,使用正确的 TDCalendarStyle 类型
Member
|
williamliao seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account. You have signed the CLA already but the status is still pending? Let us recheck it. |
Contributor
📱 APK 下载 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

🤔 这个 PR 的性质是?
🔗 相关 Issue
Closes #717
💡 需求背景和解决方案
1. 新增参数(3个)
dateTypeTDCalendarDateTypesolardataSourceTDCalendarDataSource?nullshowLunarInfoboolfalse2. 数据源接口
定义
TDCalendarDataSource抽象接口,支持:getLunarInfo)formatDate)getSolarTerm,可选)getFestival,可选)getHolidayInfo,可选)设计原则:
3. 示例实现
在
example/lib/lunar_data_source_example.dart中提供基于lunar: ^1.7.8包的示例实现。4. 显示效果
阳历模式(dateType = solar):
农历模式(dateType = lunar):
扩展信息显示优先级:
📝 更新日志
使用示例
基础用法
自定义数据源
测试说明
运行示例
cd tdesign-component/example flutter pub get flutter run -d chrome访问 http://localhost:9000,选择 "Calendar 日历",可以看到:
fix(组件名称): 处理问题或特性描述 ...
本条 PR 不需要纳入 Changelog
☑️ 请求合并前的自查清单
组件类名: 修改描述(示例:TDBottomTabBar: 修复iconText模式,底部溢出2.5像素)