Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide a child parameter in progressIndicatorBuilder #955

Open
jiyingzhi opened this issue Jun 20, 2024 · 0 comments
Open

Provide a child parameter in progressIndicatorBuilder #955

jiyingzhi opened this issue Jun 20, 2024 · 0 comments

Comments

@jiyingzhi
Copy link

What if I only want to display the placeholder when the image is loaded from the network, and display it if the image is already cached? It seems like you should provide a child parameter, just like the loadingBuilder parameter for the Image widget.

Image.network(
        'https://flutter.github.io/assets-for-api-docs/assets/widgets/falcon.jpg',
        loadingBuilder: (BuildContext context, Widget child,
            ImageChunkEvent? loadingProgress) {
          if (loadingProgress == null) {
            return child;
          }
          return Center(
            child: CircularProgressIndicator(
              value: loadingProgress.expectedTotalBytes != null
                  ? loadingProgress.cumulativeBytesLoaded /
                      loadingProgress.expectedTotalBytes!
                  : null,
            ),
          );
        },
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant