buildTopBarSlot function
构建顶部栏插槽的默认实现。 Builds the default top bar slot content.
监听视频标题,提供返回、设置、下载、截图等功能按钮。 Listens to video title; provides back, settings, download, and snapshot buttons.
Implementation
Widget buildTopBarSlot(
SlotBuildContext ctx,
double width,
double height,
) {
return ListenableBuilder(
listenable: ctx.controller.videoTitleNotifier,
builder: (context, _) {
return TopBarWidget(
title: ctx.controller.videoTitleNotifier.value ?? "",
animationManager: ctx.animationManager,
onBackPressed: ctx.onBackPress,
onSettingsPressed: () {
// 统一通过 controller 的事件计数器触发
ctx.controller.requestSettingPanel();
},
downloadVisible: _isDownloadVisible(ctx.controller),
// 下载按钮点击处理
onDownloadPressed: ctx.controller.startVideoDownload,
// 启用截图功能
onSnapshotPressed: () => _onSnapshotPressed(ctx.controller),
);
},
);
}