diff --git a/assets/icons/delete_space_model.svg b/assets/icons/delete_space_model.svg new file mode 100644 index 00000000..7fb9a9b0 --- /dev/null +++ b/assets/icons/delete_space_model.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/lib/pages/spaces_management/space_model/widgets/dialog/delete_space_model_dialog.dart b/lib/pages/spaces_management/space_model/widgets/dialog/delete_space_model_dialog.dart new file mode 100644 index 00000000..8349baa4 --- /dev/null +++ b/lib/pages/spaces_management/space_model/widgets/dialog/delete_space_model_dialog.dart @@ -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'), + ), + ), + ], + ), + ], + ); + } +} diff --git a/lib/utils/color_manager.dart b/lib/utils/color_manager.dart index 4d3dbb0c..a4bcc0da 100644 --- a/lib/utils/color_manager.dart +++ b/lib/utils/color_manager.dart @@ -71,4 +71,5 @@ abstract class ColorsManager { static const Color lightGrayBorderColor = Color(0xB2D5D5D5); //background: #F8F8F8; static const Color vividBlue = Color(0xFF023DFE); + static const Color semiTransparentRed = Color(0x99FF0000); } diff --git a/lib/utils/constants/assets.dart b/lib/utils/constants/assets.dart index d5d216c5..d7b4d283 100644 --- a/lib/utils/constants/assets.dart +++ b/lib/utils/constants/assets.dart @@ -258,6 +258,7 @@ class Assets { static const String doorSensor = 'assets/icons/door_sensor.svg'; static const String delete = 'assets/icons/delete.svg'; + static const String deleteSpaceModel = 'assets/icons/delete_space_model.svg'; static const String edit = 'assets/icons/edit.svg'; static const String editSpace = 'assets/icons/edit_space.svg'; //assets/icons/routine/tab_to_run.svg