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',
),
);
}