ts-tat/lib/widgets/custom_confirmation_dialog.dart
2025-06-21 19:17:07 +05:30

31 lines
928 B
Dart

import 'package:flutter/material.dart';
Future<bool> showNotAllowedDialog(
BuildContext context, {
String? message,
}) async {
return await showDialog<bool>(
context: context,
barrierDismissible: false, // Force user to choose
builder: (context) {
return AlertDialog(
title: const Text('Notice'),
content: Text(
message ?? 'This class is not allowed. Do you want to continue?',
),
actions: [
TextButton(
onPressed: () => Navigator.of(context).pop(false), // Cancel
child: const Text('Cancel'),
),
ElevatedButton(
onPressed: () => Navigator.of(context).pop(true), // OK
child: const Text('OK'),
),
],
);
},
) ??
false; // Default to false if dialog is dismissed
}