Skip to content

Commit

Permalink
新增isTimeUnit参数,控制是否显示时间单位
Browse files Browse the repository at this point in the history
  • Loading branch information
hkaikai committed Dec 25, 2024
1 parent 9451591 commit 34fd2cb
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ class TDCalendar extends StatefulWidget {
this.monthTitleBuilder,
this.pickerHeight = 178,
this.pickerItemCount = 3,
this.isTimeUnit = true,
}) : super(key: key);

/// 第一天从星期几开始,默认 0 = 周日
Expand Down Expand Up @@ -115,6 +116,9 @@ class TDCalendar extends StatefulWidget {
/// 选择器List视窗中item个数,pickerHeight / pickerItemCount即item高度
final int? pickerItemCount;

/// 是否显示时间单位
final bool? isTimeUnit;

List<DateTime>? get _value => value?.map((e) {
final date = DateTime.fromMillisecondsSinceEpoch(e);
return DateTime(date.year, date.month, date.day);
Expand Down Expand Up @@ -302,6 +306,7 @@ class _TDCalendarState extends State<TDCalendar> {
model: timePickerModel,
pickerHeight: widget.pickerHeight ?? 178,
pickerItemCount: widget.pickerItemCount ?? 3,
isTimeUnit: widget.isTimeUnit ?? true,
onConfirm: (selected) {},
onSelectedItemChanged: (wheelIndex, index) {
final time = _getValue(inherited?.selected.value ?? []);
Expand Down

0 comments on commit 34fd2cb

Please sign in to comment.