buildContent method

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

子类需要实现的方法:构建主体内容

Implementation

@override
Widget buildContent(BuildContext context) {
  return Container(
    height: kBottomNavigationBarHeight,
    color: Colors.black.withOpacity(0.3),
    child: Row(
      mainAxisAlignment: MainAxisAlignment.spaceEvenly,
      children: [
        // 左边:播放/暂停按钮
        IconButton(
          icon: Icon(
            isPlaying ? Icons.pause : Icons.play_arrow,
            color: Colors.white,
            size: 30,
          ),
          onPressed: onPlayIconPressed,
        ),

        // 中间:自定义进度条组件
        Expanded(
          child: Padding(
            padding: const EdgeInsets.symmetric(horizontal: 8.0),
            child: AliPlayerVideoSlider(
              currentPosition: currentPosition,
              totalDuration: totalDuration,
              bufferedPosition: bufferedPosition,
              onDragUpdate: onDragUpdate,
              onDragEnd: onDragEnd,
              onSeekEnd: onSeekEnd,
            ),
          ),
        ),

        // 右边:全屏切换按钮
        IconButton(
          icon: const Icon(
            Icons.fullscreen,
            color: Colors.white,
            size: 30,
          ),
          onPressed: onFullScreenPressed,
        ),
      ],
    ),
  );
}