網(wǎng)站首頁(yè) 編程語(yǔ)言 正文
前言
近期有個(gè)業(yè)務(wù)需求,涉及用戶(hù)付費(fèi)相關(guān)的計(jì)算,需要一個(gè)日歷組件,組件功能如下:
- 僅支持從明天開(kāi)始選擇預(yù)定日期
- 僅支持可選范圍內(nèi)的日期
- 日期的選擇是連續(xù)的
- 有個(gè)推薦日期,需要聯(lián)動(dòng)更新
- todo:
- 支持不連續(xù)的日期選擇
Github:tw_calendar
安裝
dependencies:
tw_calendar: latest_version
效果
demo 演示
業(yè)務(wù)使用 headerView
使用
配置屬性
/// 開(kāi)始的年月份
final DateTime firstDate;
/// 結(jié)束的年月份
final DateTime lastDate;
/// 選擇開(kāi)始日期
final DateTime? selectedStartDate;
/// 選擇結(jié)束日期
final DateTime? selectedEndDate;
/// 點(diǎn)擊方法回調(diào)
final Function? onSelectFinish;
/// 頭部組件
final Widget? headerView;
/// 選擇模式
final TWCalendarListSeletedMode? seletedMode;
/// 月視圖高度,為空則占滿剩余空間
final double? monthBodyHeight;
/// 周視圖高度, 默認(rèn) 48
final double? weekDayHeight;
/// 水平間隙
final double? horizontalSpace;
/// 確認(rèn)周視圖高度, 默認(rèn) 66
final double? ensureViewHeight;
/// 確認(rèn)按鈕的間隙
final EdgeInsetsGeometry? ensureViewPadding;
/// 確認(rèn)按鈕選中顏色
final Color? ensureViewSelectedColor;
/// 確認(rèn)未按鈕選中顏色
final Color? ensureViewUnSelectedColor;
/// 今天的日期的背景顏色
final Color? dayNumberTodayColor;
/// 選中日期背景顏色
final Color? dayNumberSelectedColor;
/// 確認(rèn)按鈕字體大小
final double? ensureTitleFontSize;
/// 點(diǎn)擊回調(diào)
final void Function(DateTime seletedDate, int seletedDays)? onSelectDayRang;
/// 選擇確認(rèn)按鈕 title 回調(diào)
final String Function(
DateTime? selectStartTime, DateTime? selectEndTime, int seletedDays)?
onSelectDayTitle;
DEMO
TWCalendarList(
firstDate: TWCalendarTool.tomorrow,
lastDate: DateTime(2022, 11, 21),
selectedStartDate: DateTime(2022, 9, 2),
selectedEndDate: DateTime(2022, 9, 10),
monthBodyHeight: 300.w,
seletedMode: TWCalendarListSeletedMode.singleSerial,
headerView: Container(
alignment: Alignment.center,
height: 55.w,
child: Text(
'日歷組件',
style: TextStyle(
color: TWColors.tw333333,
fontSize: 18.w,
),
),
),
onSelectDayRang: ((seletedDate, seletedDays) {
print('seletedDate : $seletedDate, seletedDays : $seletedDays');
}),
onSelectFinish: (selectStartTime, selectEndTime) {
print(
'selectStartTime : $selectStartTime, selectEndTime : $selectEndTime');
Navigator.pop(context);
},
)
感謝
參考及修改至 demo: flutter_calendar_list
原文鏈接:https://juejin.cn/post/7127970073897074702
相關(guān)推薦
- 2022-09-16 Oracle查看表空間使用率以及爆滿解決方案詳解_oracle
- 2022-08-23 React?Native中實(shí)現(xiàn)動(dòng)態(tài)導(dǎo)入的示例代碼_React
- 2022-11-05 pytest官方文檔解讀之安裝和使用插件的方法_python
- 2022-08-16 C#?IEnumerator枚舉器的具體使用_C#教程
- 2022-06-06 Ubuntu系統(tǒng)-FFmpeg安裝及環(huán)境配置
- 2022-07-14 Android實(shí)現(xiàn)ViewFlipper圖片動(dòng)畫(huà)滑動(dòng)_Android
- 2023-03-20 C#中如何生成安裝包_C#教程
- 2023-04-24 python讀取相對(duì)路徑和絕對(duì)路徑的方法_python
- 最近更新
-
- window11 系統(tǒng)安裝 yarn
- 超詳細(xì)win安裝深度學(xué)習(xí)環(huán)境2025年最新版(
- Linux 中運(yùn)行的top命令 怎么退出?
- MySQL 中decimal 的用法? 存儲(chǔ)小
- get 、set 、toString 方法的使
- @Resource和 @Autowired注解
- Java基礎(chǔ)操作-- 運(yùn)算符,流程控制 Flo
- 1. Int 和Integer 的區(qū)別,Jav
- spring @retryable不生效的一種
- Spring Security之認(rèn)證信息的處理
- Spring Security之認(rèn)證過(guò)濾器
- Spring Security概述快速入門(mén)
- Spring Security之配置體系
- 【SpringBoot】SpringCache
- Spring Security之基于方法配置權(quán)
- redisson分布式鎖中waittime的設(shè)
- maven:解決release錯(cuò)誤:Artif
- restTemplate使用總結(jié)
- Spring Security之安全異常處理
- MybatisPlus優(yōu)雅實(shí)現(xiàn)加密?
- Spring ioc容器與Bean的生命周期。
- 【探索SpringCloud】服務(wù)發(fā)現(xiàn)-Nac
- Spring Security之基于HttpR
- Redis 底層數(shù)據(jù)結(jié)構(gòu)-簡(jiǎn)單動(dòng)態(tài)字符串(SD
- arthas操作spring被代理目標(biāo)對(duì)象命令
- Spring中的單例模式應(yīng)用詳解
- 聊聊消息隊(duì)列,發(fā)送消息的4種方式
- bootspring第三方資源配置管理
- GIT同步修改后的遠(yuǎn)程分支