vkdart

Форк
0
56 строк · 1.7 Кб
1
import 'package:vkdart/vkontakte.dart';
2

3
/// Model Sticker.
4
///
5
/// See https://vk.com/dev/objects/sticker
6
class StickerAttachmentModel extends AttachmentModel {
7
  // ignore: public_member_api_docs
8
  StickerAttachmentModel(super.payload) : super(attachType: 'sticker');
9

10
  /// The ID of the set.
11
  int get productId => payload['product_id'];
12

13
  /// The sticker ID.
14
  int get stickerId => payload['sticker_id'];
15

16
  /// Sticker images (with transparent background).
17
  List<StickerAttachmentImageModel> get images => (payload['images'] as List)
18
      .map((e) =>
19
          // ignore: require_trailing_commass
20
          StickerAttachmentImageModel((e as Map).cast<String, dynamic>()))
21
      .toList();
22

23
  /// Images for the sticker (with an opaque background).
24
  List<StickerAttachmentImageModel> get imagesWithBackground =>
25
      (payload['images_with_background'] as List)
26
          .map((e) =>
27
              // ignore: require_trailing_commass
28
              StickerAttachmentImageModel((e as Map).cast<String, dynamic>()))
29
          .toList();
30

31
  /// The URL of the sticker animation.
32
  String? get animationUrl => payload['animation_url'];
33

34
  /// Whether the sticker is allowed.
35
  bool? get isAllowed => payload['is_allowed'];
36
}
37

38
/// Model Sticker Attachment Image.
39
///
40
/// See https://vk.com/dev/objects/sticker#image
41
final class StickerAttachmentImageModel {
42
  // ignore: public_member_api_docs
43
  StickerAttachmentImageModel(this.imageObject);
44

45
  /// Payload.
46
  final Map<String, dynamic> imageObject;
47

48
  /// Sticker image url.
49
  String get url => imageObject['url'];
50

51
  /// Sticker image width.
52
  String get width => imageObject['width'];
53

54
  /// Sticker image height.
55
  String get height => imageObject['height'];
56
}
57

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.