A Multicultural Avatar Maker in Flutter Apps. 12 Billion Unique Multicultural Avatars

random_avatar 

Flutter Wrapper for Multiavatar

Multiavatar is a multicultural avatar maker.

Random Avatar represents people from multiple races, multiple cultures, multiple age groups, multiple worldviews and walks of life.

In total, it is possible to generate 12,230,590,464 unique avatars.

Installation and usage 

Add random_avatar to your pubspec:

dependencies:
  random_avatar: any # or the latest version on Pub

get avatar string

String svgCode = RandomAvatarString('saytoonz');

get avatar string with transparent background

String svgCode = RandomAvatarString('saytoonz', trBackground: true);

get avatar svg widget

Widget svgCode = RandomAvatar('saytoonz', height: 50, width: 50);

get avatar svg widget with transparent background

Widget svgCode = RandomAvatar('saytoonz', trBackground: true, height: 50, width: 50);

check the example (https://github.com/saytoonz/random_avatar/tree/main/exemple)

Info 

To create new avatars, the Multiavatar mixes different parts of different avatars, and different color themes.

The total number of unique avatars: 48^6 = 12,230,590,464

One of the main Multiavatar functions is to work as an identicon. Every unique avatar can be identified by the unique string of characters, associated with the avatar.

The string of characters is also the input for the Multiavatar package, which converts the provided string into a 6 double-digit numbers (range 00-47), each representing an individual part of the final avatar.

000000000000 - this string of numbers represents the very first avatar + its A theme. You can also read it like this: 00 00 00 00 00 00.

474747474747 - this is the 12,230,590,464th avatar (or the 16th initial avatar + its "C" color theme).

More info can be found in the random_avatar.dart file comments.

License 

A Dart implementation based on multiavatar script for Flutter apps.

Use this package as a library

Depend on it

Run this command:

With Flutter:

 $ flutter pub add random_avatar

This will add a line like this to your package's pubspec.yaml (and run an implicit flutter pub get):

dependencies:
  random_avatar: ^0.0.8

Alternatively, your editor might support flutter pub get. Check the docs for your editor to learn more.

Import it

Now in your Dart code, you can use:

import 'package:random_avatar/random_avatar.dart';

example/lib/main.dart

import 'dart:developer';

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

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

class MyApp extends StatelessWidget {
  const MyApp({Key key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Random Avatar example',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: const MyHomePage(title: 'Random Example'),
    );
  }
}

class MyHomePage extends StatefulWidget {
  const MyHomePage({Key key, this.title}) : super(key: key);

  final String title;

  @override
  _MyHomePageState createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  final TextEditingController _controller = TextEditingController();
  final List<Widget> _painters = <Widget>[];

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text(widget.title),
      ),
      body: SingleChildScrollView(
        child: Wrap(
          children: [
            FloatingActionButton(
              onPressed: () {
                String svg = RandomAvatarString(
                  DateTime.now().toIso8601String(),
                  trBackground: false,
                );
                log(svg);

                _painters.add(
                  RandomAvatar(
                    DateTime.now().toIso8601String(),
                    height: 50,
                    width: 52,
                  ),
                );
                _controller.text = svg;
                setState(() {});
              },
              tooltip: 'Generate',
              child: const Icon(Icons.gesture),
            ),
            const SizedBox(height: 20),
            ..._painters,
          ],
        ),
      ),
    );
  }
}

Download details:

Author: flutter-doctor.com

Source: https://github.com/saytoonz/random_avatar

#flutter #android #ios

A Multicultural Avatar Maker in Flutter Apps. 12 Billion Unique Multicultural Avatars
1.80 GEEK