Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class RespondedVideos extends StatefulWidget{
- var slug;
- RespondedVideos({Key key,@required this.slug}) : super(key: key);
- @override
- respondedVideosState createState() => respondedVideosState();
- }
- class respondedVideosState extends State<RespondedVideos> {
- VideoPlayerController _controller;
- List data = new List();
- var respondercookie;
- String video_url = "";
- @override
- void initState() {
- super.initState();
- readCookie();
- }
- @override
- Widget build(BuildContext context) {
- return Column(
- children: <Widget>[
- Flexible(
- flex: 1,
- child:Container(
- height: 100,
- child: Card(
- margin: EdgeInsets.fromLTRB(3.0, 60.0, 3.0, 0.0),
- color: Colors.blueAccent,
- child: Column(
- children: <Widget>[
- Row(
- children: <Widget>[
- Text("Feedback: ")
- ],
- ),
- Row(
- children: <Widget>[
- Text("Status: ")
- //+data[position].name,style:TextStyle(color: Colors.blueAccent)
- ],
- )
- ]
- ),
- ),
- )
- ),
- SizedBox(height: 10),
- Flexible(
- flex: 2,
- child:Container(
- height: 1000,
- child: StreamBuilder(
- builder: (context, snapshot) {
- if (!snapshot.hasData) {
- return Center(
- child: CircularProgressIndicator(
- valueColor: AlwaysStoppedAnimation<Color>(Colors.tealAccent),
- ),
- );
- } else {
- return ListView.builder(
- shrinkWrap: true,
- scrollDirection: Axis.horizontal,
- padding: EdgeInsets.fromLTRB(10.0, 0.0, 10.0, 0.0),
- itemCount: snapshot.data.length,
- itemBuilder: (BuildContext context, int position) {
- if(data[position]["source_url"] != null)
- video_url = data[position]["source_url"];
- _controller = VideoPlayerController.network(video_url
- )
- ..initialize().then((_) {
- setState(() {});
- });
- _controller.setVolume(30.0);
- return new Container(
- child: Center(
- child: Card(
- child: Container(
- width: 230.0,
- child: Column(
- // mainAxisAlignment: MainAxisAlignment.spaceEvenly,
- children: <Widget>[
- Stack(
- children: <Widget>[
- Container(
- child: _controller.value.initialized
- ? AspectRatio(
- aspectRatio: _controller.value.aspectRatio,
- child: VideoPlayer(_controller),
- )
- : Container(),
- ),
- Column(
- children: <Widget>[
- Padding(padding: new EdgeInsets.symmetric(
- vertical: 80.0, horizontal: 160.0)),
- RaisedButton(
- color: Colors.transparent,
- onPressed: () {
- setState(() {
- _controller.value.isPlaying
- ? _controller.pause()
- : _controller.play();
- });
- },
- child: Icon(
- _controller.value.isPlaying
- ? Icons.pause
- : Icons.play_arrow,
- color: Colors.blueAccent,
- ),
- ),
- ],
- ),
- ],
- ),
- ],
- ),
- ),
- ),
- )
- );
- }
- );
- }
- }
- )
- )
- ),
- ],
- );
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement