Compare commits
6 Commits
fix-issues
...
feature-hi
| Author | SHA1 | Date | |
|---|---|---|---|
| 99e6abdad9 | |||
| 3ece2bb173 | |||
| 06fb3e8d2f | |||
| 504be6fbda | |||
| df4539a035 | |||
| a3e1fd4e91 |
@ -38,6 +38,10 @@ class VideoCardH extends StatelessWidget {
|
|||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final int aid = videoItem.aid;
|
final int aid = videoItem.aid;
|
||||||
final String bvid = videoItem.bvid;
|
final String bvid = videoItem.bvid;
|
||||||
|
String type = 'video';
|
||||||
|
try {
|
||||||
|
type = videoItem.type;
|
||||||
|
} catch (_) {}
|
||||||
final String heroTag = Utils.makeHeroTag(aid);
|
final String heroTag = Utils.makeHeroTag(aid);
|
||||||
return GestureDetector(
|
return GestureDetector(
|
||||||
onLongPress: () {
|
onLongPress: () {
|
||||||
@ -53,6 +57,10 @@ class VideoCardH extends StatelessWidget {
|
|||||||
child: InkWell(
|
child: InkWell(
|
||||||
onTap: () async {
|
onTap: () async {
|
||||||
try {
|
try {
|
||||||
|
if (type == 'ketang') {
|
||||||
|
SmartDialog.showToast('课堂视频暂不支持播放');
|
||||||
|
return;
|
||||||
|
}
|
||||||
final int cid =
|
final int cid =
|
||||||
videoItem.cid ?? await SearchHttp.ab2c(aid: aid, bvid: bvid);
|
videoItem.cid ?? await SearchHttp.ab2c(aid: aid, bvid: bvid);
|
||||||
Get.toNamed('/video?bvid=$bvid&cid=$cid',
|
Get.toNamed('/video?bvid=$bvid&cid=$cid',
|
||||||
@ -95,12 +103,20 @@ class VideoCardH extends StatelessWidget {
|
|||||||
height: maxHeight,
|
height: maxHeight,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
PBadge(
|
if (videoItem.duration != 0)
|
||||||
text: Utils.timeFormat(videoItem.duration!),
|
PBadge(
|
||||||
right: 6.0,
|
text: Utils.timeFormat(videoItem.duration!),
|
||||||
bottom: 6.0,
|
right: 6.0,
|
||||||
type: 'gray',
|
bottom: 6.0,
|
||||||
),
|
type: 'gray',
|
||||||
|
),
|
||||||
|
if (type != 'video')
|
||||||
|
PBadge(
|
||||||
|
text: type,
|
||||||
|
left: 6.0,
|
||||||
|
bottom: 6.0,
|
||||||
|
type: 'primary',
|
||||||
|
),
|
||||||
// if (videoItem.rcmdReason != null &&
|
// if (videoItem.rcmdReason != null &&
|
||||||
// videoItem.rcmdReason.content != '')
|
// videoItem.rcmdReason.content != '')
|
||||||
// pBadge(videoItem.rcmdReason.content, context,
|
// pBadge(videoItem.rcmdReason.content, context,
|
||||||
|
|||||||
@ -85,7 +85,9 @@ class SearchVideoItemModel {
|
|||||||
// title = json['title'].replaceAll(RegExp(r'<.*?>'), '');
|
// title = json['title'].replaceAll(RegExp(r'<.*?>'), '');
|
||||||
title = Em.regTitle(json['title']);
|
title = Em.regTitle(json['title']);
|
||||||
description = json['description'];
|
description = json['description'];
|
||||||
pic = 'https:${json['pic']}';
|
pic = json['pic'] != null && json['pic'].startsWith('//')
|
||||||
|
? 'https:${json['pic']}'
|
||||||
|
: json['pic'] ?? '';
|
||||||
videoReview = json['video_review'];
|
videoReview = json['video_review'];
|
||||||
pubdate = json['pubdate'];
|
pubdate = json['pubdate'];
|
||||||
senddate = json['senddate'];
|
senddate = json['senddate'];
|
||||||
|
|||||||
@ -201,7 +201,6 @@ class _AboutPageState extends State<AboutPage> {
|
|||||||
var cleanStatus = await CacheManage().clearCacheAll();
|
var cleanStatus = await CacheManage().clearCacheAll();
|
||||||
if (cleanStatus) {
|
if (cleanStatus) {
|
||||||
getCacheSize();
|
getCacheSize();
|
||||||
SmartDialog.showToast('清除成功');
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
title: const Text('清除缓存'),
|
title: const Text('清除缓存'),
|
||||||
@ -254,12 +253,16 @@ class AboutController extends GetxController {
|
|||||||
// 获取远程版本
|
// 获取远程版本
|
||||||
Future getRemoteApp() async {
|
Future getRemoteApp() async {
|
||||||
var result = await Request().get(Api.latestApp, extra: {'ua': 'pc'});
|
var result = await Request().get(Api.latestApp, extra: {'ua': 'pc'});
|
||||||
|
isLoading.value = false;
|
||||||
|
if (result.data == null || result.data.isEmpty) {
|
||||||
|
SmartDialog.showToast('获取远程版本失败,请检查网络');
|
||||||
|
return;
|
||||||
|
}
|
||||||
data = LatestDataModel.fromJson(result.data);
|
data = LatestDataModel.fromJson(result.data);
|
||||||
remoteAppInfo = data;
|
remoteAppInfo = data;
|
||||||
remoteVersion.value = data.tagName!;
|
remoteVersion.value = data.tagName!;
|
||||||
isUpdate.value =
|
isUpdate.value =
|
||||||
Utils.needUpdate(currentVersion.value, remoteVersion.value);
|
Utils.needUpdate(currentVersion.value, remoteVersion.value);
|
||||||
isLoading.value = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 跳转下载/本地更新
|
// 跳转下载/本地更新
|
||||||
@ -277,7 +280,7 @@ class AboutController extends GetxController {
|
|||||||
|
|
||||||
githubRelease() {
|
githubRelease() {
|
||||||
launchUrl(
|
launchUrl(
|
||||||
Uri.parse('https://github.com/guozhigq/pilipala/release'),
|
Uri.parse('https://github.com/guozhigq/pilipala/releases'),
|
||||||
mode: LaunchMode.externalApplication,
|
mode: LaunchMode.externalApplication,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -144,9 +144,9 @@ class _BangumiPanelState extends State<BangumiPanel> {
|
|||||||
Expanded(
|
Expanded(
|
||||||
child: Material(
|
child: Material(
|
||||||
child: ScrollablePositionedList.builder(
|
child: ScrollablePositionedList.builder(
|
||||||
itemCount: widget.pages.length + 1,
|
itemCount: widget.pages.length,
|
||||||
itemBuilder: (BuildContext context, int index) {
|
itemBuilder: (BuildContext context, int index) {
|
||||||
bool isLastItem = index == widget.pages.length;
|
bool isLastItem = index == widget.pages.length - 1;
|
||||||
bool isCurrentIndex = currentIndex == index;
|
bool isCurrentIndex = currentIndex == index;
|
||||||
return isLastItem
|
return isLastItem
|
||||||
? SizedBox(
|
? SizedBox(
|
||||||
|
|||||||
@ -29,7 +29,6 @@ class BottomControl extends StatefulWidget implements PreferredSizeWidget {
|
|||||||
|
|
||||||
class _BottomControlState extends State<BottomControl> {
|
class _BottomControlState extends State<BottomControl> {
|
||||||
late PlayUrlModel videoInfo;
|
late PlayUrlModel videoInfo;
|
||||||
List<PlaySpeed> playSpeed = PlaySpeed.values;
|
|
||||||
TextStyle subTitleStyle = const TextStyle(fontSize: 12);
|
TextStyle subTitleStyle = const TextStyle(fontSize: 12);
|
||||||
TextStyle titleStyle = const TextStyle(fontSize: 14);
|
TextStyle titleStyle = const TextStyle(fontSize: 14);
|
||||||
Size get preferredSize => const Size(double.infinity, kToolbarHeight);
|
Size get preferredSize => const Size(double.infinity, kToolbarHeight);
|
||||||
|
|||||||
@ -173,6 +173,12 @@ class _ExtraSettingState extends State<ExtraSetting> {
|
|||||||
setKey: SettingBoxKey.enableAi,
|
setKey: SettingBoxKey.enableAi,
|
||||||
defaultVal: true,
|
defaultVal: true,
|
||||||
),
|
),
|
||||||
|
const SetSwitchItem(
|
||||||
|
title: '相关视频推荐',
|
||||||
|
subTitle: '视频详情页推荐相关视频',
|
||||||
|
setKey: SettingBoxKey.enableRelatedVideo,
|
||||||
|
defaultVal: true,
|
||||||
|
),
|
||||||
ListTile(
|
ListTile(
|
||||||
dense: false,
|
dense: false,
|
||||||
title: Text('评论展示', style: titleStyle),
|
title: Text('评论展示', style: titleStyle),
|
||||||
|
|||||||
@ -17,6 +17,7 @@ class _PlaySpeedPageState extends State<PlaySpeedPage> {
|
|||||||
Box videoStorage = GStrorage.video;
|
Box videoStorage = GStrorage.video;
|
||||||
Box settingStorage = GStrorage.setting;
|
Box settingStorage = GStrorage.setting;
|
||||||
late double playSpeedDefault;
|
late double playSpeedDefault;
|
||||||
|
late List<double> playSpeedSystem;
|
||||||
late double longPressSpeedDefault;
|
late double longPressSpeedDefault;
|
||||||
late List customSpeedsList;
|
late List customSpeedsList;
|
||||||
late bool enableAutoLongPressSpeed;
|
late bool enableAutoLongPressSpeed;
|
||||||
@ -53,6 +54,9 @@ class _PlaySpeedPageState extends State<PlaySpeedPage> {
|
|||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
|
// 系统预设倍速
|
||||||
|
playSpeedSystem =
|
||||||
|
videoStorage.get(VideoBoxKey.playSpeedSystem, defaultValue: playSpeed);
|
||||||
// 默认倍速
|
// 默认倍速
|
||||||
playSpeedDefault =
|
playSpeedDefault =
|
||||||
videoStorage.get(VideoBoxKey.playSpeedDefault, defaultValue: 1.0);
|
videoStorage.get(VideoBoxKey.playSpeedDefault, defaultValue: 1.0);
|
||||||
@ -64,6 +68,7 @@ class _PlaySpeedPageState extends State<PlaySpeedPage> {
|
|||||||
videoStorage.get(VideoBoxKey.customSpeedsList, defaultValue: []);
|
videoStorage.get(VideoBoxKey.customSpeedsList, defaultValue: []);
|
||||||
enableAutoLongPressSpeed = settingStorage
|
enableAutoLongPressSpeed = settingStorage
|
||||||
.get(SettingBoxKey.enableAutoLongPressSpeed, defaultValue: false);
|
.get(SettingBoxKey.enableAutoLongPressSpeed, defaultValue: false);
|
||||||
|
// 开启动态长按倍速时不展示
|
||||||
if (enableAutoLongPressSpeed) {
|
if (enableAutoLongPressSpeed) {
|
||||||
Map newItem = sheetMenu[1];
|
Map newItem = sheetMenu[1];
|
||||||
newItem['show'] = false;
|
newItem['show'] = false;
|
||||||
@ -123,7 +128,7 @@ class _PlaySpeedPageState extends State<PlaySpeedPage> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 设定倍速弹窗
|
// 设定倍速弹窗
|
||||||
void showBottomSheet(type, i) {
|
void showBottomSheet(String type, int i) {
|
||||||
showModalBottomSheet<void>(
|
showModalBottomSheet<void>(
|
||||||
context: context,
|
context: context,
|
||||||
isScrollControlled: true,
|
isScrollControlled: true,
|
||||||
@ -159,18 +164,11 @@ class _PlaySpeedPageState extends State<PlaySpeedPage> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
void menuAction(type, index, id) async {
|
void menuAction(type, int index, id) async {
|
||||||
double chooseSpeed = 1.0;
|
double chooseSpeed = 1.0;
|
||||||
if (type == 'system' && id == -1) {
|
|
||||||
SmartDialog.showToast('系统预设倍速不支持删除');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
// 获取当前选中的倍速值
|
// 获取当前选中的倍速值
|
||||||
if (type == 'system') {
|
chooseSpeed =
|
||||||
chooseSpeed = PlaySpeed.values[index].value;
|
type == 'system' ? playSpeedSystem[index] : customSpeedsList[index];
|
||||||
} else {
|
|
||||||
chooseSpeed = customSpeedsList[index];
|
|
||||||
}
|
|
||||||
// 设置
|
// 设置
|
||||||
if (id == 1) {
|
if (id == 1) {
|
||||||
// 设置默认倍速
|
// 设置默认倍速
|
||||||
@ -182,17 +180,22 @@ class _PlaySpeedPageState extends State<PlaySpeedPage> {
|
|||||||
videoStorage.put(
|
videoStorage.put(
|
||||||
VideoBoxKey.longPressSpeedDefault, longPressSpeedDefault);
|
VideoBoxKey.longPressSpeedDefault, longPressSpeedDefault);
|
||||||
} else if (id == -1) {
|
} else if (id == -1) {
|
||||||
if (customSpeedsList[index] == playSpeedDefault) {
|
late List speedsList =
|
||||||
playSpeedDefault = 1.0;
|
type == 'system' ? playSpeedSystem : customSpeedsList;
|
||||||
videoStorage.put(VideoBoxKey.playSpeedDefault, playSpeedDefault);
|
if (speedsList[index] == playSpeedDefault) {
|
||||||
|
SmartDialog.showToast('默认倍速不可删除');
|
||||||
}
|
}
|
||||||
if (customSpeedsList[index] == longPressSpeedDefault) {
|
if (speedsList[index] == longPressSpeedDefault) {
|
||||||
longPressSpeedDefault = 2.0;
|
longPressSpeedDefault = 2.0;
|
||||||
videoStorage.put(
|
videoStorage.put(
|
||||||
VideoBoxKey.longPressSpeedDefault, longPressSpeedDefault);
|
VideoBoxKey.longPressSpeedDefault, longPressSpeedDefault);
|
||||||
}
|
}
|
||||||
customSpeedsList.removeAt(index);
|
speedsList.removeAt(index);
|
||||||
await videoStorage.put(VideoBoxKey.customSpeedsList, customSpeedsList);
|
await videoStorage.put(
|
||||||
|
type == 'system'
|
||||||
|
? VideoBoxKey.playSpeedSystem
|
||||||
|
: VideoBoxKey.customSpeedsList,
|
||||||
|
speedsList);
|
||||||
}
|
}
|
||||||
setState(() {});
|
setState(() {});
|
||||||
SmartDialog.showToast('操作成功');
|
SmartDialog.showToast('操作成功');
|
||||||
@ -249,38 +252,40 @@ class _PlaySpeedPageState extends State<PlaySpeedPage> {
|
|||||||
subtitle: Text(longPressSpeedDefault.toString()),
|
subtitle: Text(longPressSpeedDefault.toString()),
|
||||||
)
|
)
|
||||||
: const SizedBox(),
|
: const SizedBox(),
|
||||||
Padding(
|
if (playSpeedSystem.isNotEmpty) ...[
|
||||||
padding: const EdgeInsets.only(
|
Padding(
|
||||||
left: 14,
|
padding: const EdgeInsets.only(
|
||||||
right: 14,
|
left: 14,
|
||||||
bottom: 10,
|
right: 14,
|
||||||
top: 20,
|
bottom: 10,
|
||||||
|
top: 20,
|
||||||
|
),
|
||||||
|
child: Text(
|
||||||
|
'系统预设倍速',
|
||||||
|
style: Theme.of(context).textTheme.titleMedium,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
child: Text(
|
Padding(
|
||||||
'系统预设倍速',
|
padding: const EdgeInsets.only(
|
||||||
style: Theme.of(context).textTheme.titleMedium,
|
left: 18,
|
||||||
),
|
right: 18,
|
||||||
),
|
bottom: 30,
|
||||||
Padding(
|
),
|
||||||
padding: const EdgeInsets.only(
|
child: Wrap(
|
||||||
left: 18,
|
alignment: WrapAlignment.start,
|
||||||
right: 18,
|
spacing: 8,
|
||||||
bottom: 30,
|
runSpacing: 2,
|
||||||
),
|
children: [
|
||||||
child: Wrap(
|
for (int i = 0; i < playSpeedSystem.length; i++) ...[
|
||||||
alignment: WrapAlignment.start,
|
FilledButton.tonal(
|
||||||
spacing: 8,
|
onPressed: () => showBottomSheet('system', i),
|
||||||
runSpacing: 2,
|
child: Text(playSpeedSystem[i].toString()),
|
||||||
children: [
|
),
|
||||||
for (var i in PlaySpeed.values) ...[
|
]
|
||||||
FilledButton.tonal(
|
],
|
||||||
onPressed: () => showBottomSheet('system', i.index),
|
),
|
||||||
child: Text(i.description),
|
)
|
||||||
),
|
],
|
||||||
]
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Padding(
|
Padding(
|
||||||
padding: const EdgeInsets.only(
|
padding: const EdgeInsets.only(
|
||||||
left: 14,
|
left: 14,
|
||||||
|
|||||||
@ -91,6 +91,7 @@ class VideoDetailController extends GetxController
|
|||||||
late int cacheAudioQa;
|
late int cacheAudioQa;
|
||||||
|
|
||||||
PersistentBottomSheetController? replyReplyBottomSheetCtr;
|
PersistentBottomSheetController? replyReplyBottomSheetCtr;
|
||||||
|
late bool enableRelatedVideo;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void onInit() {
|
void onInit() {
|
||||||
@ -113,7 +114,8 @@ class VideoDetailController extends GetxController
|
|||||||
autoPlay.value =
|
autoPlay.value =
|
||||||
setting.get(SettingBoxKey.autoPlayEnable, defaultValue: true);
|
setting.get(SettingBoxKey.autoPlayEnable, defaultValue: true);
|
||||||
enableHA.value = setting.get(SettingBoxKey.enableHA, defaultValue: true);
|
enableHA.value = setting.get(SettingBoxKey.enableHA, defaultValue: true);
|
||||||
|
enableRelatedVideo =
|
||||||
|
setting.get(SettingBoxKey.enableRelatedVideo, defaultValue: true);
|
||||||
if (userInfo == null ||
|
if (userInfo == null ||
|
||||||
localCache.get(LocalCacheKey.historyPause) == true) {
|
localCache.get(LocalCacheKey.historyPause) == true) {
|
||||||
enableHeart = false;
|
enableHeart = false;
|
||||||
|
|||||||
@ -161,9 +161,9 @@ class _SeasonPanelState extends State<SeasonPanel> {
|
|||||||
Expanded(
|
Expanded(
|
||||||
child: Material(
|
child: Material(
|
||||||
child: ScrollablePositionedList.builder(
|
child: ScrollablePositionedList.builder(
|
||||||
itemCount: episodes.length + 1,
|
itemCount: episodes.length,
|
||||||
itemBuilder: (BuildContext context, int index) {
|
itemBuilder: (BuildContext context, int index) {
|
||||||
bool isLastItem = index == episodes.length;
|
bool isLastItem = index == episodes.length - 1;
|
||||||
bool isCurrentIndex = currentIndex == index;
|
bool isCurrentIndex = currentIndex == index;
|
||||||
return isLastItem
|
return isLastItem
|
||||||
? SizedBox(
|
? SizedBox(
|
||||||
|
|||||||
@ -521,7 +521,10 @@ class _VideoDetailPageState extends State<VideoDetailPage>
|
|||||||
.withOpacity(0.06),
|
.withOpacity(0.06),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
const RelatedVideoPanel(),
|
if (videoDetailController.videoType ==
|
||||||
|
SearchType.video &&
|
||||||
|
videoDetailController.enableRelatedVideo)
|
||||||
|
const RelatedVideoPanel(),
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
|||||||
@ -47,7 +47,6 @@ class HeaderControl extends StatefulWidget implements PreferredSizeWidget {
|
|||||||
|
|
||||||
class _HeaderControlState extends State<HeaderControl> {
|
class _HeaderControlState extends State<HeaderControl> {
|
||||||
late PlayUrlModel videoInfo;
|
late PlayUrlModel videoInfo;
|
||||||
List<PlaySpeed> playSpeed = PlaySpeed.values;
|
|
||||||
static const TextStyle subTitleStyle = TextStyle(fontSize: 12);
|
static const TextStyle subTitleStyle = TextStyle(fontSize: 12);
|
||||||
static const TextStyle titleStyle = TextStyle(fontSize: 14);
|
static const TextStyle titleStyle = TextStyle(fontSize: 14);
|
||||||
Size get preferredSize => const Size(double.infinity, kToolbarHeight);
|
Size get preferredSize => const Size(double.infinity, kToolbarHeight);
|
||||||
|
|||||||
@ -292,11 +292,19 @@ class PlPlayerController {
|
|||||||
_longPressSpeed.value = videoStorage
|
_longPressSpeed.value = videoStorage
|
||||||
.get(VideoBoxKey.longPressSpeedDefault, defaultValue: 2.0);
|
.get(VideoBoxKey.longPressSpeedDefault, defaultValue: 2.0);
|
||||||
}
|
}
|
||||||
|
// 自定义倍速集合
|
||||||
speedsList = List<double>.from(videoStorage
|
speedsList = List<double>.from(videoStorage
|
||||||
.get(VideoBoxKey.customSpeedsList, defaultValue: <double>[]));
|
.get(VideoBoxKey.customSpeedsList, defaultValue: <double>[]));
|
||||||
for (final PlaySpeed i in PlaySpeed.values) {
|
// 默认倍速
|
||||||
speedsList.add(i.value);
|
speedsList = List<double>.from(videoStorage
|
||||||
}
|
.get(VideoBoxKey.customSpeedsList, defaultValue: <double>[]));
|
||||||
|
//playSpeedSystem
|
||||||
|
final List<double> playSpeedSystem =
|
||||||
|
videoStorage.get(VideoBoxKey.playSpeedSystem, defaultValue: playSpeed);
|
||||||
|
|
||||||
|
// for (final PlaySpeed i in PlaySpeed.values) {
|
||||||
|
speedsList.addAll(playSpeedSystem);
|
||||||
|
// }
|
||||||
|
|
||||||
// _playerEventSubs = onPlayerStatusChanged.listen((PlayerStatus status) {
|
// _playerEventSubs = onPlayerStatusChanged.listen((PlayerStatus status) {
|
||||||
// if (status == PlayerStatus.playing) {
|
// if (status == PlayerStatus.playing) {
|
||||||
@ -676,18 +684,6 @@ class PlPlayerController {
|
|||||||
_playbackSpeed.value = speed;
|
_playbackSpeed.value = speed;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// 设置倍速
|
|
||||||
// Future<void> togglePlaybackSpeed() async {
|
|
||||||
// List<double> allowedSpeeds =
|
|
||||||
// PlaySpeed.values.map<double>((e) => e.value).toList();
|
|
||||||
// int index = allowedSpeeds.indexOf(_playbackSpeed.value);
|
|
||||||
// if (index < allowedSpeeds.length - 1) {
|
|
||||||
// setPlaybackSpeed(allowedSpeeds[index + 1]);
|
|
||||||
// } else {
|
|
||||||
// setPlaybackSpeed(allowedSpeeds[0]);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
/// 播放视频
|
/// 播放视频
|
||||||
/// TODO _duration.value丢失
|
/// TODO _duration.value丢失
|
||||||
Future<void> play(
|
Future<void> play(
|
||||||
|
|||||||
@ -1,39 +1,15 @@
|
|||||||
enum PlaySpeed {
|
List<double> generatePlaySpeedList() {
|
||||||
pointTwoFive,
|
List<double> playSpeed = [];
|
||||||
pointFive,
|
double startSpeed = 0.25;
|
||||||
pointSevenFive,
|
double endSpeed = 2.0;
|
||||||
|
double increment = 0.25;
|
||||||
|
|
||||||
one,
|
for (double speed = startSpeed; speed <= endSpeed; speed += increment) {
|
||||||
onePointTwoFive,
|
playSpeed.add(speed);
|
||||||
onePointFive,
|
}
|
||||||
onePointSevenFive,
|
|
||||||
|
|
||||||
two,
|
return playSpeed;
|
||||||
}
|
}
|
||||||
|
|
||||||
extension PlaySpeedExtension on PlaySpeed {
|
// 导出 playSpeed 列表
|
||||||
static final List<String> _descList = [
|
List<double> playSpeed = generatePlaySpeedList();
|
||||||
'0.25',
|
|
||||||
'0.5',
|
|
||||||
'0.75',
|
|
||||||
'正常',
|
|
||||||
'1.25',
|
|
||||||
'1.5',
|
|
||||||
'1.75',
|
|
||||||
'2.0',
|
|
||||||
];
|
|
||||||
String get description => _descList[index];
|
|
||||||
|
|
||||||
static final List<double> _valueList = [
|
|
||||||
0.25,
|
|
||||||
0.5,
|
|
||||||
0.75,
|
|
||||||
1.0,
|
|
||||||
1.25,
|
|
||||||
1.5,
|
|
||||||
1.75,
|
|
||||||
2.0,
|
|
||||||
];
|
|
||||||
double get value => _valueList[index];
|
|
||||||
double get defaultValue => _valueList[3];
|
|
||||||
}
|
|
||||||
|
|||||||
@ -99,10 +99,8 @@ class CacheManage {
|
|||||||
try {
|
try {
|
||||||
// 清除缓存 图片缓存
|
// 清除缓存 图片缓存
|
||||||
await clearLibraryCache();
|
await clearLibraryCache();
|
||||||
Timer(const Duration(milliseconds: 500), () {
|
SmartDialog.dismiss().then((res) {
|
||||||
SmartDialog.dismiss().then((res) {
|
SmartDialog.showToast('清除完成');
|
||||||
SmartDialog.showToast('清除完成');
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
SmartDialog.dismiss();
|
SmartDialog.dismiss();
|
||||||
|
|||||||
@ -131,7 +131,8 @@ class SettingBoxKey {
|
|||||||
enableSearchWord = 'enableSearchWord',
|
enableSearchWord = 'enableSearchWord',
|
||||||
enableSystemProxy = 'enableSystemProxy',
|
enableSystemProxy = 'enableSystemProxy',
|
||||||
enableAi = 'enableAi',
|
enableAi = 'enableAi',
|
||||||
defaultHomePage = 'defaultHomePage';
|
defaultHomePage = 'defaultHomePage',
|
||||||
|
enableRelatedVideo = 'enableRelatedVideo';
|
||||||
|
|
||||||
/// 外观
|
/// 外观
|
||||||
static const String themeMode = 'themeMode',
|
static const String themeMode = 'themeMode',
|
||||||
@ -181,6 +182,8 @@ class VideoBoxKey {
|
|||||||
videoSpeed = 'videoSpeed',
|
videoSpeed = 'videoSpeed',
|
||||||
// 播放顺序
|
// 播放顺序
|
||||||
playRepeat = 'playRepeat',
|
playRepeat = 'playRepeat',
|
||||||
|
// 系统预设倍速
|
||||||
|
playSpeedSystem = 'playSpeedSystem',
|
||||||
// 默认倍速
|
// 默认倍速
|
||||||
playSpeedDefault = 'playSpeedDefault',
|
playSpeedDefault = 'playSpeedDefault',
|
||||||
// 默认长按倍速
|
// 默认长按倍速
|
||||||
|
|||||||
@ -50,6 +50,9 @@ class Utils {
|
|||||||
return time;
|
return time;
|
||||||
}
|
}
|
||||||
if (time < 3600) {
|
if (time < 3600) {
|
||||||
|
if (time == 0) {
|
||||||
|
return time;
|
||||||
|
}
|
||||||
final int minute = time ~/ 60;
|
final int minute = time ~/ 60;
|
||||||
final double res = time / 60;
|
final double res = time / 60;
|
||||||
if (minute != res) {
|
if (minute != res) {
|
||||||
@ -87,6 +90,9 @@ class Utils {
|
|||||||
|
|
||||||
// 时间显示,刚刚,x分钟前
|
// 时间显示,刚刚,x分钟前
|
||||||
static String dateFormat(timeStamp, {formatType = 'list'}) {
|
static String dateFormat(timeStamp, {formatType = 'list'}) {
|
||||||
|
if (timeStamp == 0 || timeStamp == null || timeStamp == '') {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
// 当前时间
|
// 当前时间
|
||||||
int time = (DateTime.now().millisecondsSinceEpoch / 1000).round();
|
int time = (DateTime.now().millisecondsSinceEpoch / 1000).round();
|
||||||
// 对比
|
// 对比
|
||||||
@ -103,6 +109,7 @@ class Utils {
|
|||||||
toInt: false,
|
toInt: false,
|
||||||
formatType: formatType);
|
formatType: formatType);
|
||||||
}
|
}
|
||||||
|
print('distance: $distance');
|
||||||
if (distance <= 60) {
|
if (distance <= 60) {
|
||||||
return '刚刚';
|
return '刚刚';
|
||||||
} else if (distance <= 3600) {
|
} else if (distance <= 3600) {
|
||||||
@ -236,6 +243,10 @@ class Utils {
|
|||||||
SmartDialog.dismiss();
|
SmartDialog.dismiss();
|
||||||
var currentInfo = await PackageInfo.fromPlatform();
|
var currentInfo = await PackageInfo.fromPlatform();
|
||||||
var result = await Request().get(Api.latestApp, extra: {'ua': 'mob'});
|
var result = await Request().get(Api.latestApp, extra: {'ua': 'mob'});
|
||||||
|
if (result.data == null || result.data.isEmpty) {
|
||||||
|
SmartDialog.showToast('获取远程版本失败,请检查网络');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
LatestDataModel data = LatestDataModel.fromJson(result.data);
|
LatestDataModel data = LatestDataModel.fromJson(result.data);
|
||||||
bool isUpdate = Utils.needUpdate(currentInfo.version, data.tagName!);
|
bool isUpdate = Utils.needUpdate(currentInfo.version, data.tagName!);
|
||||||
if (isUpdate) {
|
if (isUpdate) {
|
||||||
@ -344,9 +355,8 @@ class Utils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static List<int> generateRandomBytes(int minLength, int maxLength) {
|
static List<int> generateRandomBytes(int minLength, int maxLength) {
|
||||||
return List<int>.generate(
|
return List<int>.generate(random.nextInt(maxLength - minLength + 1),
|
||||||
random.nextInt(maxLength-minLength+1), (_) => random.nextInt(0x60) + 0x20
|
(_) => random.nextInt(0x60) + 0x20);
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static String base64EncodeRandomString(int minLength, int maxLength) {
|
static String base64EncodeRandomString(int minLength, int maxLength) {
|
||||||
|
|||||||
Reference in New Issue
Block a user