mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-06 09:13:48 +08:00
feat: 字幕展示逻辑
This commit is contained in:
23
lib/models/video/play/subtitle.dart
Normal file
23
lib/models/video/play/subtitle.dart
Normal file
@@ -0,0 +1,23 @@
|
||||
enum SubtitlePreference { off, on, withoutAi }
|
||||
|
||||
extension SubtitlePreferenceDesc on SubtitlePreference {
|
||||
static final List<String> _descList = [
|
||||
'默认不显示字幕',
|
||||
'选择第一个可用字幕',
|
||||
'跳过自动生成(ai)字幕,选择第一个可用字幕'
|
||||
];
|
||||
get description => _descList[index];
|
||||
}
|
||||
|
||||
extension SubtitlePreferenceCode on SubtitlePreference {
|
||||
static final List<String> _codeList = ['off', 'on', 'withoutAi'];
|
||||
get code => _codeList[index];
|
||||
|
||||
static SubtitlePreference? fromCode(String code) {
|
||||
final index = _codeList.indexOf(code);
|
||||
if (index != -1) {
|
||||
return SubtitlePreference.values[index];
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user