build method

  1. @override
Widget build(
  1. BuildContext context
)
override

构建播放器视图

Builds the main player view.

Implementation

@override
Widget build(BuildContext context) {
  // 监听语言变化,确保 UI 响应系统语言切换
  return ValueListenableBuilder<Locale>(
    valueListenable: PlayerI18n.localeNotifier,
    builder: (context, locale, _) {
      return PlayerAssetsScope(
        assetsPath: widget.assetsPath,
        child: PopScope(
          onPopInvoked: (bool didPop) {
            if (didPop) return; // 如果已经处理了返回操作,则直接返回
            _handleBackPress();
          },
          child: _buildContentBody(),
        ),
      );
    },
  );
}