2024-02-15 15:23:02 +03:30
|
|
|
import 'package:fluentui_system_icons/fluentui_system_icons.dart';
|
2023-07-06 17:18:41 +03:30
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
import 'package:go_router/go_router.dart';
|
|
|
|
|
|
|
|
|
|
Future<bool> showConfirmationDialog(
|
|
|
|
|
BuildContext context, {
|
|
|
|
|
required String title,
|
|
|
|
|
required String message,
|
|
|
|
|
IconData? icon,
|
|
|
|
|
}) async {
|
|
|
|
|
return showDialog<bool>(
|
|
|
|
|
context: context,
|
|
|
|
|
builder: (context) {
|
|
|
|
|
final localizations = MaterialLocalizations.of(context);
|
|
|
|
|
return AlertDialog(
|
2024-02-15 15:23:02 +03:30
|
|
|
icon: const Icon(FluentIcons.delete_24_regular),
|
2023-07-06 17:18:41 +03:30
|
|
|
title: Text(title),
|
|
|
|
|
content: Text(message),
|
|
|
|
|
actions: [
|
|
|
|
|
TextButton(
|
|
|
|
|
onPressed: () => context.pop(true),
|
|
|
|
|
child: Text(localizations.okButtonLabel),
|
|
|
|
|
),
|
|
|
|
|
TextButton(
|
|
|
|
|
onPressed: () => context.pop(false),
|
|
|
|
|
child: Text(localizations.cancelButtonLabel),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
);
|
|
|
|
|
},
|
|
|
|
|
).then((value) => value ?? false);
|
|
|
|
|
}
|