我试过了FittedBox,也用 包裹了所有这些ConstrainedBox,但没有一个起作用。可能是我漏掉了一点。
问题也在:https : //github.com/flutter/flutter/issues/31911
这里的代码:
@override
Widget build(BuildContext context) {
return Stack(
children: <Widget>[
FittedBox(
fit: BoxFit.cover,
child: AspectRatio(
aspectRatio: _aspectRatio,
child: VideoPlayer(_playerController),
),
),
_buildText(),
],
);
}
Run Code Online (Sandbox Code Playgroud)
我想要的很简单,我想Stack在保留原始纵横比的同时全屏显示视频,我也想像BoxFit.cover.
错误日志:
I/flutter (11919): ??? EXCEPTION CAUGHT BY RENDERING LIBRARY ??????????????????????????????????????????????????????????
I/flutter (11919): The following assertion was thrown during performLayout():
I/flutter (11919): RenderAspectRatio has unbounded constraints.
I/flutter (11919): This RenderAspectRatio was given an aspect ratio of 0.5602409638554217 but was given both …Run Code Online (Sandbox Code Playgroud) 到目前为止,我一直在四处奔波,我很喜欢它,但是我有一个问题让相机正常工作.
我按照此页面上的说明https://pub.dartlang.org/packages/camera进行操作.但是,相机被拉伸以适应手机屏幕,但图像翘曲并且比应有的高.其他使用相机的应用程序似乎保持比例,有没有办法确保它不会拉伸但仍然填满屏幕?