toggleFullscreen method
切换全屏状态
根据当前是否全屏来进入或退出全屏模式。 这是一个便捷方法,内部会自动判断当前状态并调用相应的方法。
Toggle fullscreen state.
Automatically enters or exits fullscreen mode based on current state. This is a convenience method that internally determines the current state and calls the appropriate method.
参数:
slotBuilders:插槽构建器映射,用于在全屏模式下自定义插槽内容。 如果不提供,将使用空配置。hiddenSlotElements:隐藏插槽元素配置,用于在全屏模式下隐藏特定插槽内的 UI 元素。 如果不提供,将使用空配置。
Parameters:
slotBuilders: Slot builder map for customizing slot content in fullscreen mode. If not provided, empty configuration will be used.hiddenSlotElements: Hidden slot elements configuration for hiding specific UI elements within slots in fullscreen mode. If not provided, empty configuration will be used.
Implementation
Future<void> toggleFullscreen({
Map<SlotType, Function?>? slotBuilders,
Map<SlotType, Set<String>>? hiddenSlotElements,
}) async {
if (FullScreenUtil.isFullScreen()) {
await exitFullScreen();
} else {
final position = await getCurrentPosition();
await enterFullScreen(
this,
position,
slotBuilders: slotBuilders,
hiddenSlotElements: hiddenSlotElements,
);
}
}