I have been trying to put several videos across a vertical scroll view inside a list view....in a card ..... i would like to view several videos in a vertical scroll able view. As the image below looks. I created a sliver with a flexible appbar and then added the video in the background as you can see,now i wanted to do the same with the vertical scroll view with cards inside,but its quite challenging i have tried the Expanded option not the sized box but still its not able to bring about the video....my code,as you can see i have put one video from another page as 'VideoPlayerApp' and the other i wanted to use video controller, thank you. '
import 'package:flutter/material.dart';
import 'package:flutter/semantics.dart';
import 'package:restored/home/home/myflexiableappbar.dart';
import 'package:restored/home/home/myappbar.dart';
import 'package:restored/Videos/butterfly.dart';
import 'package:video_player/video_player.dart';
class MainForm extends StatefulWidget {
@override
_MainFormState createState() => _MainFormState();
}
class _MainFormState extends State<MainForm> {
VideoPlayerController _controller;
Future<void> _initializeVideoPlayerFuture;
@override
void initState() {
_controller = VideoPlayerController.network(
'https://flutter.github.io/assets-for-api-docs/assets/videos/butterfly.mp4',
);
// Initielize the controller and store the Future for later use.
_initializeVideoPlayerFuture = _controller.initialize();
// Use the controller to loop the video.
_controller.setLooping(true);
super.initState();
}
@override
void dispose() {
// Ensure disposing of the VideoPlayerController to free up resources.
_controller.dispose();
super.dispose();
}
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.red,
body: CustomScrollView(
slivers: <Widget>[
SliverAppBar(
title: MyAppBar(),
pinned: true,
expandedHeight: 210,
flexibleSpace: FlexibleSpaceBar(
background: VideoPlayerApp(),
),
),
SliverList(
delegate: SliverChildListDelegate(<Widget>[
Container(
margin: EdgeInsets.symmetric(vertical: 20.0),
height: 300,
child: ListView(
scrollDirection: Axis.horizontal,
children: <Widget>[
Container(
width: 300.0,
child: Card(
child: Wrap(
children: <Widget>[
VideoPlayer(_controller),
],
),
),
),
Container(
width: 300.0,
child: Card(
color: Colors.green,
child: Wrap(
children: <Widget>[
Expanded(
child: VideoPlayerApp(),
)
],
),
),
)
],
),
),
]),
)
],
),
);
}
}