黒い境界線を残したり引き伸ばしたりすることなく全画面でビデオを再生するには、次の手順を実行します。
当初、以下のコードを適用しようとしましたが、直接エラーが報告されました。VideoPlayer はTexture に属しており、FittedBox の下に直接ラップすることはできません。VideoPlayer の幅と高さが明確なコントロールのレイヤーをネストする必要があります。
FittedBox(
fit: BoxFit.cover,
child: VideoPlayer(controller: _playerControler.getMainController()),
),
最後に、Flutter videoplayeradaptation_kgdtl のブログ - CSDN ブログを参照しました。
Center(
child: SizedBox.expand(
child: FittedBox(
fit: BoxFit.cover,
child: SizedBox(
height: 16,
width: 9,
child: VideoPlayer(player.controller)),
)
));