🐛 Fix inconsistence alert
This commit is contained in:
@@ -167,22 +167,10 @@ class _CreatorSiteItem extends HookConsumerWidget {
|
|||||||
],
|
],
|
||||||
),
|
),
|
||||||
onTap: () async {
|
onTap: () async {
|
||||||
final confirmed = await showDialog<bool>(
|
final confirmed = await showConfirmAlert(
|
||||||
context: context,
|
'publicationSiteDeleteConfirm'.tr(),
|
||||||
builder: (context) => AlertDialog(
|
'deleteSite'.tr(),
|
||||||
title: Text('deleteSite'.tr()),
|
isDanger: true,
|
||||||
content: Text('deleteSiteConfirm'.tr()),
|
|
||||||
actions: [
|
|
||||||
TextButton(
|
|
||||||
onPressed: () => Navigator.of(context).pop(false),
|
|
||||||
child: Text('cancel'.tr()),
|
|
||||||
),
|
|
||||||
TextButton(
|
|
||||||
onPressed: () => Navigator.of(context).pop(true),
|
|
||||||
child: Text('delete'.tr()),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
);
|
);
|
||||||
if (confirmed == true) {
|
if (confirmed == true) {
|
||||||
try {
|
try {
|
||||||
|
|||||||
@@ -19,64 +19,50 @@ class SiteActionMenu extends HookConsumerWidget {
|
|||||||
@override
|
@override
|
||||||
Widget build(BuildContext context, WidgetRef ref) {
|
Widget build(BuildContext context, WidgetRef ref) {
|
||||||
return PopupMenuButton<String>(
|
return PopupMenuButton<String>(
|
||||||
itemBuilder:
|
itemBuilder: (context) => [
|
||||||
(context) => [
|
PopupMenuItem(
|
||||||
PopupMenuItem(
|
value: 'edit',
|
||||||
value: 'edit',
|
child: Row(
|
||||||
child: Row(
|
children: [
|
||||||
children: [
|
Icon(
|
||||||
Icon(
|
Symbols.edit,
|
||||||
Symbols.edit,
|
color: Theme.of(context).colorScheme.onSurface,
|
||||||
color: Theme.of(context).colorScheme.onSurface,
|
|
||||||
),
|
|
||||||
const Gap(16),
|
|
||||||
Text('edit'.tr()),
|
|
||||||
],
|
|
||||||
),
|
),
|
||||||
),
|
const Gap(16),
|
||||||
const PopupMenuDivider(),
|
Text('edit'.tr()),
|
||||||
PopupMenuItem(
|
],
|
||||||
value: 'delete',
|
),
|
||||||
child: Row(
|
),
|
||||||
children: [
|
const PopupMenuDivider(),
|
||||||
const Icon(Symbols.delete, color: Colors.red),
|
PopupMenuItem(
|
||||||
const Gap(16),
|
value: 'delete',
|
||||||
Text('delete'.tr()).textColor(Colors.red),
|
child: Row(
|
||||||
],
|
children: [
|
||||||
),
|
const Icon(Symbols.delete, color: Colors.red),
|
||||||
),
|
const Gap(16),
|
||||||
],
|
Text('delete'.tr()).textColor(Colors.red),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
onSelected: (value) async {
|
onSelected: (value) async {
|
||||||
switch (value) {
|
switch (value) {
|
||||||
case 'edit':
|
case 'edit':
|
||||||
showModalBottomSheet(
|
showModalBottomSheet(
|
||||||
context: context,
|
context: context,
|
||||||
isScrollControlled: true,
|
isScrollControlled: true,
|
||||||
builder:
|
builder: (context) =>
|
||||||
(context) => SiteForm(pubName: pubName, siteSlug: site.slug),
|
SiteForm(pubName: pubName, siteSlug: site.slug),
|
||||||
).then((_) {
|
).then((_) {
|
||||||
// Refresh site data after potential edit
|
// Refresh site data after potential edit
|
||||||
ref.invalidate(publicationSiteDetailProvider(pubName, site.slug));
|
ref.invalidate(publicationSiteDetailProvider(pubName, site.slug));
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
case 'delete':
|
case 'delete':
|
||||||
final confirmed = await showDialog<bool>(
|
final confirmed = await showConfirmAlert(
|
||||||
context: context,
|
'publicationSiteDeleteConfirm'.tr(),
|
||||||
builder:
|
'deleteSite'.tr(),
|
||||||
(context) => AlertDialog(
|
isDanger: true,
|
||||||
title: Text('deleteSite'.tr()),
|
|
||||||
content: Text('publicationSiteDeleteConfirm'.tr()),
|
|
||||||
actions: [
|
|
||||||
TextButton(
|
|
||||||
onPressed: () => Navigator.of(context).pop(false),
|
|
||||||
child: Text('cancel'.tr()),
|
|
||||||
),
|
|
||||||
TextButton(
|
|
||||||
onPressed: () => Navigator.of(context).pop(true),
|
|
||||||
child: Text('delete'.tr()),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
);
|
);
|
||||||
|
|
||||||
if (confirmed == true) {
|
if (confirmed == true) {
|
||||||
|
|||||||
Reference in New Issue
Block a user