gpt4 book ai didi

flutter - 无法用视频定位AndroidView

转载 作者:行者123 更新时间:2023-12-05 04:29:19 28 4
gpt4 key购买 nike

我正在使用 flutter 3.0.0

在我的应用程序中,我使用平台 View 显示原生视频。

视频正在播放,但一直显示在左上角,遮住了其他小部件,即使它们在堆栈中也是如此。

@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
// Here we take the value from the MyHomePage object that was created by
// the App.build method, and use it to set our appbar title.
title: Text(widget.title),
),
body: Stack(
children: [
Center(
child: ConstrainedBox(
constraints:
const BoxConstraints.expand(height: 200, width: 200),

// Center is a layout widget. It takes a single child and positions it
// in the middle of the parent.
child:
const AndroidView(viewType: 'remote-video'),
),
),
Row(
children: [
Padding(
padding: const EdgeInsets.all(8.0),
child: ElevatedButton(
onPressed: () {
MethodChannels.coreMethodChannel
.invokeMethod("load");
},
child: const Text('Invoke'),
),
),

],
),

],
),
);
}

这是我运行代码时的样子

enter image description here

如您所见,它显示在所有内容之上。

您能就如何解决这个问题提供一些建议吗?

最佳答案

截至 2022 年 7 月 31 日,这似乎是 flutter >= 3.0.0 中的一个错误。按照这个问题的解决方案 Flutter AndroidView Widget我降级到 2.10.5 然后它按预期工作。希望 Flutter 团队能尽快解决这个问题。

关于flutter - 无法用视频定位AndroidView,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/72358118/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com