如何适应播放视频
我试图用视频制作一个容器,但是当然不能将完整视频放在尺寸容器中,我尝试适合,但甚至有错误,所以我尝试使用剪辑,这里是谁想要的解决方案:
如果有一个。使用合适盖的方式,有人???
带夹子的代码在这里:它可以正常工作:
ClipRect(
clipBehavior: Clip.hardEdge,
child: Container(
width: double.infinity, \\ another size
height: 400, \\another size
alignment: Alignment.center,
child: Transform.scale( scale: 2,
child: AspectRatio( aspectRatio: _controller!.value.aspectRatio,
child: VideoPlayer(_controller as VideoPlayerController)
),
),
),
),
i trying to make a container with a video but of course its not possible to put full video in a dimension container, i try with fit, but even have errors, so i try with clip, here the solution for who wants:
if have a way using fit cover, someone???
the code with clip it here: and it works fine:
ClipRect(
clipBehavior: Clip.hardEdge,
child: Container(
width: double.infinity, \\ another size
height: 400, \\another size
alignment: Alignment.center,
child: Transform.scale( scale: 2,
child: AspectRatio( aspectRatio: _controller!.value.aspectRatio,
child: VideoPlayer(_controller as VideoPlayerController)
),
),
),
),
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
尝试,为我工作
try it, worked for me
使用
fittedbox
窗口小部件,您可以调整任何子小部件大小以适合容器内:Using a
FittedBox
widget you can resize any child widget to fit inside the container: