3

So i'm trying to load close to a thousand gifs on Inkwell widgets with a Hero child in a boxdecoration imagenetwork, i want to understand the best practice to handle this, as it takes long times to load, i want it to load by the first one to appear, whether it's normal or by filtering, so how do flutter devs handle this ?

So how do i support slow internet users by deciding which NetworkImage to load first

      InkWell(
      onTap: (){
        Navigator.push(context, MaterialPageRoute(builder:(context)=>GifDetail(
          gifs: gifs,
        )));
      },
      child: Hero(
        tag: gifs.url,
        child: Card(
          child: Column(
            mainAxisAlignment: MainAxisAlignment.spaceEvenly,
            children: <Widget>[
              Container(
                height: 110,
                width: 110,
                decoration: BoxDecoration(
                  image: DecorationImage(image: NetworkImage(gifs.url))
                ),
              ),
            ],
          ),
        ),
      ),
    ),

1 Answer 1

6

You could try using Cached_network_image package. It will still take the same time to load images initially but then the images are retained on the device so will load a lot quicker the next time. There is really no way of getting around the initial download of the image.

Loading via a ListView.builder or GridView.builder will only load the images in the initial view until you scroll, so should also help.

0

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.