diff --git a/lib/src/models/avatar_options.dart b/lib/src/models/avatar_options.dart new file mode 100644 index 0000000..c804e74 --- /dev/null +++ b/lib/src/models/avatar_options.dart @@ -0,0 +1,9 @@ +import 'package:acter_avatar/acter_avatar.dart'; + +/// Abstract class representing the set of avatars. +abstract class AvatarOptions { + AvatarInfo? get avatar; + List? get parentAvatars; + double? get size; + double? get parentSize; +} diff --git a/lib/src/models/dm_avatar_options.dart b/lib/src/models/dm_avatar_options.dart new file mode 100644 index 0000000..c00baa2 --- /dev/null +++ b/lib/src/models/dm_avatar_options.dart @@ -0,0 +1,21 @@ +import 'package:acter_avatar/src/models/avatar_info.dart'; +import 'package:acter_avatar/src/models/avatar_options.dart'; + +/// Class representing avatar for Direct Message/Private Chat (DM). +class DMAvatarOptions extends AvatarOptions { + DMAvatarOptions({required this.dmAvatar, this.avatarSize}); + @override + AvatarInfo get avatar => dmAvatar; + + @override + List? get parentAvatars => null; + + @override + double? get size => avatarSize ?? 24.0; + + @override + double? get parentSize => null; + + final AvatarInfo dmAvatar; + final double? avatarSize; +} diff --git a/lib/src/models/group_chat_avatar_option.dart b/lib/src/models/group_chat_avatar_option.dart new file mode 100644 index 0000000..1ee1c35 --- /dev/null +++ b/lib/src/models/group_chat_avatar_option.dart @@ -0,0 +1,29 @@ +import 'package:acter_avatar/src/models/avatar_info.dart'; +import 'package:acter_avatar/src/models/avatar_options.dart'; + +/// Class representing set of avatars for group chat/room. +class GroupChatAvatarOptions extends AvatarOptions { + GroupChatAvatarOptions({ + required this.groupAvatar, + required this.parentGroupAvatars, + this.avatarSize, + this.parentAvatarSize, + }); + + @override + AvatarInfo? get avatar => groupAvatar; + + @override + List? get parentAvatars => parentGroupAvatars; + + @override + double? get size => avatarSize ?? 48.0; + + @override + double? get parentSize => parentAvatarSize ?? 24.0; + + final AvatarInfo groupAvatar; + final List parentGroupAvatars; + final double? avatarSize; + final double? parentAvatarSize; +} diff --git a/lib/src/models/group_dm_avatar_options.dart b/lib/src/models/group_dm_avatar_options.dart new file mode 100644 index 0000000..f765c4f --- /dev/null +++ b/lib/src/models/group_dm_avatar_options.dart @@ -0,0 +1,27 @@ +import 'package:acter_avatar/src/models/avatar_info.dart'; +import 'package:acter_avatar/src/models/avatar_options.dart'; + +/// Class representing set of avatars for a group DM. +class GroupDMAvatarOptions extends AvatarOptions { + GroupDMAvatarOptions({ + required this.groupAvatars, + this.avatarSize, + this.parentAvatarSize, + }); + + @override + AvatarInfo? get avatar => null; + + @override + List get parentAvatars => groupAvatars; + + @override + double? get size => avatarSize ?? 48.0; + + @override + double? get parentSize => parentAvatarSize ?? 24.0; + + final List groupAvatars; + final double? avatarSize; + final double? parentAvatarSize; +} diff --git a/lib/src/models/space_avatar_options.dart b/lib/src/models/space_avatar_options.dart new file mode 100644 index 0000000..4fcd60d --- /dev/null +++ b/lib/src/models/space_avatar_options.dart @@ -0,0 +1,25 @@ +import 'package:acter_avatar/src/models/avatar_info.dart'; +import 'package:acter_avatar/src/models/avatar_options.dart'; + +/// Class representing set of avatars for a space. +class SpaceAvatarOptions extends AvatarOptions { + SpaceAvatarOptions(this.avatarSize, this.parentAvatarSize, + {required this.spaceAvatar, this.parentSpaceAvatars}); + + @override + AvatarInfo get avatar => spaceAvatar; + + @override + List? get parentAvatars => parentSpaceAvatars; + + @override + double? get size => avatarSize ?? 48.0; + + @override + double? get parentSize => parentAvatarSize ?? 24.0; + + final AvatarInfo spaceAvatar; + final List? parentSpaceAvatars; + final double? avatarSize; + final double? parentAvatarSize; +}