Widget _buildBottomBarWidget()

in lib/aliplayer_widget.dart [266:307]


  Widget _buildBottomBarWidget() {
    // 拖动控制
    bool enableDrag = !_isSceneLive();
    // seek 控制
    bool enableSeek = !_isSceneLive();

    // 监听播放状态、当前播放位置、缓冲位置、总时长等
    Listenable listenable = Listenable.merge([
      _playController.playStateNotifier,
      _playController.currentPositionNotifier,
      _playController.bufferedPositionNotifier,
      _playController.totalDurationNotifier,
    ]);
    return ListenableBuilder(
      listenable: listenable,
      builder: (context, _) {
        // 获取播放状态
        final playState = _playController.playStateNotifier.value;
        // 获取当前播放位置、缓冲位置、总时长
        final currentPosition = _playController.currentPositionNotifier.value;
        final bufferedPosition = _playController.bufferedPositionNotifier.value;
        final totalDuration = _playController.totalDurationNotifier.value;
        return Positioned(
          bottom: 0,
          left: 0,
          right: 0,
          child: AliPlayerBottomBarWidget(
            animationManager: _animationManager,
            isPlaying: playState == FlutterAvpdef.started,
            currentPosition: currentPosition,
            bufferedPosition: bufferedPosition,
            totalDuration: totalDuration,
            onPlayIconPressed: _onPlayerViewTap,
            onFullScreenPressed: _onFullScreenPressed,
            onDragUpdate: enableDrag ? _onDragUpdate : null,
            onDragEnd: enableDrag ? _onDragEnd : null,
            onSeekEnd: enableSeek ? _onSeekEnd : null,
          ),
        );
      },
    );
  }