我正在尝试使用插件在 flutter 应用程序中播放vimeo 视频,video_player但没有成功,它抛出了一堆错误。请帮助我如何在颤振应用程序中实现这一点?使用 webview 或任何插件等?也许代码片段对我有很大帮助!
这是我的代码片段
import 'package:video_player/video_player.dart';
import 'package:flutter/material.dart';
void main() => runApp(VideoApp());
class VideoApp extends StatefulWidget {
@override
_VideoAppState createState() => _VideoAppState();
}
class _VideoAppState extends State<VideoApp> {
VideoPlayerController _controller;
@override
void initState() {
super.initState();
_controller = VideoPlayerController.network(
'https://vimeo.com/{some-video-id}')
..initialize().then((_) {
// Ensure the first frame is shown after the video is initialized, even before the play button has been pressed.
setState(() {});
});
}
@override
Widget build(BuildContext context) {
return …Run Code Online (Sandbox Code Playgroud) 目前,在我的应用程序的主屏幕中,我有一个firebase_animated_list创建列表视图的小部件。但是,我想在 GridView 中显示这些项目,因为它看起来会更好。
这是我的代码片段。
body: Column(
children: <Widget>[
Flexible(
child: FirebaseAnimatedList(
query: firebaseRef,
itemBuilder: (BuildContext context, DataSnapshot snapshot,
Animation<double> animation, int index) {
return InkWell(
child: ListTile(
contentPadding: EdgeInsets.all(7),
title: Text(mynode[index].key),
leading: CircleAvatar(
radius: 30,
child: FittedBox(
child: Text(mynode[index].id),
),
),
trailing: Icon(Icons.play_arrow),
onTap: () => Navigator.of(context).push(
MaterialPageRoute(
builder: (context) => DemoDb(
id: othernode[index].id,
),
),
),
),
);
},
),
),
],
),
Run Code Online (Sandbox Code Playgroud)
这完美地创建了一个项目列表,但是我应该如何将其更改为 GridView?我尝试使用GridView.count代替ListTile小部件。但因为它嵌套在 中firebase_animated_list,所以每个网格都布置在这个动画列表中。
有没有任何插件或库可以帮助我做到这一点?也许是一个代码片段或者如果有人可以建议我任何更好的方法来实现这一目标,这对我来说意味着世界。
谢谢。