hiddenSlotElements property
控制默认插槽中单个 UI 元素的显示与隐藏。
用于在不替换整个插槽的情况下,对插槽内部元素进行细粒度控制。
Controls the visibility of individual UI elements within default slots.
Allows fine-grained control over elements inside a slot without replacing the entire slot widget.
与 slotBuilders 不同,后者会完全替换整个插槽(例如整个顶部栏), hiddenSlotElements 仅对默认实现中的部分元素进行隐藏。
Unlike slotBuilders, which replaces an entire slot (e.g. the top bar), hiddenSlotElements only hides selected elements while preserving the default implementation.
在保留默认 UI 结构(如顶部栏、底部栏、设置面板等)的前提下, 可以显式排除某些可选元素(如下载按钮、截图按钮等)。
This makes it possible to keep the default UI structure (such as the top bar, bottom bar, or settings panel) while excluding specific optional elements (e.g. download or snapshot buttons).
注意:如果某个 SlotType 已通过 slotBuilders 自定义, 则该插槽对应的 hiddenSlotElements 配置不会生效, 因为该插槽已完全由自定义组件接管。
If a SlotType is overridden via slotBuilders, the corresponding configuration in hiddenSlotElements does not take effect, since the slot is fully controlled by the custom implementation.
Key 为插槽类型 SlotType, Value 为需要隐藏的元素 key 集合。
The map key is a SlotType, and the value is the set of element keys to hide.
元素 key 由常量类定义,例如: TopBarElements、BottomBarElements 等。
Element keys are defined by constant classes such as TopBarElements and BottomBarElements.
示例:
Example:
hiddenSlotElements: {
SlotType.topBar: {
TopBarElements.download,
TopBarElements.snapshot,
},
SlotType.bottomBar: {
BottomBarElements.fullscreen,
},
}
Implementation
final Map<SlotType, Set<String>> hiddenSlotElements;