0

How to show loader before loading complete image from file? Before loading image in Imageview it takes some time before image is visible to user.

Image.file(
  File(selectedImagePath),
  width: double.infinity,
  height: double.infinity,
 ),
2
  • use Image constructor instead of Image.file - it has ImageLoadingBuilder? loadingBuilder, parameter Commented Oct 28, 2021 at 6:22
  • @pskink If you any example to refer then please share link or code snippet. Commented Oct 28, 2021 at 6:35

1 Answer 1

1

As suggested by @pskink You can use Image constructor

Image(
      image: FileImage(
      File(selectedImagePath)),
         width: double.infinity,
         height: double.infinity,
         loadingBuilder:
             (context, child, loadingProgress) {
             if (loadingProgress == null) {
                 debugPrint('image loading null');
                 return child;
             }
             debugPrint('image loading...');
             return const Center(
             child: CircularProgressIndicator());
          },
       ),
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.