first commit
This commit is contained in:
46
lib/app/models/videomodels/videosModel.dart
Normal file
46
lib/app/models/videomodels/videosModel.dart
Normal file
@@ -0,0 +1,46 @@
|
||||
// video_model.dart
|
||||
class VideoCategory {
|
||||
final String name;
|
||||
final List<VideoItemModel> videos;
|
||||
|
||||
VideoCategory({required this.name, required this.videos});
|
||||
|
||||
factory VideoCategory.fromJson(Map<String, dynamic> json) {
|
||||
var videoList = json['videos'] as List;
|
||||
List<VideoItemModel> videos = videoList
|
||||
.map((video) => VideoItemModel.fromJson(video))
|
||||
.toList();
|
||||
|
||||
return VideoCategory(
|
||||
name: json['name'],
|
||||
videos: videos,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class VideoItemModel {
|
||||
final String description;
|
||||
final List<String> sources;
|
||||
final String subtitle;
|
||||
final String thumb;
|
||||
final String title;
|
||||
|
||||
VideoItemModel({
|
||||
required this.description,
|
||||
required this.sources,
|
||||
required this.subtitle,
|
||||
required this.thumb,
|
||||
required this.title,
|
||||
});
|
||||
|
||||
factory VideoItemModel.fromJson(Map<String, dynamic> json) {
|
||||
var sources = json['sources'] as List;
|
||||
return VideoItemModel(
|
||||
description: json['description'],
|
||||
sources: sources.cast<String>(),
|
||||
subtitle: json['subtitle'],
|
||||
thumb: json['thumb'],
|
||||
title: json['title'],
|
||||
);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user