Flutter 颤振:Chuie在Listview中使用
我有一个json数据。json数据包含一个lof视频链接。例如:Flutter 颤振:Chuie在Listview中使用,flutter,flutter-video-player,Flutter,Flutter Video Player,我有一个json数据。json数据包含一个lof视频链接。例如: [{"id": 12, "name": "bryn", "link":"https://www.xxxxx.com/videos/asdasfrlşr.mp4"},{"id": 13, "name": "brynas", "link":"htt
[{"id": 12, "name": "bryn", "link":"https://www.xxxxx.com/videos/asdasfrlşr.mp4"},{"id": 13, "name": "brynas", "link":"https://www.xxxxx.com/videos/fgfasfrlşr.mp4"},{"id": 14, "name": "e3bryn", "link":"https://www.xxxxx.com/videos/asdasfthvbvbr.mp4"}]
我使用丘伊视频播放器。我可以列出这些视频并观看。但我关闭了那一页。视频没有关闭。视频播放背景。我的代码如下
VideoPlayerController _videoPlayerController1;
ChewieController _chewieController;
@override
void initState() {
super.initState();
_videoPlayerController1 = VideoPlayerController.network(
products[index]["link"]);
_chewieController = ChewieController(
videoPlayerController: _videoPlayerController1,
aspectRatio: 16 / 9,
autoPlay: true,
looping: true,
// Try playing around with some of these other options:
// showControls: false,
// materialProgressColors: ChewieProgressColors(
// playedColor: Colors.red,
// handleColor: Colors.blue,
// backgroundColor: Colors.grey,
// bufferedColor: Colors.lightGreen,
// ),
// placeholder: Container(
// color: Colors.grey,
// ),
// autoInitialize: true,
);
}
@override
void dispose() {
_videoPlayerController.dispose();
_chewieController.dispose();
super.dispose();
}
ListView.builder(
itemCount: products == null ? 0 : products.length,
itemBuilder: (BuildContext asd, int index) => Container(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Padding(
padding: const EdgeInsets.all(8.0),
child: RichText(
text: TextSpan(
children: [
TextSpan(
text: products[index]["yazi"],
style: TextStyle(
fontSize: 16,
color: localStorage.mainColor,
fontWeight: FontWeight.bold)),
],
),
),
),
products[index]["link"] == "" ? Text("Video did not found !",
style: TextStyle(
color: localStorage.mainColor,
fontSize: 18,
fontWeight: FontWeight.bold),
) : Chewie(controller: _chewieController),
SizedBox(height: 10),])))
我怎样才能解决这个问题。谢谢。也许你应该正确地命名它们。您正在关闭
\u videoPlayerController
但将\u videoPlayerController 1
设置为videoPlayerController
是的,我看到了。但这个问题并没有解决