ArcoDropdown class
下拉菜单。
在触发节点旁弹出 droplist,默认方位 bl(左下)、触发方式 hover、
进 / 出延时 400ms、位置微调 4px —— 与官方 components/Dropdown 一致。
点击菜单项会自动收起下拉(官方 onClickMenuItem 的默认行为);
需要保持展开时,把对应 ArcoDroplistItem.keepOpen 设为 true。
ArcoDropdown(
droplist: ArcoDroplist(
children: <Widget>[
ArcoDroplistItem(child: const Text('复制'), onTap: () {}),
ArcoDroplistItem(child: const Text('删除'), onTap: () {}),
],
),
child: ArcoButton(child: const Text('操作')),
)
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatefulWidget
- ArcoDropdown
Constructors
-
ArcoDropdown({Key? key, required Widget droplist, required Widget child, ArcoTriggerPosition position = ArcoTriggerPosition.bl, Set<
ArcoTriggerType> trigger = const <ArcoTriggerType>{ArcoTriggerType.hover}, bool disabled = false, bool unmountOnExit = true, bool? popupVisible, bool defaultPopupVisible = false, ValueChanged<bool> ? onVisibleChange, Duration mouseEnterDelay = const Duration(milliseconds: 400), Duration mouseLeaveDelay = const Duration(milliseconds: 400), Duration? enterDuration, Duration? exitDuration, ArcoPopupAlign popupAlign = const ArcoPopupAlign(left: 4, right: 4, top: 4, bottom: 4), bool popupHoverStay = true, bool clickToClose = true, bool? alignPoint, bool escToClose = false, bool autoFitPosition = true}) -
创建下拉菜单。
const
Properties
- alignPoint → bool?
-
是否跟随鼠标位置;不传时在
contextMenu触发下自动开启。final - autoFitPosition → bool
-
是否自动适配视口。
final
- child → Widget
-
触发节点。
final
- clickToClose → bool
-
点击触发节点是否能关闭。
final
- defaultPopupVisible → bool
-
非受控初始显示状态。
final
- disabled → bool
-
是否禁用。
final
- droplist → Widget
-
下拉内容,通常传入 ArcoDroplist。
final
- enterDuration → Duration?
-
进场时长。
final
- escToClose → bool
-
是否允许 ESC 关闭。
final
- exitDuration → Duration?
-
退场时长。
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
- mouseEnterDelay → Duration
-
移入延时,默认 400ms。
final
- mouseLeaveDelay → Duration
-
移出延时,默认 400ms。
final
-
onVisibleChange
→ ValueChanged<
bool> ? -
显示状态变化回调。
final
- popupAlign → ArcoPopupAlign
-
位置微调,默认四向各 4px。
final
- popupHoverStay → bool
-
鼠标移入下拉框时是否保持显示。
final
- popupVisible → bool?
-
受控显示状态。
final
- position → ArcoTriggerPosition
-
方位,默认 ArcoTriggerPosition.bl。
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
trigger
→ Set<
ArcoTriggerType> -
触发方式,默认 hover。
final
- unmountOnExit → bool
-
隐藏时是否销毁浮层。
final
Methods
-
createElement(
) → StatefulElement -
Creates a StatefulElement to manage this widget's location in the tree.
inherited
-
createState(
) → State< ArcoDropdown> -
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