Search packages, repositories and app categories

GitHub repositoryfrananleo/flutter_avataaar

flutter_avataaar

frananleo/flutter_avataaar open-source repository details.

flutter_avataaar project cover
Stars
13
Forks
11
Last push (UTC)
Jun 15, 2023
Project status
Active

Original README

English project snapshot. Visit GitHub for the latest content.

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.

Francisco Gonzalez-Anleo GitHub avatar
GitHub author

Francisco Gonzalez-Anleo ↗

Germany
LanguagesDartHTMLRubySwiftKotlinObjective-C

Packages published by this repository

Dependencies used

Dependency list 9 items

How do I choose a repository?

Start with your use case, compare repository activity, and check the original project before adopting it.

  1. Search by repository name, owner or description, then narrow the results by topic.
  2. Compare stars, forks and recent pushes. Stars show community interest, not a guarantee of quality.
  3. Read the README, license and issues on GitHub before using a project.

Sources and maintenance

“A repository is the most basic element of GitHub.”

GitHub Docs — About repositories ↗