import 'package:flutter/material.dart'; import 'package:syncrow_web/utils/color_manager.dart'; void showDeleteConfirmationDialog(BuildContext context, VoidCallback onConfirm, bool isSpace) { showDialog( context: context, barrierDismissible: false, // Prevent dismissing by tapping outside builder: (BuildContext context) { return Dialog( shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(16.0), ), child: SizedBox( width: 500, // Set the desired width child: Container( color: ColorsManager.whiteColors, padding: const EdgeInsets.all(20.0), child: Column( mainAxisSize: MainAxisSize.min, children: [ // Icon Container( width: 50, height: 50, decoration: BoxDecoration( color: ColorsManager.warningRed, shape: BoxShape.circle, ), child: const Icon( Icons.close, color: Colors.white, size: 40, ), ), const SizedBox(height: 20), // Title isSpace ? const Text( 'Delete Space', style: TextStyle( fontSize: 20, fontWeight: FontWeight.bold, ), ) : const Text( 'Delete Community', style: TextStyle( fontSize: 20, fontWeight: FontWeight.bold, ), ), const SizedBox(height: 10), // Subtitle isSpace ? const Text( 'All the data in the space will be lost', textAlign: TextAlign.center, style: TextStyle( fontSize: 14, color: Colors.grey, ), ) : const Text( 'All the data in the community will be lost', textAlign: TextAlign.center, style: TextStyle( fontSize: 14, color: Colors.grey, ), ), const SizedBox(height: 20), // Buttons Row( mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: [ ElevatedButton( onPressed: () { Navigator.of(context).pop(); // Close the first dialog // Trigger the second popup }, style: ElevatedButton.styleFrom( backgroundColor: Colors.white, shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(12), side: const BorderSide(color: ColorsManager.boxColor), // Black border ), ), child: const Text( 'Cancel', style: TextStyle(color: Colors.black), ), ), ElevatedButton( onPressed: () { Navigator.of(context).pop(); // Close the first dialog showProcessingPopup(context, isSpace, onConfirm); }, style: ElevatedButton.styleFrom( backgroundColor: Colors.blue, shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(8.0), ), ), child: const Text( 'Continue', style: TextStyle(color: Colors.white), ), ), ], ), ], ), ), ), ); }, ); } void showProcessingPopup(BuildContext context, bool isSpace, VoidCallback onDelete) { showDialog( context: context, barrierDismissible: false, builder: (BuildContext context) { return Dialog( shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(16.0), ), child: SizedBox( width: 500, child: Container( color: ColorsManager.whiteColors, padding: const EdgeInsets.all(20.0), child: Column( mainAxisSize: MainAxisSize.min, children: [ // Icon Container( width: 50, height: 50, decoration: BoxDecoration( color: ColorsManager.warningRed, shape: BoxShape.circle, ), child: const Icon( Icons.close, color: Colors.white, size: 40, ), ), const SizedBox(height: 20), // Title isSpace ? const Text( 'Delete Space', style: TextStyle( fontSize: 20, fontWeight: FontWeight.bold, ), ) : const Text( 'Delete Community', style: TextStyle( fontSize: 20, fontWeight: FontWeight.bold, ), ), const SizedBox(height: 10), // Subtitle const Text( 'Are you sure you want to Delete?', textAlign: TextAlign.center, style: TextStyle( fontSize: 14, color: Colors.grey, ), ), const SizedBox(height: 20), // Buttons (Optional) Row( mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: [ ElevatedButton( onPressed: () { // Trigger the second popup onDelete(); }, style: ElevatedButton.styleFrom( backgroundColor: ColorsManager.warningRed, shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(12), side: const BorderSide(color: ColorsManager.boxColor), // Black border ), ), child: const Text( 'Delete', style: TextStyle(color: Colors.white), ), ), ElevatedButton( onPressed: () { Navigator.of(context).pop(); // Close the first dialog }, style: ElevatedButton.styleFrom( backgroundColor: Colors.white, shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(8.0), ), ), child: const Text( 'Cancel', style: TextStyle(color: Colors.black), ), ), ], ), ], ), ), ), ); }, ); }