Skip to main content

Posts

Showing posts from March, 2021

Part 2: Getting network images to appear faster

 Since it takes a little bit of time for the list to load as it is fetching the network image I will use a modal progress hud so that the user knows that work is happening in the background and they should hang tight. The body part of the Scaffold needs to be wrapped in the widget ModelProgressHUD( ).  body: ModalProgressHUD ( inAsyncCall: loading, child: Column ( Model Progress Hud has a parameter called inAsyncCall. For that, you would give it the variable that you will toggle between true and false to display the progress hud or dismiss it. My variable is called loading. In the beginning, when I declare the variable I set it to false.   I believe that circularProgressHud is the default progress hud of ModalProgressHUD( ). So to get the circle to appear when I tap to open a list I will add a setState function to the onPressed and make the loading variable equal to true. Then to dismiss the circle I will use setState again but after the Navigator.push and make the loading variable

Getting network images to appear faster in flutter app

This post is about how I got network images to appear faster in my Flutter app. In part 1 I detail all the things I tried to make this work. In part 2 I share what finally worked to solve this issue.  The goal In my Shopping List App I allow my users to customize the background picture for their list.  I want the background image that my users choose to persist no matter what device they are using to access their shopping list. The problem Originally the user's image choice was saved via Shared Preferences which saves the name and location of their background image on their device. But if they were to log into their account using another device their background image would default to the default image instead of their chosen image.  To fix that I stopped using Shared Preferences and instead used Firebase Firestore to remember the name of the last image they chose. Then I wanted to save their custom uploaded images into Firebase cloud storage instead of on the device this way they c