mirror of
https://github.com/bggRGjQaUbCoE/PiliPlus.git
synced 2026-06-27 21:00:17 +08:00
* opt: danmaku weight
* opt: cache clean
* opt: level img
* opt: play icon
* opt: svg big-vip
* opt: webview ua
* opt: simple dialog
* feat: export vtt
* tweak
* opt: mapIndexed
* feat: more subtitle
* refa: settings page
* feat: codec list options
* drawPath
Signed-off-by: dom <githubaccount56556@proton.me>
* custom dialog option
Signed-off-by: dom <githubaccount56556@proton.me>
* update
Signed-off-by: dom <githubaccount56556@proton.me>
* Revert "drawPath"
This reverts commit e8a4b19f0f.
* opt: _initStreamIndex
* fix: avoid gap
* fix: scale [skip ci]
* fix: hide repost menu not login
* tweaks
Signed-off-by: dom <githubaccount56556@proton.me>
---------
Co-authored-by: dom <githubaccount56556@proton.me>
103 lines
2.6 KiB
Dart
103 lines
2.6 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:get/get.dart';
|
|
|
|
Future<bool> showConfirmDialog({
|
|
required BuildContext context,
|
|
required Widget title,
|
|
Widget? content,
|
|
// @Deprecated('use `bool result = await showConfirmDialog()` instead')
|
|
VoidCallback? onConfirm,
|
|
}) async {
|
|
return await showDialog<bool>(
|
|
context: context,
|
|
builder: (context) => AlertDialog(
|
|
title: title,
|
|
content: content,
|
|
actions: [
|
|
TextButton(
|
|
onPressed: Get.back,
|
|
child: Text(
|
|
'取消',
|
|
style: TextStyle(
|
|
color: Theme.of(context).colorScheme.outline,
|
|
),
|
|
),
|
|
),
|
|
TextButton(
|
|
onPressed: () {
|
|
Get.back(result: true);
|
|
onConfirm?.call();
|
|
},
|
|
child: const Text('确认'),
|
|
),
|
|
],
|
|
),
|
|
) ??
|
|
false;
|
|
}
|
|
|
|
void showPgcFollowDialog({
|
|
required BuildContext context,
|
|
required String type,
|
|
required int followStatus,
|
|
required ValueChanged<int> onUpdateStatus,
|
|
}) {
|
|
Widget statusItem({
|
|
required bool enabled,
|
|
required String text,
|
|
required VoidCallback onTap,
|
|
}) {
|
|
return ListTile(
|
|
dense: true,
|
|
enabled: enabled,
|
|
title: Padding(
|
|
padding: const EdgeInsets.only(left: 10),
|
|
child: Text(
|
|
'标记为 $text',
|
|
style: const TextStyle(fontSize: 14),
|
|
),
|
|
),
|
|
trailing: !enabled ? const Icon(size: 22, Icons.check) : null,
|
|
onTap: onTap,
|
|
);
|
|
}
|
|
|
|
showDialog(
|
|
context: context,
|
|
builder: (context) => SimpleDialog(
|
|
clipBehavior: Clip.hardEdge,
|
|
contentPadding: const EdgeInsets.symmetric(vertical: 12),
|
|
children: [
|
|
...const [
|
|
(followStatus: 3, title: '看过'),
|
|
(followStatus: 2, title: '在看'),
|
|
(followStatus: 1, title: '想看'),
|
|
].map(
|
|
(item) => statusItem(
|
|
enabled: followStatus != item.followStatus,
|
|
text: item.title,
|
|
onTap: () {
|
|
Get.back();
|
|
onUpdateStatus(item.followStatus);
|
|
},
|
|
),
|
|
),
|
|
ListTile(
|
|
dense: true,
|
|
title: Padding(
|
|
padding: const EdgeInsets.only(left: 10),
|
|
child: Text(
|
|
'取消$type',
|
|
style: const TextStyle(fontSize: 14),
|
|
),
|
|
),
|
|
onTap: () {
|
|
Get.back();
|
|
onUpdateStatus(-1);
|
|
},
|
|
),
|
|
],
|
|
),
|
|
);
|
|
}
|