我正在 Flutter 中开发一个应用程序,我正在使用 preloadpageview 和缓存的视频播放器插件通过我的数据库中的 url 播放视频,在播放 15 到 20 个视频后,我的应用程序正在关闭并且 logcat 提示这样的错误。我正在 initstate 中初始化视频并处理视频小部件。
视频小部件代码:
@override
void initState() {
super.initState();
controller = CachedVideoPlayerController.network(mediaUrl);
_initializeVideoPlayerFuture = controller.initialize();
controller.setLooping(true);
}
buildvideopreview(){
return FutureBuilder(
future: _initializeVideoPlayerFuture,
builder: (context, snapshot) {
if (snapshot.connectionState == ConnectionState.done) {
return Stack(fit: StackFit.expand,
children: <Widget>[
AspectRatio(
aspectRatio: controller.value.aspectRatio,
child: VisibilityDetector(
key: Key(postId),
onVisibilityChanged: (VisibilityInfo info){
print("${info.visibleFraction} of my widget is visible");
if(info.visibleFraction == 1 && controller != null){
print('===========playing');
controller.play();
}
else{
print('============pause');
controller.pause();
}
},
child: …Run Code Online (Sandbox Code Playgroud) 我正在尝试更改 Web 应用程序所有页面的默认屏幕背景颜色。
我使用的技术:
我想将所有页面的屏幕背景颜色设置为如图所示的浅灰色,而不是默认的白色。
有没有办法一次性完成所有这些,或者我们需要手动为每个页面添加背景颜色?