flutter avatars – bottts
a high performance flutter widget to render bot.tts svg avatars on android/ios devices.
it’s faster than other classical approaches because it’s not using any api, rather it’s rendering svg strings on the fly !
bot.tts :
characters originally designed by pablo stanley, the sketch library can be found on bottts.com.
getting started
- create bottt object:
// create bottt with default constructor
var _bottt = bottt(
color: colors.red,
eye: eyetype.glow,
face: facetype.square03,
mouth: mouthtype.bite,
side: sidetype.round,
texture: texturetype.dirty01,
top: toptype.horns,
);
// randomize all properties
var _bottt = bottt.random();
// or keep some properties specific & remaining as random
var _bottt = bottt.random(
top: toptype.horns,
mouth: mouthtype.bite,
);
- create botttavatar widget and pass it the bottt object:
padding(
padding: edgeinsets.all(20),
child: botttavatar(_bottt),
)
// alternatively you can also combine the widget with a circleavatar
circleavatar(
radius: 90,
child: circleavatar(
radius: 85,
backgroundcolor: color.fromargb(255, 100, 100, 100),
child: padding(
padding: edgeinsets.all(20),
child: botttavatar(_bottt),
),
),
)
serialization/deserialization
for maps: use botttobject.tojson()
and bottt.fromjson(serializedbotttstring)
methods to serialize/deserialize bo.ttts.
for strings: use botttobject.serialize()
and bottt.deserialize()(serializedbotttstring)
methods to serialize/deserialize bo.ttts.
Comments are closed.