In order to achieve full-screen video playback without leaving black borders or stretching:
At the beginning, I tried to use the following code for adaptation, but an error was reported directly. VideoPlayer belongs to Texture and cannot be directly wrapped under FittedBox. It is necessary to nest a layer of controls with clear width and height for VideoPlayer.
FittedBox(
fit: BoxFit.cover,
child: VideoPlayer(controller: _playerControler.getMainController()),
),
Finally, I refer to: Flutter videoplayer adaptation_kgdtl's blog-CSDN blog
Center(
child: SizedBox.expand(
child: FittedBox(
fit: BoxFit.cover,
child: SizedBox(
height: 16,
width: 9,
child: VideoPlayer(player.controller)),
)
));