import 'package:flutter/material.dart'; Future showExitConfirmationDialog(BuildContext context) async { final result = await showDialog( 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; }