Linked Questions

Popular Questions

Flutter Gridview.builder will not scroll up

Asked by At

I'm trying to load a set of 20 gifs from the GIPHY api and I can't get all my gif's to load in my grid view. I can see the initial load, but the screen will not scroll and display the rest. Here is my code for downloading gif's and the GridView.builder I'm using...

 Future<void> giphy() async {
    var _searchterm = _searchController.text.toString().replaceAll(' ', '+');
    String url = giphy_api_url;

    var response = await http.get(url);
    Map data = json.decode(response.body);
    var gifs = new List();
    for (var items in data['data']) {
      var images = (items['images'] as Map);
      var downsized = (images['downsized'] as Map);
      var urls = downsized['url'].toString();
      await gifs.add(urls);
    }

    setState(() => giphyUrls = gifs);
    _neverSatisfied();
  }


child: new GridView.builder(
                    itemCount: giphyUrls.length,
                    scrollDirection: Axis.vertical,
                    gridDelegate:
                    new SliverGridDelegateWithFixedCrossAxisCount(
                        crossAxisCount: 3,
                        mainAxisSpacing: 2.0,
                        crossAxisSpacing: 2.0),
                    itemBuilder: (BuildContext context, int index) {
                      return new InkWell(
                        splashColor: Colors.blue,
                        onTap: () {
                          fb.child('messages').push().set({
                            'user': uid,
                            'name': userName == null ? "MYFAVKPOP" : userName,
                            'photo': userImage == null ? AssetImage('assests/logo500.jpeg') : userImage,
                            'bodyGif': giphyUrls[index].toString(),
                          });
                          Navigator.of(context).pop();
                          giphyUrls.clear();
                        },
                        child: new GridTile(
                          child: new CachedNetworkImage(
                            imageUrl: giphyUrls[index],
                            placeholder: new CircularProgressIndicator(
                              strokeWidth: 8.0,
                            ),
                            errorWidget: new Icon(Icons.error),
                          ),
                        ),
                      );
                    },
                  )

Here is the sets of error logs I'm getting...

I/FirebaseAuth( 2067): [FirebaseAuth:] Loading module via FirebaseOptions. I/FirebaseAuth( 2067): [FirebaseAuth:] Preparing to create service connection to gms implementation W/DynamiteModule( 2067): Local module descriptor class for com.google.firebase.auth not found. I/FirebaseAuth( 2067): [FirebaseAuth:] Loading module via FirebaseOptions. I/FirebaseAuth( 2067): [FirebaseAuth:] Preparing to create service connection to gms implementation I/FirebaseAuth( 2067): [FirebaseAuth:] Loading module via FirebaseOptions. I/FirebaseAuth( 2067): [FirebaseAuth:] Preparing to create service connection to gms implementation W/DynamiteModule( 2067): Local module descriptor class for com.google.firebase.auth not found. Lost connection to device.

Related Questions