flutter_pravatar 0.5.0 copy "flutter_pravatar: ^0.5.0" to clipboard
flutter_pravatar: ^0.5.0 copied to clipboard

Display placeholder profile pictures for mocked users. Based on pravatar.cc.

flutter_pravatar #

Display placeholder profile pictures from pravatar.cc/ for mocked users.

Usage #

Random #

Display a a random placholder avatar, different each time it is loaded.

@override
Widget build(BuildContext context) {
  return Pravatar.random(),
}

Unique identifier #

Display the placholder avatar associated to the given uniqueId.

The avatar is guaranteed to be always the same as soon as the provided uniqueId is the same.

@override
Widget build(BuildContext context) {
  return Pravatar.uniqueId('user10@email.com'),
}

Image identifier #

Display the placholder avatar from its imageId.

All identifiers are available on the website.

@override
Widget build(BuildContext context) {
  return Pravatar.imageId(27),
}

Image provider #

If you want to use the image provider manually, you can use [PravatarImage].

@override
Widget build(BuildContext context) {
    final devicePixelRatio = MediaQuery.of(context).devicePixelRatio;
    return Image(
        image: PravatarImage(
            size: devicePixelRatio * 100,
            uniqueId: 'user10@email.com',
        ),
    );
}
1
likes
90
points
23
downloads

Publisher

verified publisheraloisdeniel.com

Weekly Downloads

Display placeholder profile pictures for mocked users. Based on pravatar.cc.

Homepage

Documentation

API reference

License

MIT (license)

Dependencies

flutter

More

Packages that depend on flutter_pravatar