27 lines
644 B
Dart
27 lines
644 B
Dart
import 'package:flutter/material.dart';
|
|
|
|
Future<bool> showConfirmDialog(
|
|
BuildContext context, {
|
|
required String title,
|
|
required String message,
|
|
}) async {
|
|
final result = await showDialog<bool>(
|
|
context: context,
|
|
builder: (context) => AlertDialog(
|
|
title: Text(title),
|
|
content: Text(message),
|
|
actions: [
|
|
TextButton(
|
|
onPressed: () => Navigator.pop(context, false),
|
|
child: const Text('Cancel'),
|
|
),
|
|
FilledButton(
|
|
onPressed: () => Navigator.pop(context, true),
|
|
child: const Text('Confirm'),
|
|
),
|
|
],
|
|
),
|
|
);
|
|
return result ?? false;
|
|
}
|