opt: member video item

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
bggRGjQaUbCoE
2024-11-26 13:08:40 +08:00
parent 16cdbab7ab
commit 6fee468f49
3 changed files with 110 additions and 95 deletions

View File

@@ -61,12 +61,20 @@ class VideoCardHMemberVideo extends StatelessWidget {
Hero( Hero(
tag: heroTag, tag: heroTag,
child: NetworkImgLayer( child: NetworkImgLayer(
src: videoItem.cover, src:
videoItem.season?['cover'] ?? videoItem.cover,
width: maxWidth, width: maxWidth,
height: maxHeight, height: maxHeight,
), ),
), ),
if (videoItem.duration != null) if (videoItem.season != null)
PBadge(
text: '合集: ${videoItem.season?['count']}',
right: 6.0,
bottom: 6.0,
type: 'gray',
)
else if (videoItem.duration != null)
PBadge( PBadge(
text: Utils.timeFormat(videoItem.duration), text: Utils.timeFormat(videoItem.duration),
right: 6.0, right: 6.0,
@@ -118,7 +126,7 @@ class VideoContent extends StatelessWidget {
...[ ...[
Expanded( Expanded(
child: Text( child: Text(
videoItem.title ?? '', videoItem.season?['title'] ?? videoItem.title ?? '',
textAlign: TextAlign.start, textAlign: TextAlign.start,
style: TextStyle( style: TextStyle(
fontWeight: FontWeight.w400, fontWeight: FontWeight.w400,
@@ -132,7 +140,9 @@ class VideoContent extends StatelessWidget {
), ),
], ],
Text( Text(
videoItem.publishTimeText ?? '', videoItem.season != null
? Utils.dateFormat(videoItem.season?['mtime'])
: videoItem.publishTimeText ?? '',
maxLines: 1, maxLines: 1,
style: TextStyle( style: TextStyle(
fontWeight: FontWeight.w400, fontWeight: FontWeight.w400,
@@ -147,12 +157,13 @@ class VideoContent extends StatelessWidget {
children: [ children: [
StatView( StatView(
theme: 'gray', theme: 'gray',
view: videoItem.viewContent, view: videoItem.season?['view_content'] ??
videoItem.viewContent,
), ),
const SizedBox(width: 8), const SizedBox(width: 8),
StatDanMu( StatDanMu(
theme: 'gray', theme: 'gray',
danmu: videoItem.danmaku, danmu: videoItem.season?['danmaku'] ?? videoItem.danmaku,
), ),
], ],
), ),

View File

@@ -8,96 +8,98 @@ part 'item.g.dart';
@JsonSerializable() @JsonSerializable()
class Item { class Item {
String? title; String? title;
String? subtitle; String? subtitle;
String? tname; String? tname;
String? cover; String? cover;
@JsonKey(name: 'cover_icon') @JsonKey(name: 'cover_icon')
String? coverIcon; String? coverIcon;
String? uri; String? uri;
String? param; String? param;
String? goto; String? goto;
String? length; String? length;
int? duration; int? duration;
@JsonKey(name: 'is_popular') @JsonKey(name: 'is_popular')
bool? isPopular; bool? isPopular;
@JsonKey(name: 'is_steins') @JsonKey(name: 'is_steins')
bool? isSteins; bool? isSteins;
@JsonKey(name: 'is_ugcpay') @JsonKey(name: 'is_ugcpay')
bool? isUgcpay; bool? isUgcpay;
@JsonKey(name: 'is_cooperation') @JsonKey(name: 'is_cooperation')
bool? isCooperation; bool? isCooperation;
@JsonKey(name: 'is_pgc') @JsonKey(name: 'is_pgc')
bool? isPgc; bool? isPgc;
@JsonKey(name: 'is_live_playback') @JsonKey(name: 'is_live_playback')
bool? isLivePlayback; bool? isLivePlayback;
@JsonKey(name: 'is_pugv') @JsonKey(name: 'is_pugv')
bool? isPugv; bool? isPugv;
@JsonKey(name: 'is_fold') @JsonKey(name: 'is_fold')
bool? isFold; bool? isFold;
@JsonKey(name: 'is_oneself') @JsonKey(name: 'is_oneself')
bool? isOneself; bool? isOneself;
int? play; int? play;
int? danmaku; int? danmaku;
int? ctime; int? ctime;
@JsonKey(name: 'ugc_pay') @JsonKey(name: 'ugc_pay')
int? ugcPay; int? ugcPay;
String? author; String? author;
bool? state; bool? state;
String? bvid; String? bvid;
int? videos; int? videos;
@JsonKey(name: 'three_point') @JsonKey(name: 'three_point')
List<ThreePoint>? threePoint; List<ThreePoint>? threePoint;
@JsonKey(name: 'first_cid') @JsonKey(name: 'first_cid')
int? firstCid; int? firstCid;
@JsonKey(name: 'cursor_attr') @JsonKey(name: 'cursor_attr')
CursorAttr? cursorAttr; CursorAttr? cursorAttr;
@JsonKey(name: 'view_content') @JsonKey(name: 'view_content')
String? viewContent; String? viewContent;
@JsonKey(name: 'icon_type') @JsonKey(name: 'icon_type')
int? iconType; int? iconType;
@JsonKey(name: 'publish_time_text') @JsonKey(name: 'publish_time_text')
String? publishTimeText; String? publishTimeText;
List<Badge>? badges; List<Badge>? badges;
Map? season;
Item({ Item({
this.title, this.title,
this.subtitle, this.subtitle,
this.tname, this.tname,
this.cover, this.cover,
this.coverIcon, this.coverIcon,
this.uri, this.uri,
this.param, this.param,
this.goto, this.goto,
this.length, this.length,
this.duration, this.duration,
this.isPopular, this.isPopular,
this.isSteins, this.isSteins,
this.isUgcpay, this.isUgcpay,
this.isCooperation, this.isCooperation,
this.isPgc, this.isPgc,
this.isLivePlayback, this.isLivePlayback,
this.isPugv, this.isPugv,
this.isFold, this.isFold,
this.isOneself, this.isOneself,
this.play, this.play,
this.danmaku, this.danmaku,
this.ctime, this.ctime,
this.ugcPay, this.ugcPay,
this.author, this.author,
this.state, this.state,
this.bvid, this.bvid,
this.videos, this.videos,
this.threePoint, this.threePoint,
this.firstCid, this.firstCid,
this.cursorAttr, this.cursorAttr,
this.viewContent, this.viewContent,
this.iconType, this.iconType,
this.publishTimeText, this.publishTimeText,
this.badges, this.badges,
}); this.season,
});
factory Item.fromJson(Map<String, dynamic> json) => _$ItemFromJson(json); factory Item.fromJson(Map<String, dynamic> json) => _$ItemFromJson(json);
Map<String, dynamic> toJson() => _$ItemToJson(this); Map<String, dynamic> toJson() => _$ItemToJson(this);
} }

View File

@@ -47,6 +47,7 @@ Item _$ItemFromJson(Map<String, dynamic> json) => Item(
badges: (json['badges'] as List<dynamic>?) badges: (json['badges'] as List<dynamic>?)
?.map((e) => Badge.fromJson(e as Map<String, dynamic>)) ?.map((e) => Badge.fromJson(e as Map<String, dynamic>))
.toList(), .toList(),
season: json['season'],
); );
Map<String, dynamic> _$ItemToJson(Item instance) => <String, dynamic>{ Map<String, dynamic> _$ItemToJson(Item instance) => <String, dynamic>{
@@ -84,4 +85,5 @@ Map<String, dynamic> _$ItemToJson(Item instance) => <String, dynamic>{
'icon_type': instance.iconType, 'icon_type': instance.iconType,
'publish_time_text': instance.publishTimeText, 'publish_time_text': instance.publishTimeText,
'badges': instance.badges, 'badges': instance.badges,
'season': instance.season,
}; };