import 'package:flutter/material.dart'; import 'package:flutter/rendering.dart'; import 'package:provider/provider.dart'; import 'package:teso/Classes/API%20Clasess/Post.dart'; import 'package:teso/Pages/Sub_Pages/Posts/ViewPost.dart'; import 'package:teso/providers/user_provider.dart'; class VideoList extends StatefulWidget { final List postedAd; VideoList({Key key, this.postedAd}) : super(key: key); @override _VideoListState createState() => _VideoListState(); } class _VideoListState extends State { @override void initState() { Provider.of(context, listen: false) .predownloadAds(widget.postedAd.map((e) => e.playbackID).toList()); super.initState(); } report(Post post) { Navigator.pop(context, post); Navigator.pop(context, post); } @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( automaticallyImplyLeading: true, backgroundColor: Colors.transparent, leading: InkWell( onTap: () => Navigator.pop(context), child: Container( height: 50, width: 40, margin: EdgeInsets.symmetric( vertical: 30.0, horizontal: 10, ), child: Icon( Icons.arrow_back_ios, color: Colors.white, ), ), ), ), extendBodyBehindAppBar: true, body: PageView( scrollDirection: Axis.vertical, children: List.generate( widget.postedAd.length > 10 ? 10 : widget.postedAd.length, (index) => new ViewPost( play: true, postedAd: widget.postedAd[index], report: report, )), ), ); } }