flutter_avataaar 0.1.14 copy "flutter_avataaar: ^0.1.14" to clipboard
flutter_avataaar: ^0.1.14 copied to clipboard

Flutter wrapper widget for Avataaars API allowing to generate and display avatar images.

Flutter_avataaar #

Flutter wrapper widget for Avataaars API - a free online avatar generator for anyone to make their beautiful personal avatar easily.

flutter-avataaar

Getting Started #

  1. Create Avataaar object:
// Create avatar with default constructor
Avataaar(
  skin: Skin.pale,
  top: Top(
    topType: TopType.longHairCurvy,
    accessoriesType: AccessoriesType.Round,
    facialHair: FacialHair.beardMagestic(
      facialHairColor: FacialHairColor.BlondeGolden,
    ),
  ),
);

// Randomize all properties
Avataaar.random();

// Or mix both
Avataaar.random(
  skin: Skin.pale,
  top: Top(
    topType: TopType.longHairCurvy,
    accessoriesType: AccessoriesType.Round,
    facialHair: FacialHair.random,
  ),
);
  1. Create AvataaarGenerator widget and pass it the avatar:
AvataaarGenerator
(
  avataaar: avataaar,
  onTranslateKey: (String key) {
  return Translate.get(key);
  }
  onUpdateAvataaar:() {setState((){});},
);

// By default package will use SvgPicture to render the image. AvataaarPicture could be used to create a custom
// [builder] constructor and create widget for given image url:
 AvataaarPicture.builder(
  builder: (context, avataaar) {
    // ...
  },
)

Persisting avatars #

Use Avataaar.toJson() and Avataaar.fromJson(String) methods to serialize/deserialize avatars.

Getting image bytes #

Use the funtion getPngFromSvg from the class Avataaar to get the png File.

28
likes
80
points
63
downloads

Publisher

verified publisherfj-anleo.es

Weekly Downloads

Flutter wrapper widget for Avataaars API allowing to generate and display avatar images.

Repository (GitHub)
View/report issues

Documentation

API reference

License

BSD-3-Clause (license)

Dependencies

cached_network_image, flutter, flutter_material_pickers, flutter_svg, http, path_provider, universal_io, uuid

More

Packages that depend on flutter_avataaar