MiuixDatePicker class

Miuix 风格的日历日期选择器(单选)。

视觉对应 HyperOS 系统日历:

  • 顶部居中显示年月,左右两侧为圆形切换按钮。
  • 第二行为周名行(一/二/三/四/五/六/日)。
  • 下方为 6 行 × 7 列日期网格,左右滑动切换月份。
  • 选中态为 primary 圆形/squircle 背景;今天有 primary 描边;非当月日期半透明。

不对应 Kotlin 源(Miuix 原库未提供日期选择器),为 Flutter 移植版自制组件。

Inheritance

Constructors

MiuixDatePicker({Key? key, DateTime? initialDate, DateTime? currentDate, DateTime? firstDate, DateTime? lastDate, ValueChanged<DateTime>? onDateChanged, VoidCallback? onHeaderTap, bool selectableDayPredicate(DateTime)?, MiuixWeekStart weekStart = MiuixWeekStart.monday, MiuixDatePickerColors? colors, bool showOutOfMonthDays = true, double cellHeight = MiuixDatePickerDefaults.cellHeight})
const

Properties

cellHeight double
日期单元格高度,默认 44。
final
colors MiuixDatePickerColors?
颜色配置,默认取 MiuixDatePickerColors.defaultColors
final
currentDate DateTime?
"今天"参照日期,默认 DateTime.now
final
firstDate DateTime?
可选最早日期。默认 1970-01-01。
final
hashCode int
The hash code for this object.
no setterinherited
initialDate DateTime?
初始选中日期。null 表示不预选。
final
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
lastDate DateTime?
可选最晚日期。默认 2100-12-31。
final
onDateChanged ValueChanged<DateTime>?
选中日期变化回调。
final
onHeaderTap VoidCallback?
顶部"年月"标题点击回调。
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
selectableDayPredicate bool Function(DateTime)?
自定义某日是否可选。返回 false 时该日呈禁用态。
final
showOutOfMonthDays bool
是否显示当月外的填充日期(前后月尾/头)。默认 true。
final
weekStart MiuixWeekStart
周起始日,默认周一。
final

Methods

createElement() StatefulElement
Creates a StatefulElement to manage this widget's location in the tree.
inherited
createState() State<MiuixDatePicker>
Creates the mutable state for this widget at a given location in the tree.
override
debugDescribeChildren() List<DiagnosticsNode>
Returns a list of DiagnosticsNode objects describing this node's children.
inherited
debugFillProperties(DiagnosticPropertiesBuilder properties) → void
Add additional properties associated with the node.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toDiagnosticsNode({String? name, DiagnosticsTreeStyle? style}) DiagnosticsNode
Returns a debug representation of the object that is used by debugging tools and by DiagnosticsNode.toStringDeep.
inherited
toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) String
A string representation of this object.
inherited
toStringDeep({String prefixLineOne = '', String? prefixOtherLines, DiagnosticLevel minLevel = DiagnosticLevel.debug, int wrapWidth = 65}) String
Returns a string representation of this node and its descendants.
inherited
toStringShallow({String joiner = ', ', DiagnosticLevel minLevel = DiagnosticLevel.debug}) String
Returns a one-line detailed description of the object.
inherited
toStringShort() String
A short, textual description of this widget.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited