Blame view

lib/pages/video/zone/video_zone_item.dart 854 Bytes
383462ef   吴启风   feat: 新增视频专区列表与播放功能
1
2
3
4
5
6
7
  class VideoZoneItem {
    const VideoZoneItem({
      required this.id,
      required this.name,
      required this.coverUrl,
      required this.videoUrl,
      required this.accessible,
383462ef   吴启风   feat: 新增视频专区列表与播放功能
8
9
10
11
12
13
14
15
16
17
18
19
20
21
    });
  
    factory VideoZoneItem.fromJson(Map<String, dynamic> json) {
      int toInt(dynamic value) =>
          value is num ? value.toInt() : int.tryParse('$value') ?? 0;
      bool toBool(dynamic value) =>
          value == true || value == 1 || value?.toString() == 'true';
  
      return VideoZoneItem(
        id: toInt(json['id']),
        name: json['name']?.toString() ?? '',
        coverUrl: json['coverUrl']?.toString() ?? '',
        videoUrl: json['videoUrl']?.toString() ?? '',
        accessible: toBool(json['accessible']),
383462ef   吴启风   feat: 新增视频专区列表与播放功能
22
23
24
25
26
27
28
29
      );
    }
  
    final int id;
    final String name;
    final String coverUrl;
    final String videoUrl;
    final bool accessible;
383462ef   吴启风   feat: 新增视频专区列表与播放功能
30
31
32
  
    String get title => name;
  }