initial
This commit is contained in:
31
lib/features/common/confirmation_dialogs.dart
Normal file
31
lib/features/common/confirmation_dialogs.dart
Normal file
@@ -0,0 +1,31 @@
|
||||
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(
|
||||
icon: const Icon(Icons.delete_forever),
|
||||
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);
|
||||
}
|
||||
Reference in New Issue
Block a user