mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-06 09:13:48 +08:00
show history pause tip
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
@@ -67,126 +67,123 @@ class _HistoryPageState extends State<HistoryPage>
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
child: Scaffold(
|
child: Scaffold(
|
||||||
appBar: widget.type != null
|
appBar: AppBarWidget(
|
||||||
? null
|
visible: enableMultiSelect,
|
||||||
: AppBarWidget(
|
child1: AppBar(
|
||||||
visible: enableMultiSelect,
|
title: const Text('观看记录'),
|
||||||
child1: AppBar(
|
actions: [
|
||||||
title: const Text('观看记录'),
|
IconButton(
|
||||||
actions: [
|
tooltip: '搜索',
|
||||||
IconButton(
|
onPressed: () => Get.toNamed('/historySearch'),
|
||||||
tooltip: '搜索',
|
icon: const Icon(Icons.search_outlined),
|
||||||
onPressed: () => Get.toNamed('/historySearch'),
|
),
|
||||||
icon: const Icon(Icons.search_outlined),
|
PopupMenuButton<String>(
|
||||||
),
|
onSelected: (String type) {
|
||||||
PopupMenuButton<String>(
|
// 处理菜单项选择的逻辑
|
||||||
onSelected: (String type) {
|
switch (type) {
|
||||||
// 处理菜单项选择的逻辑
|
case 'pause':
|
||||||
switch (type) {
|
_historyController.baseCtr.onPauseHistory(
|
||||||
case 'pause':
|
context,
|
||||||
_historyController.baseCtr.onPauseHistory(
|
);
|
||||||
context,
|
break;
|
||||||
);
|
case 'clear':
|
||||||
break;
|
_historyController.baseCtr.onClearHistory(
|
||||||
case 'clear':
|
context,
|
||||||
_historyController.baseCtr.onClearHistory(
|
() {
|
||||||
context,
|
_historyController.loadingState.value =
|
||||||
() {
|
const Success(
|
||||||
_historyController
|
null,
|
||||||
.loadingState
|
);
|
||||||
.value = const Success(
|
if (_historyController.tabController !=
|
||||||
|
null) {
|
||||||
|
for (final item
|
||||||
|
in _historyController.tabs) {
|
||||||
|
try {
|
||||||
|
Get.find<HistoryController>(
|
||||||
|
tag: item.type,
|
||||||
|
).loadingState.value = const Success(
|
||||||
null,
|
null,
|
||||||
);
|
);
|
||||||
if (_historyController
|
} catch (_) {}
|
||||||
.tabController !=
|
}
|
||||||
null) {
|
}
|
||||||
for (final item
|
},
|
||||||
in _historyController.tabs) {
|
);
|
||||||
try {
|
break;
|
||||||
Get.find<HistoryController>(
|
case 'del':
|
||||||
tag: item.type,
|
currCtr().onDelHistory();
|
||||||
).loadingState.value =
|
break;
|
||||||
const Success(null);
|
case 'multiple':
|
||||||
} catch (_) {}
|
_historyController
|
||||||
}
|
.baseCtr
|
||||||
}
|
.enableMultiSelect
|
||||||
},
|
.value =
|
||||||
);
|
true;
|
||||||
break;
|
break;
|
||||||
case 'del':
|
}
|
||||||
currCtr().onDelHistory();
|
},
|
||||||
break;
|
itemBuilder: (BuildContext context) =>
|
||||||
case 'multiple':
|
<PopupMenuEntry<String>>[
|
||||||
_historyController
|
PopupMenuItem<String>(
|
||||||
|
value: 'pause',
|
||||||
|
child: Obx(
|
||||||
|
() => Text(
|
||||||
|
!_historyController
|
||||||
.baseCtr
|
.baseCtr
|
||||||
.enableMultiSelect
|
.pauseStatus
|
||||||
.value =
|
.value
|
||||||
true;
|
? '暂停观看记录'
|
||||||
break;
|
: '恢复观看记录',
|
||||||
}
|
),
|
||||||
},
|
|
||||||
itemBuilder: (BuildContext context) =>
|
|
||||||
<PopupMenuEntry<String>>[
|
|
||||||
PopupMenuItem<String>(
|
|
||||||
value: 'pause',
|
|
||||||
child: Obx(
|
|
||||||
() => Text(
|
|
||||||
!_historyController
|
|
||||||
.baseCtr
|
|
||||||
.pauseStatus
|
|
||||||
.value
|
|
||||||
? '暂停观看记录'
|
|
||||||
: '恢复观看记录',
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
const PopupMenuItem<String>(
|
|
||||||
value: 'clear',
|
|
||||||
child: Text('清空观看记录'),
|
|
||||||
),
|
|
||||||
const PopupMenuItem<String>(
|
|
||||||
value: 'del',
|
|
||||||
child: Text('删除已看记录'),
|
|
||||||
),
|
|
||||||
const PopupMenuItem<String>(
|
|
||||||
value: 'multiple',
|
|
||||||
child: Text('多选删除'),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
const SizedBox(width: 6),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
child2: AppBar(
|
|
||||||
leading: IconButton(
|
|
||||||
tooltip: '取消',
|
|
||||||
onPressed: currCtr().handleSelect,
|
|
||||||
icon: const Icon(Icons.close_outlined),
|
|
||||||
),
|
|
||||||
title: Obx(
|
|
||||||
() => Text(
|
|
||||||
'已选: ${_historyController.baseCtr.checkedCount.value}',
|
|
||||||
),
|
|
||||||
),
|
|
||||||
actions: [
|
|
||||||
TextButton(
|
|
||||||
onPressed: () => currCtr().handleSelect(true),
|
|
||||||
child: const Text('全选'),
|
|
||||||
),
|
|
||||||
TextButton(
|
|
||||||
onPressed: () =>
|
|
||||||
currCtr().onDelCheckedHistory(context),
|
|
||||||
child: Text(
|
|
||||||
'删除',
|
|
||||||
style: TextStyle(
|
|
||||||
color: Theme.of(context).colorScheme.error,
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
const PopupMenuItem<String>(
|
||||||
const SizedBox(width: 6),
|
value: 'clear',
|
||||||
],
|
child: Text('清空观看记录'),
|
||||||
|
),
|
||||||
|
const PopupMenuItem<String>(
|
||||||
|
value: 'del',
|
||||||
|
child: Text('删除已看记录'),
|
||||||
|
),
|
||||||
|
const PopupMenuItem<String>(
|
||||||
|
value: 'multiple',
|
||||||
|
child: Text('多选删除'),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
const SizedBox(width: 6),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
child2: AppBar(
|
||||||
|
leading: IconButton(
|
||||||
|
tooltip: '取消',
|
||||||
|
onPressed: currCtr().handleSelect,
|
||||||
|
icon: const Icon(Icons.close_outlined),
|
||||||
|
),
|
||||||
|
title: Obx(
|
||||||
|
() => Text(
|
||||||
|
'已选: ${_historyController.baseCtr.checkedCount.value}',
|
||||||
|
),
|
||||||
|
),
|
||||||
|
actions: [
|
||||||
|
TextButton(
|
||||||
|
onPressed: () => currCtr().handleSelect(true),
|
||||||
|
child: const Text('全选'),
|
||||||
|
),
|
||||||
|
TextButton(
|
||||||
|
onPressed: () =>
|
||||||
|
currCtr().onDelCheckedHistory(context),
|
||||||
|
child: Text(
|
||||||
|
'删除',
|
||||||
|
style: TextStyle(
|
||||||
|
color: Theme.of(context).colorScheme.error,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
const SizedBox(width: 6),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
body: Obx(
|
body: Obx(
|
||||||
() => _historyController.tabs.isNotEmpty
|
() => _historyController.tabs.isNotEmpty
|
||||||
? SafeArea(
|
? SafeArea(
|
||||||
@@ -300,8 +297,22 @@ class _HistoryPageState extends State<HistoryPage>
|
|||||||
childCount: response!.length,
|
childCount: response!.length,
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
: HttpError(
|
: Builder(
|
||||||
onReload: _historyController.onReload,
|
builder: (context) {
|
||||||
|
final pauseStatus =
|
||||||
|
_historyController.baseCtr.pauseStatus.value;
|
||||||
|
return HttpError(
|
||||||
|
errMsg: pauseStatus ? '历史记录功能已关闭' : null,
|
||||||
|
btnText: pauseStatus ? '点击开启' : null,
|
||||||
|
onReload: () {
|
||||||
|
if (pauseStatus) {
|
||||||
|
_historyController.baseCtr.onPauseHistory(context);
|
||||||
|
} else {
|
||||||
|
_historyController.onReload();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
);
|
||||||
|
},
|
||||||
),
|
),
|
||||||
Error(:var errMsg) => HttpError(
|
Error(:var errMsg) => HttpError(
|
||||||
errMsg: errMsg,
|
errMsg: errMsg,
|
||||||
|
|||||||
Reference in New Issue
Block a user