Files
huangguo_android/lib/hj_utils/const.dart
T
2026-09-15 15:44:13 +07:00

81 lines
2.1 KiB
Dart
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
// ignore_for_file: constant_identifier_names
//媒体类型常量
enum MediaStyle {
Video, //真人视频
ShortVideo, //短视频
Pic, // 图集
Game, // 黄游
Novel, // 小说
Cartoon, //动漫
Comics, //漫画
Drama, //短剧
Community, //社区
Area, //禁区
Seed, //种子
Actress, //女优
NakedChat, //裸聊
GroupChat, //群聊
}
//搜索接口参数映射
extension MediaStyleSearchParam on MediaStyle {
//搜索 realm 参数
String get searchRealm => switch (this) {
MediaStyle.Video => 'SP', //影片
MediaStyle.ShortVideo => 'SHORT', //抖音
MediaStyle.Drama => 'DRAMA', //短剧
MediaStyle.Community => 'COVER', //帖子
MediaStyle.Pic => 'PIC', //图集
_ => '',
};
//ACG / 短剧搜索 kind1动漫 2漫画 3小说 4短剧
int? get searchKind => switch (this) {
MediaStyle.Cartoon => 1,
MediaStyle.Comics => 2,
MediaStyle.Drama => 4,
_ => null,
};
}
//排行榜参数映射
extension MediaStyleRankParam on MediaStyle {
//榜单 tab 标题
String get rankTitle => switch (this) {
MediaStyle.Video => '影片',
MediaStyle.Cartoon => '动漫',
MediaStyle.Comics => '漫画',
MediaStyle.Community => '帖子',
MediaStyle.Pic => '图集',
_ => '',
};
//榜单接口参数
String get rankParam => switch (this) {
MediaStyle.Video => 'SP',
MediaStyle.Cartoon => 'video',
MediaStyle.Comics => 'image',
MediaStyle.Community => 'COVER',
MediaStyle.Pic => 'PIC',
_ => '',
};
}
//下载缓存 tab 标题
extension MediaStyleCacheTitle on MediaStyle {
String get cacheTabTitle => switch (this) {
MediaStyle.ShortVideo => '抖音',
MediaStyle.Cartoon => '动漫',
MediaStyle.Drama => '短剧',
_ => '影视',
};
}
//排序 tab 配置:标题 + 排序值(sort 类型随接口而定:int 或 String,具体配置放各业务 logic
class SortTab<T> {
final String name;
final T sort;
const SortTab(this.name, this.sort);
}