1

2020欧洲杯时间表I have my GRidView builder and I have my future and my ScrollController, why my gridView clear when scrollController is equal than mi maxScroll and obtain more information? It's supposed to show all of it, not the latest information. this is my code

future: _future ,
          builder: (BuildContext context, AsyncSnapshot snapshot) {   
            if(snapshot.hasData){            
              List<dynamic> loaded = snapshot.data;    
              return 
                Container(
                  width: double.infinity,
                  height: _screenSize.height * .8,
                  child:  GridView.builder(                        
                   gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
                     crossAxisCount: 3,
                     childAspectRatio:  MediaQuery.of(context).size.width /(MediaQuery.of(context).size.height /1.5),),
                    controller: _controller,     
                    itemCount: loaded.length,
                    itemBuilder: (context, i){
                      return _row(context,loaded,i); 
                    },                        
                  )
                );
            }else{

and the constructor

Future<List> _future;
ScrollController _controller = ScrollController(initialScrollOffset: 0.0, keepScrollOffset: true);
  _SearchPageState(){
  _controller.addListener(() {
  if(_controller.position.pixels >= _controller.position.maxScrollExtent-30 ){
    setState(() {
      _future = videoJuegos.getPaginationPopular();

    });
  }     
});    
_future = videoJuegos.getPaginationPopular();
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.