in lib/aliplayer_widget.dart [91:135]
Widget _buildContentBody() {
// 根据视频尺寸计算渲染尺寸
return ValueListenableBuilder(
valueListenable: _playController.videoSizeNotifier,
builder: (context, videoSize, __) {
// 如果视频尺寸为空,则不渲染
if (videoSize == Size.zero) {
return const SizedBox.shrink();
}
// 调用工具类计算渲染尺寸
Size playerViewSize = ScreenUtil.calculateRenderSize(
context,
videoSize: videoSize,
isFullScreenMode: FullScreenUtil.isFullScreen(),
);
logi("[build]: videoSize: $videoSize, playerViewSize: $playerViewSize");
final double width = playerViewSize.width;
final double height = playerViewSize.height;
return ConstrainedBox(
constraints: BoxConstraints.tight(playerViewSize),
child: Stack(
children: [
_buildPlaySurfaceView(width, height),
if (_playController._widgetData?.coverUrl.isNotEmpty ?? false)
_buildPlayCoverView(width, height),
_buildPlayControlView(),
_buildTopBarWidget(),
_buildBottomBarWidget(),
if (isNotScene(_playController._widgetData, SceneType.live))
_buildSeekThumbnailWidget(),
_buildCenterDisplayWidget(),
_buildPlayStateView(),
// 添加浮层
..._buildOverlays(),
_buildSettingMenuPanel(),
],
),
);
},
);
}