avataaars 0.5.1 avataaars: ^0.5.1 copied to clipboard
An avatar generator for anyone to make their beautiful personal avatar easily!
import 'package:avataaars/avataaars.dart';
import 'package:flutter/material.dart';
import 'avatar_customizer.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: 'Flutter Demo',
debugShowCheckedModeBanner: false,
theme: ThemeData(
primarySwatch: Colors.blue,
),
home: const MyHomePage(title: 'Flutter Demo Home Page'),
);
}
}
class MyHomePage extends StatefulWidget {
const MyHomePage({Key? key, required this.title}) : super(key: key);
final String title;
@override
State<MyHomePage> createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
Avataaar avataaar = Avataaar.random();
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(title: const Text('Avataaars')),
body: SingleChildScrollView(
child: Column(crossAxisAlignment: CrossAxisAlignment.center, children: [
Container(
padding: const EdgeInsets.all(10),
constraints: const BoxConstraints(maxWidth: 600),
child: AvatarCustomizer(
initialValue: avataaar,
onChanged: (a) => setState(() {
avataaar = a;
}),
))
]),
),
);
}
}