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

@@ -533,116 +533,93 @@ class AudioController extends GetxController
: '${HttpString.baseUrl}/audio/au$oid';
showDialog(
context: context,
builder: (_) => AlertDialog(
builder: (_) => SimpleDialog(
clipBehavior: Clip.hardEdge,
contentPadding: const EdgeInsets.symmetric(vertical: 12),
content: Column(
mainAxisSize: MainAxisSize.min,
children: [
ListTile(
dense: true,
title: const Text(
'复制链接',
style: TextStyle(fontSize: 14),
),
onTap: () {
Get.back();
Utils.copyText(audioUrl);
},
),
ListTile(
dense: true,
title: const Text(
'其它app打开',
style: TextStyle(fontSize: 14),
),
onTap: () {
Get.back();
PageUtils.launchURL(audioUrl);
},
),
if (PlatformUtils.isMobile)
ListTile(
dense: true,
title: const Text(
'分享视频',
style: TextStyle(fontSize: 14),
),
onTap: () {
Get.back();
if (audioItem.value case DetailItem(
:final arc,
:final owner,
)) {
ShareUtils.shareText(
'${arc.title} '
'UP主: ${owner.name}'
' - $audioUrl',
);
}
},
),
ListTile(
dense: true,
title: const Text(
'分享至动态',
style: TextStyle(fontSize: 14),
),
onTap: () {
children: [
SimpleDialogOption(
child: const Text('复制链接', style: TextStyle(fontSize: 14)),
onPressed: () {
Get.back();
Utils.copyText(audioUrl);
},
),
SimpleDialogOption(
child: const Text('其它app打开', style: TextStyle(fontSize: 14)),
onPressed: () {
Get.back();
PageUtils.launchURL(audioUrl);
},
),
if (PlatformUtils.isMobile)
SimpleDialogOption(
child: const Text('分享视频', style: TextStyle(fontSize: 14)),
onPressed: () {
Get.back();
if (audioItem.value case DetailItem(
:final arc,
:final owner,
)) {
showModalBottomSheet(
context: context,
isScrollControlled: true,
useSafeArea: true,
builder: (context) => RepostPanel(
rid: oid.toInt(),
dynType: isUgc ? 8 : 256,
pic: arc.cover,
title: arc.title,
uname: owner.name,
),
ShareUtils.shareText(
'${arc.title} '
'UP主: ${owner.name}'
' - $audioUrl',
);
}
},
),
if (isUgc)
ListTile(
dense: true,
title: const Text(
'分享至消息',
style: TextStyle(fontSize: 14),
),
onTap: () {
Get.back();
if (audioItem.value case DetailItem(
:final arc,
:final owner,
)) {
try {
PageUtils.pmShare(
context,
content: {
"id": oid.toString(),
"title": arc.title,
"headline": arc.title,
"source": 5,
"thumb": arc.cover,
"author": owner.name,
"author_id": owner.mid.toString(),
},
);
} catch (e) {
SmartDialog.showToast(e.toString());
}
SimpleDialogOption(
child: const Text('分享至动态', style: TextStyle(fontSize: 14)),
onPressed: () {
Get.back();
if (audioItem.value case DetailItem(
:final arc,
:final owner,
)) {
showModalBottomSheet(
context: context,
isScrollControlled: true,
useSafeArea: true,
builder: (context) => RepostPanel(
rid: oid.toInt(),
dynType: isUgc ? 8 : 256,
pic: arc.cover,
title: arc.title,
uname: owner.name,
),
);
}
},
),
if (isUgc)
SimpleDialogOption(
child: const Text('分享至消息', style: TextStyle(fontSize: 14)),
onPressed: () {
Get.back();
if (audioItem.value case DetailItem(
:final arc,
:final owner,
)) {
try {
PageUtils.pmShare(
context,
content: {
"id": oid.toString(),
"title": arc.title,
"headline": arc.title,
"source": 5,
"thumb": arc.cover,
"author": owner.name,
"author_id": owner.mid.toString(),
},
);
} catch (e) {
SmartDialog.showToast(e.toString());
}
},
),
],
),
}
},
),
],
),
);
}