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

Show Loading Widget while the images are loading #9

Closed
AryashDubey opened this issue Jun 7, 2021 · 2 comments
Closed

Show Loading Widget while the images are loading #9

AryashDubey opened this issue Jun 7, 2021 · 2 comments

Comments

@AryashDubey
Copy link

Hey man your package is amazing! Thanks! But can you tell me how to show a loading widget when the images are loading. I am using flutter web!

@ChrisChV
Copy link
Member

ChrisChV commented Jun 9, 2021

Hi! @AryashDubey
PCacheImage() is an ImageProvider. Currently the package does not have the functionality of placing a widget as a placeholder. But you can use an Stack and FadeInImage:

import 'package:flutter/material.dart';
import 'package:transparent_image/transparent_image.dart';

void main() {
  runApp(MyApp());
}

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    final title = 'Fade in images';

    return MaterialApp(
      title: title,
      home: Scaffold(
        appBar: AppBar(
          title: Text(title),
        ),
        body: Stack(
          children: <Widget>[
            Center(child: CircularProgressIndicator()),
            Center(
              child: FadeInImage(
                placeholder: kTransparentImage,
                image: PCacheImage(
                      'https://picsum.photos/250?image=9',
                )
              ),
            ),
          ],
        ),
      ),
    );
  }
}

But the idea of ​​implementing this functionality in the package is interesting.

@AryashDubey
Copy link
Author

Yeah man thank you for the solution but it would be great to add this in the package! Again thanks for this wonderful package!!!

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

2 participants