DeleteSpaceModelDialog into a separate widget

This commit is contained in:
hannathkadher
2025-02-25 21:30:27 +04:00
parent 27fef7ddaa
commit 61f0c3ad2b
4 changed files with 93 additions and 0 deletions

View File

@ -0,0 +1,85 @@
import 'package:flutter/material.dart';
import 'package:syncrow_web/pages/common/buttons/cancel_button.dart';
import 'package:syncrow_web/pages/common/buttons/default_button.dart';
import 'package:syncrow_web/utils/color_manager.dart';
class DeleteSpaceModelDialog extends StatelessWidget {
final VoidCallback onConfirmDelete;
const DeleteSpaceModelDialog({Key? key, required this.onConfirmDelete})
: super(key: key);
@override
Widget build(BuildContext context) {
final screenWidth = MediaQuery.of(context).size.width;
return AlertDialog(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(20),
),
backgroundColor: ColorsManager.whiteColors,
title: Center(
child: Text(
"Delete Space Model",
textAlign: TextAlign.center,
style: Theme.of(context)
.textTheme
.headlineLarge
?.copyWith(color: ColorsManager.blackColor),
),
),
content: SizedBox(
width: screenWidth * 0.4,
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
Text(
"Are you sure you want to delete?",
textAlign: TextAlign.center,
style: Theme.of(context).textTheme.headlineSmall,
),
const SizedBox(height: 15),
Text(
"The existing sub-spaces, devices, and routines will remain associated with the spaces, but the connection will be removed.",
textAlign: TextAlign.center,
style: Theme.of(context)
.textTheme
.bodyMedium
?.copyWith(color: ColorsManager.lightGrayColor),
),
],
),
),
actions: [
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
SizedBox(
width: 200,
child: CancelButton(
onPressed: () {
Navigator.of(context).pop(); // Close dialog
},
label: "Cancel",
),
),
const SizedBox(width: 10),
SizedBox(
width: 200,
child: DefaultButton(
onPressed: () {
Navigator.of(context).pop(); // Close dialog
onConfirmDelete(); // Execute delete action
},
backgroundColor: ColorsManager.semiTransparentRed,
borderRadius: 10,
foregroundColor: ColorsManager.whiteColors,
child: const Text('Delete'),
),
),
],
),
],
);
}
}