Код: Выделить всё
Future _pickVideo() async {
final XFile? video = await _picker.pickVideo(source: ImageSource.gallery);
if (video != null){
_videoFile = File(video!.path);
_videoController = VideoPlayerController.file(_videoFile!)..initialize().then((_) {
setState(() {
});
_videoController?.play();
});
}
Код: Выделить всё
@override
Widget build(BuildContext context) {
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
ElevatedButton(
onPressed: _pickVideo,
child: const Text('Choose Video'),
),
const SizedBox(height: 20),
if (_videoFile != null)
_videoController!.value.isInitialized ? AspectRatio(
aspectRatio: _videoController!.value.aspectRatio,
child: VideoPlayer(_videoController!),
) : Container()
else
const Text("Click on pick video to selecte video"),
Я пытался повернуть
Код: Выделить всё
child: Transform.rotate(
angle: 3.14159 / 2,
child: VideoPlayer(_videoController!),
),
Подробнее здесь: https://stackoverflow.com/questions/790 ... d-stretche
Мобильная версия