Acter Avatar is a package to generate different shapes of avatars by leveraging the combination of Multiavatar library and Colorize Text Avatar . The package is a derivative work from Acter a3 ongoing development.
![example.gif](https://private-user-images.githubusercontent.com/68579938/334131362-ad0e6378-35bc-4644-b234-fa929565f52b.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjMxOTY1NDIsIm5iZiI6MTcyMzE5NjI0MiwicGF0aCI6Ii82ODU3OTkzOC8zMzQxMzEzNjItYWQwZTYzNzgtMzViYy00NjQ0LWIyMzQtZmE5Mjk1NjVmNTJiLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MDklMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODA5VDA5MzcyMlomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTFmZjI3ZjBhMjMzZmUxY2M2N2E3NmYwNmM5N2Q5MmI0YzVlNjg5NjU0MmE2YTdjZjBmODdmNmU0ZDRkNjM1ODYmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.W8Gmf8PXcegZm4AE7JvbTJqvPauTypWxLcDWblb3cQ0)
ActerAvatar
widget supports AvatarOptions
object which is most interesting to look in first. It is main configuration parameter which can be initialised in various ways depending upon your avatar UI needs.
// Default constructor usage e.g. Space/Group Chat which can support badges.
AvatarOptions(AvatarInfo avatar,
{List<AvatarInfo>? parentBadges,
double? size,
double? badgesSize})
AvatarOptions
also support named constructors with parameter for DM/Group DM avatars.
// useful for setting DM/Private Chat avatar.
AvatarOptions.DM(AvatarInfo avatar, {double? size});
// useful for setting Group DM chat. Group avatars will appear as stacked avatars.
AvatarOptions.GroupDM(AvatarInfo avatar,
{List<AvatarInfo>? groupAvatars,
double? size,
double? groupAvatarSize})
AvatarInfo
class allows you to store avatar related data. See API documentation for reference.
ActerAvatar
takes AvatarOptions
along with few interaction params to render avatar.
final avatarOptions = AvatarOptions(
AvatarInfo(
uniqueId: '@aliKah:lorem.org',
displayName: 'Ali Akalın',
avatar: NetworkImage(*someImageLink*), // can be any image provider .i.e. AssetImage, MemoryImage and NetworkImage etc.
tooltip = ToolTipStyle.Combined), size: 20);
return ActerAvatar(
options: avatarOptions,
);
Alternatively you can also provide avatar future which will show fallback if data isn't readily available. It can also be left as null
which will have same effect.
final avatarOptions = AvatarOptions(
AvatarInfo(
uniqueId: '@aliKah:lorem.org',
displayName: 'Ali Akalın',
avatarFuture: someFutureOrNull), size = 20,
);
return ActerAvatar(
options: avatarOptions, // can be any image provider .i.e. AssetImage, MemoryImage and NetworkImage etc.
),
You can also provide list of AvatarInfo
in parentBadges
or groupAvatars
in AvatarOptions.groupDM()
named constructor for displaying parent badges and circular stacked group avatars respectively.
final avatarOptions = AvatarOptions(
AvatarInfo(
uniqueId: '@aliKah:lorem.org',
displayName: 'Ali Akalın',
avatar: NetworkImage(*someImageLink*)),
parentBadges: [
// more `AvatarInfo` here.
],
size: 20,
parentBadgesSize: 10,
);
return ActerAvatar(
options: avatarOptions,
);
For more info regarding avatar usage. See our Example
section.
Fork of the great Colorize Text Avatar package by Deniz Çolak.
Any additional work: © 2023 Acter Association, Denmark