mod: 侧边栏、动态重构,排行改为首页分区,平板、折叠屏、竖屏视频新适配,播放页可隐藏黑边、截图、点踩,弹幕粗细调整,默认关闭后台播放,弹窗接受返回

This commit is contained in:
orz12
2024-05-20 14:46:31 +08:00
parent fd51cddeca
commit 074bf03946
97 changed files with 4105 additions and 2672 deletions

View File

@@ -51,18 +51,17 @@ class HistoryController extends GetxController {
}
// 暂停观看历史
Future onPauseHistory() async {
SmartDialog.show(
useSystem: true,
animationType: SmartAnimationType.centerFade_otherSlide,
builder: (BuildContext context) {
Future onPauseHistory(BuildContext context) async {
await showDialog(
context: context,
builder: (context) {
return AlertDialog(
title: const Text('提示'),
content:
Text(!pauseStatus.value ? '啊叻?你要暂停历史记录功能吗?' : '啊叻?要恢复历史记录功能吗?'),
actions: [
TextButton(
onPressed: () => SmartDialog.dismiss(),
onPressed: () => Get.back(),
child: const Text('取消')),
TextButton(
onPressed: () async {
@@ -75,7 +74,7 @@ class HistoryController extends GetxController {
pauseStatus.value = !pauseStatus.value;
localCache.put(LocalCacheKey.historyPause, pauseStatus.value);
}
SmartDialog.dismiss();
Get.back();
},
child: Text(!pauseStatus.value ? '确认暂停' : '确认恢复'),
)
@@ -97,17 +96,16 @@ class HistoryController extends GetxController {
}
// 清空观看历史
Future onClearHistory() async {
SmartDialog.show(
useSystem: true,
animationType: SmartAnimationType.centerFade_otherSlide,
builder: (BuildContext context) {
Future onClearHistory(BuildContext context) async {
await showDialog(
context: context,
builder: (context) {
return AlertDialog(
title: const Text('提示'),
content: const Text('啊叻?你要清空历史记录功能吗?'),
actions: [
TextButton(
onPressed: () => SmartDialog.dismiss(),
onPressed: () => Get.back(),
child: const Text('取消')),
TextButton(
onPressed: () async {
@@ -117,7 +115,7 @@ class HistoryController extends GetxController {
if (res.data['code'] == 0) {
SmartDialog.showToast('清空观看历史');
}
SmartDialog.dismiss();
Get.back();
historyList.clear();
},
child: const Text('确认清空'),
@@ -158,17 +156,16 @@ class HistoryController extends GetxController {
}
// 删除选中的记录
Future onDelCheckedHistory() async {
SmartDialog.show(
useSystem: true,
animationType: SmartAnimationType.centerFade_otherSlide,
builder: (BuildContext context) {
Future onDelCheckedHistory(BuildContext context) async {
await showDialog(
context: context,
builder: (context) {
return AlertDialog(
title: const Text('提示'),
content: const Text('确认删除所选历史记录吗?'),
actions: [
TextButton(
onPressed: () => SmartDialog.dismiss(),
onPressed: () => Get.back(),
child: Text(
'取消',
style: TextStyle(
@@ -179,7 +176,7 @@ class HistoryController extends GetxController {
TextButton(
onPressed: () async {
/// TODO 优化
await SmartDialog.dismiss();
Get.back();
SmartDialog.showLoading(msg: '请求中');
List<HisListItem> result =
historyList.where((e) => e.checked!).toList();

View File

@@ -87,10 +87,10 @@ class _HistoryPageState extends State<HistoryPage> {
// 处理菜单项选择的逻辑
switch (type) {
case 'pause':
_historyController.onPauseHistory();
_historyController.onPauseHistory(context);
break;
case 'clear':
_historyController.onClearHistory();
_historyController.onClearHistory(context);
break;
case 'del':
_historyController.onDelHistory();
@@ -162,7 +162,7 @@ class _HistoryPageState extends State<HistoryPage> {
child: const Text('全选'),
),
TextButton(
onPressed: () => _historyController.onDelCheckedHistory(),
onPressed: () => _historyController.onDelCheckedHistory(context),
child: Text(
'删除',
style: TextStyle(color: Theme.of(context).colorScheme.error),
@@ -194,16 +194,13 @@ class _HistoryPageState extends State<HistoryPage> {
() => _historyController.historyList.isNotEmpty
? SliverGrid(
gridDelegate:
SliverGridDelegateWithMaxCrossAxisExtent(
SliverGridDelegateWithExtentAndRatio(
mainAxisSpacing: StyleString.cardSpace,
crossAxisSpacing: StyleString.safeSpace,
maxCrossAxisExtent: Grid.maxRowWidth * 2,
mainAxisExtent: Grid.calculateActualWidth(
context,
Grid.maxRowWidth * 2,
StyleString.safeSpace) /
2.1 /
StyleString.aspectRatio),
childAspectRatio:
StyleString.aspectRatio * 2.3,
mainAxisExtent: 0),
delegate: SliverChildBuilderDelegate(
(context, index) {
return HistoryItem(
@@ -231,7 +228,13 @@ class _HistoryPageState extends State<HistoryPage> {
}
} else {
// 骨架屏
return SliverList(
return SliverGrid(
gridDelegate: SliverGridDelegateWithExtentAndRatio(
mainAxisSpacing: StyleString.cardSpace,
crossAxisSpacing: StyleString.safeSpace,
maxCrossAxisExtent: Grid.maxRowWidth * 2,
childAspectRatio: StyleString.aspectRatio * 2.3,
mainAxisExtent: 0),
delegate: SliverChildBuilderDelegate((context, index) {
return const VideoCardHSkeleton();
}, childCount: 10),