mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-06 09:13:48 +08:00
refa: video model (#523)
This commit is contained in:
committed by
GitHub
parent
bf464994df
commit
7a6085e923
59
lib/models/model_video.dart
Normal file
59
lib/models/model_video.dart
Normal file
@@ -0,0 +1,59 @@
|
||||
import 'package:PiliPlus/utils/utils.dart';
|
||||
|
||||
abstract class BaseSimpleVideoItemModel {
|
||||
late String title;
|
||||
String? bvid;
|
||||
int? cid;
|
||||
String? pic;
|
||||
int duration = -1;
|
||||
late BaseOwner owner;
|
||||
late BaseStat stat;
|
||||
}
|
||||
|
||||
abstract class BaseVideoItemModel extends BaseSimpleVideoItemModel {
|
||||
int? aid;
|
||||
String? desc;
|
||||
int? pubdate;
|
||||
bool isFollowed = false;
|
||||
}
|
||||
|
||||
abstract class BaseOwner {
|
||||
int? mid;
|
||||
String? name;
|
||||
}
|
||||
|
||||
abstract class BaseStat {
|
||||
int? view;
|
||||
int? like;
|
||||
int? danmu;
|
||||
|
||||
String get viewStr => Utils.numFormat(view);
|
||||
String get danmuStr => Utils.numFormat(danmu);
|
||||
}
|
||||
|
||||
class Stat extends BaseStat {
|
||||
Stat.fromJson(Map<String, dynamic> json) {
|
||||
view = json["view"];
|
||||
like = json["like"];
|
||||
danmu = json['danmaku'];
|
||||
}
|
||||
}
|
||||
|
||||
class PlayStat extends BaseStat {
|
||||
PlayStat.fromJson(Map<String, dynamic> json) {
|
||||
view = json['play'];
|
||||
danmu = json['danmaku'];
|
||||
}
|
||||
}
|
||||
|
||||
class Dimension {
|
||||
int? width;
|
||||
int? height;
|
||||
int? rotate;
|
||||
|
||||
Dimension.fromJson(Map<String, dynamic> json) {
|
||||
width = json["width"];
|
||||
height = json["height"];
|
||||
rotate = json["rotate"];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user