inventory_mobile/lib/utils/exit_dialog.dart
2025-12-15 15:35:35 +08:00

25 lines
722 B
Dart

import 'package:flutter/material.dart';
Future<bool> showExitConfirmationDialog(BuildContext context) async {
final result = await showDialog<bool>(
context: context,
builder: (context) => AlertDialog(
title: const Text('Exit App?'),
content: const Text('Are you sure you want to exit the app?'),
actions: [
TextButton(
onPressed: () => Navigator.of(context).pop(false),
child: const Text('Cancel'),
),
ElevatedButton(
onPressed: () => Navigator.of(context).pop(true),
style: ElevatedButton.styleFrom(backgroundColor: Colors.red),
child: const Text('Exit'),
),
],
),
);
return result ?? false;
}