MiuixPressable class

Miuix 风格的可按压容器。在子节点之上叠加一层半透明遮罩,按下/悬停/聚焦时 通过 spring 驱动 alpha 变化,可选叠加 sink(下沉缩放)或 tilt(3D 倾斜)反馈。

这是对 Kotlin 端 MiuixIndication + SinkFeedback/TiltFeedback 的合并实现。

Inheritance

Constructors

MiuixPressable({Key? key, required VoidCallback? onPressed, required Widget child, bool enabled = true, MiuixPressFeedbackType feedbackType = MiuixPressFeedbackType.none, double sinkAmount = 0.94, double tiltAmount = 8.0, Color? overlayColor, BorderRadius? borderRadius, ShapeBorder? shape, bool heldDown = false, bool autofocus = false, FocusNode? focusNode, String? semanticLabel, bool button = true, HitTestBehavior behavior = HitTestBehavior.opaque, VoidCallback? onLongPress})
const

Properties

autofocus → bool
是否自动获取焦点。
final
behavior → HitTestBehavior
点击测试行为。
final
borderRadius → BorderRadius?
用于裁剪遮罩与反馈的圆角。null 表示不裁剪。
final
button → bool
是否将该容器标记为按钮语义。对多数可点击容器为 true; 对 Checkbox/Switch 等有专用语义的控件可置为 false,由外层补充语义。
final
child → Widget
子节点。
final
enabled → bool
是否启用。
final
feedbackType → MiuixPressFeedbackType
额外的按压反馈类型。
final
focusNode → FocusNode?
外部焦点节点。
final
hashCode → int
The hash code for this object.
no setterinherited
heldDown → bool
外部强制的“按下保持”状态。对应 Kotlin HoldDownInteraction: 当父组件(如 Preference、弹出菜单项)需要在指针释放后仍保持按压外观时置为 true。
final
key → Key?
Controls how one widget replaces another widget in the tree.
finalinherited
onLongPress → VoidCallback?
长按回调。
final
onPressed → VoidCallback?
点击回调。为 null 时 enabled 视为 false。
final
overlayColor → Color?
遮罩颜色。默认取自 MiuixTheme 的 onBackground。
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
semanticLabel → String?
无障碍标签。为 null 时由子节点自身语义提供。
final
shape → ShapeBorder?
用于裁剪遮罩与反馈的任意形状(如 squircle/stadium)。
final
sinkAmount → double
sink 反馈的缩放目标(默认 0.94)。
final
tiltAmount → double
tilt 反馈的最大倾角(度,默认 8)。
final

Methods

createElement() → StatefulElement
Creates a StatefulElement to manage this widget's location in the tree.
inherited
createState() → State<MiuixPressable>
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