opt: simple dialog

This commit is contained in:
My-Responsitories
2026-06-13 11:58:33 +08:00
parent c63fe3866c
commit 3085d58508
26 changed files with 1184 additions and 1433 deletions

View File

@@ -61,48 +61,37 @@ class DetailItem extends StatelessWidget {
void onLongPress() => canDel && !enableMultiSelect
? showDialog(
context: context,
builder: (context) => AlertDialog(
builder: (context) => SimpleDialog(
clipBehavior: Clip.hardEdge,
contentPadding: const EdgeInsets.symmetric(vertical: 12),
content: Column(
mainAxisSize: MainAxisSize.min,
children: [
ListTile(
onTap: () {
Get.back();
showConfirmDialog(
context: context,
title: const Text('确定删除该视频?'),
onConfirm: onDelete,
);
},
dense: true,
title: const Text(
'删除',
style: TextStyle(fontSize: 14),
),
),
ListTile(
onTap: () async {
Get.back();
final res = await downloadService.downloadDanmaku(
entry: entry,
isUpdate: true,
);
if (res) {
SmartDialog.showToast('更新成功');
} else {
SmartDialog.showToast('更新失败');
}
},
dense: true,
title: const Text(
'更新弹幕',
style: TextStyle(fontSize: 14),
),
),
],
),
children: [
SimpleDialogOption(
onPressed: () {
Get.back();
showConfirmDialog(
context: context,
title: const Text('确定删除该视频?'),
onConfirm: onDelete,
);
},
child: const Text('删除', style: TextStyle(fontSize: 14)),
),
SimpleDialogOption(
onPressed: () async {
Get.back();
final res = await downloadService.downloadDanmaku(
entry: entry,
isUpdate: true,
);
if (res) {
SmartDialog.showToast('更新成功');
} else {
SmartDialog.showToast('更新失败');
}
},
child: const Text('更新弹幕', style: TextStyle(fontSize: 14)),
),
],
),
)
: null;

View File

@@ -232,59 +232,48 @@ class _DownloadPageState extends State<DownloadPage> {
? null
: showDialog(
context: context,
builder: (context) => AlertDialog(
builder: (context) => SimpleDialog(
clipBehavior: Clip.hardEdge,
contentPadding: const EdgeInsets.symmetric(vertical: 12),
content: Column(
mainAxisSize: MainAxisSize.min,
children: [
ListTile(
onTap: () {
Get.back();
showConfirmDialog(
context: context,
title: const Text('确定删除?'),
onConfirm: () async {
await GStorage.watchProgress.deleteAll(
pageInfo.entries.map((e) => e.cid.toString()),
);
_downloadService.deletePage(
pageDirPath: pageInfo.dirPath,
);
},
);
},
dense: true,
title: const Text(
'删除',
style: TextStyle(fontSize: 14),
),
),
ListTile(
onTap: () async {
Get.back();
final res = await Future.wait(
pageInfo.entries.map(
(e) => _downloadService.downloadDanmaku(
entry: e,
isUpdate: true,
),
children: [
SimpleDialogOption(
onPressed: () {
Get.back();
showConfirmDialog(
context: context,
title: const Text('确定删除?'),
onConfirm: () async {
await GStorage.watchProgress.deleteAll(
pageInfo.entries.map((e) => e.cid.toString()),
);
_downloadService.deletePage(
pageDirPath: pageInfo.dirPath,
);
},
);
},
child: const Text('删除', style: TextStyle(fontSize: 14)),
),
SimpleDialogOption(
onPressed: () async {
Get.back();
final res = await Future.wait(
pageInfo.entries.map(
(e) => _downloadService.downloadDanmaku(
entry: e,
isUpdate: true,
),
);
if (res.every((e) => e)) {
SmartDialog.showToast('更新成功');
} else {
SmartDialog.showToast('更新失败');
}
},
dense: true,
title: const Text(
'更新弹幕',
style: TextStyle(fontSize: 14),
),
),
],
),
),
);
if (res.every((e) => e)) {
SmartDialog.showToast('更新成功');
} else {
SmartDialog.showToast('更新失败');
}
},
child: const Text('更新弹幕', style: TextStyle(fontSize: 14)),
),
],
),
);
final first = pageInfo.entries.first;