admin管理员组文章数量:1026939
SizedBox(
height: context.height,
width: context.width,
child: FittedBox(
fit: BoxFit.cover,
child: SizedBox(
height: context.height,
width: context.width,
child: VideoPlayer(videoC.value!))),
I have this and it does not fit the box but just squeeze the video into fit in that height and width. How can I make it cover the Sizedbox?
SizedBox(
height: context.height,
width: context.width,
child: FittedBox(
fit: BoxFit.cover,
child: SizedBox(
height: context.height,
width: context.width,
child: VideoPlayer(videoC.value!))),
I have this and it does not fit the box but just squeeze the video into fit in that height and width. How can I make it cover the Sizedbox?
Share Improve this question asked Nov 16, 2024 at 15:32 chichichichi 3,3187 gold badges37 silver badges74 bronze badges 3 |1 Answer
Reset to default 1Does this work for you with the video_player
plugin?
SizedBox.expand(
child: FittedBox(
fit: BoxFit.cover,
child: ListenableBuilder(
listenable: _videoController,
builder: (context, _) => SizedBox(
width: _videoController.value.size?.width ?? 0,
height: _videoController.value.size?.height ?? 0,
child: VideoPlayer(_videoController),
),
),
),
),
SizedBox(
height: context.height,
width: context.width,
child: FittedBox(
fit: BoxFit.cover,
child: SizedBox(
height: context.height,
width: context.width,
child: VideoPlayer(videoC.value!))),
I have this and it does not fit the box but just squeeze the video into fit in that height and width. How can I make it cover the Sizedbox?
SizedBox(
height: context.height,
width: context.width,
child: FittedBox(
fit: BoxFit.cover,
child: SizedBox(
height: context.height,
width: context.width,
child: VideoPlayer(videoC.value!))),
I have this and it does not fit the box but just squeeze the video into fit in that height and width. How can I make it cover the Sizedbox?
Share Improve this question asked Nov 16, 2024 at 15:32 chichichichi 3,3187 gold badges37 silver badges74 bronze badges 3-
1
its no point in using
FittedBox
if both parent and child of it have the same size, are you sure you pasted the correct code? – pskink Commented Nov 16, 2024 at 15:45 - Yeah that is what I have. if I don't have one of them then it did not work – chichi Commented Nov 16, 2024 at 22:43
-
1
chek the below answer: here
FittedBox
expands to the available space while its child (withVideoPlayer
) takes the size of the asset you are showing - this is the case whereFittedBox
can scale its child – pskink Commented Nov 17, 2024 at 7:40
1 Answer
Reset to default 1Does this work for you with the video_player
plugin?
SizedBox.expand(
child: FittedBox(
fit: BoxFit.cover,
child: ListenableBuilder(
listenable: _videoController,
builder: (context, _) => SizedBox(
width: _videoController.value.size?.width ?? 0,
height: _videoController.value.size?.height ?? 0,
child: VideoPlayer(_videoController),
),
),
),
),
本文标签: Flutter BoxFixcover does not cover but stretch the videoStack Overflow
版权声明:本文标题:Flutter BoxFix.cover does not cover but stretch the video - Stack Overflow 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://it.en369.cn/questions/1745654601a2161522.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
FittedBox
if both parent and child of it have the same size, are you sure you pasted the correct code? – pskink Commented Nov 16, 2024 at 15:45FittedBox
expands to the available space while its child (withVideoPlayer
) takes the size of the asset you are showing - this is the case whereFittedBox
can scale its child – pskink Commented Nov 17, 2024 at 7:40