Advertisement
Guest User

Untitled

a guest
Jun 18th, 2019
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.34 KB | None | 0 0
  1. class RespondedVideos extends StatefulWidget{
  2.  
  3. var slug;
  4. RespondedVideos({Key key,@required this.slug}) : super(key: key);
  5.  
  6. @override
  7. respondedVideosState createState() => respondedVideosState();
  8.  
  9. }
  10.  
  11. class respondedVideosState extends State<RespondedVideos> {
  12.  
  13. VideoPlayerController _controller;
  14. List data = new List();
  15. var respondercookie;
  16. String video_url = "";
  17.  
  18. @override
  19. void initState() {
  20. super.initState();
  21. readCookie();
  22. }
  23.  
  24. @override
  25. Widget build(BuildContext context) {
  26. return Column(
  27. children: <Widget>[
  28. Flexible(
  29. flex: 1,
  30. child:Container(
  31. height: 100,
  32. child: Card(
  33. margin: EdgeInsets.fromLTRB(3.0, 60.0, 3.0, 0.0),
  34. color: Colors.blueAccent,
  35. child: Column(
  36. children: <Widget>[
  37. Row(
  38. children: <Widget>[
  39. Text("Feedback: ")
  40. ],
  41. ),
  42. Row(
  43. children: <Widget>[
  44. Text("Status: ")
  45. //+data[position].name,style:TextStyle(color: Colors.blueAccent)
  46. ],
  47. )
  48. ]
  49. ),
  50. ),
  51.  
  52. )
  53. ),
  54. SizedBox(height: 10),
  55. Flexible(
  56. flex: 2,
  57. child:Container(
  58. height: 1000,
  59. child: StreamBuilder(
  60. builder: (context, snapshot) {
  61. if (!snapshot.hasData) {
  62. return Center(
  63. child: CircularProgressIndicator(
  64. valueColor: AlwaysStoppedAnimation<Color>(Colors.tealAccent),
  65. ),
  66. );
  67. } else {
  68. return ListView.builder(
  69. shrinkWrap: true,
  70. scrollDirection: Axis.horizontal,
  71. padding: EdgeInsets.fromLTRB(10.0, 0.0, 10.0, 0.0),
  72. itemCount: snapshot.data.length,
  73. itemBuilder: (BuildContext context, int position) {
  74. if(data[position]["source_url"] != null)
  75. video_url = data[position]["source_url"];
  76. _controller = VideoPlayerController.network(video_url
  77. )
  78. ..initialize().then((_) {
  79. setState(() {});
  80. });
  81. _controller.setVolume(30.0);
  82. return new Container(
  83. child: Center(
  84. child: Card(
  85. child: Container(
  86. width: 230.0,
  87. child: Column(
  88. // mainAxisAlignment: MainAxisAlignment.spaceEvenly,
  89. children: <Widget>[
  90. Stack(
  91. children: <Widget>[
  92. Container(
  93. child: _controller.value.initialized
  94. ? AspectRatio(
  95. aspectRatio: _controller.value.aspectRatio,
  96. child: VideoPlayer(_controller),
  97.  
  98. )
  99. : Container(),
  100. ),
  101.  
  102. Column(
  103. children: <Widget>[
  104. Padding(padding: new EdgeInsets.symmetric(
  105. vertical: 80.0, horizontal: 160.0)),
  106. RaisedButton(
  107. color: Colors.transparent,
  108. onPressed: () {
  109. setState(() {
  110. _controller.value.isPlaying
  111. ? _controller.pause()
  112. : _controller.play();
  113. });
  114. },
  115. child: Icon(
  116. _controller.value.isPlaying
  117. ? Icons.pause
  118. : Icons.play_arrow,
  119. color: Colors.blueAccent,
  120. ),
  121. ),
  122. ],
  123. ),
  124. ],
  125. ),
  126.  
  127. ],
  128. ),
  129. ),
  130. ),
  131. )
  132. );
  133. }
  134. );
  135. }
  136. }
  137. )
  138. )
  139. ),
  140.  
  141. ],
  142. );
  143.  
  144. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement