formatted all files.

This commit is contained in:
Faris Armoush
2025-06-12 15:33:32 +03:00
parent 29959f567e
commit 04250ebc98
474 changed files with 5425 additions and 4338 deletions

View File

@ -9,7 +9,6 @@ import 'package:syncrow_web/pages/spaces_management/all_spaces/model/subspace_mo
import 'package:syncrow_web/pages/spaces_management/all_spaces/model/tag.dart';
import 'package:syncrow_web/pages/spaces_management/all_spaces/widgets/create_space_widgets/devices_part_widget.dart';
import 'package:syncrow_web/pages/spaces_management/all_spaces/widgets/create_space_widgets/icon_choose_part_widget.dart';
import 'package:syncrow_web/pages/spaces_management/all_spaces/widgets/create_space_widgets/space_model_linking_widget.dart';
import 'package:syncrow_web/pages/spaces_management/all_spaces/widgets/create_space_widgets/space_name_textfield_widget.dart';
import 'package:syncrow_web/pages/spaces_management/all_spaces/widgets/create_space_widgets/sub_space_part_widget.dart';
import 'package:syncrow_web/pages/spaces_management/all_spaces/widgets/dialogs/icon_selection_dialog.dart';
@ -99,9 +98,9 @@ class CreateSpaceDialogState extends State<CreateSpaceDialog> {
@override
Widget build(BuildContext context) {
bool isSpaceModelDisabled = (tags != null && tags!.isNotEmpty ||
subspaces != null && subspaces!.isNotEmpty);
bool isTagsAndSubspaceModelDisabled = (selectedSpaceModel != null);
final isSpaceModelDisabled = tags != null && tags!.isNotEmpty ||
subspaces != null && subspaces!.isNotEmpty;
final isTagsAndSubspaceModelDisabled = (selectedSpaceModel != null);
final screenWidth = MediaQuery.of(context).size.width;
return AlertDialog(
@ -298,7 +297,7 @@ class CreateSpaceDialogState extends State<CreateSpaceDialog> {
} else if (isNameFieldExist) {
return;
} else {
String newName = enteredName.isNotEmpty
final newName = enteredName.isNotEmpty
? enteredName
: (widget.name ?? '');
if (newName.isNotEmpty) {
@ -381,7 +380,7 @@ class CreateSpaceDialogState extends State<CreateSpaceDialog> {
products: products,
existingSubSpaces: existingSubSpaces,
onSave: (slectedSubspaces, updatedSubSpaces) {
final List<Tag> tagsToAppendToSpace = [];
final tagsToAppendToSpace = <Tag>[];
if (slectedSubspaces != null && slectedSubspaces.isNotEmpty) {
final updatedIds =
@ -390,11 +389,11 @@ class CreateSpaceDialogState extends State<CreateSpaceDialog> {
final deletedSubspaces = existingSubSpaces
.where((s) => !updatedIds.contains(s.internalId))
.toList();
for (var s in deletedSubspaces) {
for (final s in deletedSubspaces) {
if (s.tags != null) {
s.tags!.forEach(
(tag) => tag.location = null,
);
for (final tag in s.tags!) {
tag.location = null;
}
tagsToAppendToSpace.addAll(s.tags!);
}
}
@ -403,11 +402,11 @@ class CreateSpaceDialogState extends State<CreateSpaceDialog> {
if (existingSubSpaces != null) {
final deletedSubspaces = existingSubSpaces;
for (var s in deletedSubspaces) {
for (final s in deletedSubspaces) {
if (s.tags != null) {
s.tags!.forEach(
(tag) => tag.location = null,
);
for (final tag in s.tags!) {
tag.location = null;
}
tagsToAppendToSpace.addAll(s.tags!);
}
}

View File

@ -2,9 +2,10 @@ import 'package:flutter/material.dart';
import 'package:syncrow_web/pages/common/buttons/cancel_button.dart';
import 'package:syncrow_web/utils/color_manager.dart';
void showDeleteConfirmationDialog(BuildContext context, VoidCallback onConfirm, bool isSpace) {
final String title = isSpace ? 'Delete Space' : 'Delete Community';
final String subtitle = isSpace
void showDeleteConfirmationDialog(
BuildContext context, VoidCallback onConfirm, bool isSpace) {
final title = isSpace ? 'Delete Space' : 'Delete Community';
final subtitle = isSpace
? 'All the data in the space will be lost'
: 'All the data in the community will be lost';
@ -13,7 +14,8 @@ void showDeleteConfirmationDialog(BuildContext context, VoidCallback onConfirm,
barrierDismissible: false,
builder: (BuildContext context) {
return Dialog(
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(16.0)),
shape:
RoundedRectangleBorder(borderRadius: BorderRadius.circular(16.0)),
child: SizedBox(
width: 500,
child: Container(
@ -41,7 +43,8 @@ void showDeleteConfirmationDialog(BuildContext context, VoidCallback onConfirm,
showProcessingPopup(context, isSpace, onConfirm);
},
style: _dialogButtonStyle(ColorsManager.spaceColor),
child: const Text('Continue', style: TextStyle(color: ColorsManager.whiteColors)),
child: const Text('Continue',
style: TextStyle(color: ColorsManager.whiteColors)),
),
],
),
@ -54,15 +57,17 @@ void showDeleteConfirmationDialog(BuildContext context, VoidCallback onConfirm,
);
}
void showProcessingPopup(BuildContext context, bool isSpace, VoidCallback onDelete) {
final String title = isSpace ? 'Delete Space' : 'Delete Community';
void showProcessingPopup(
BuildContext context, bool isSpace, VoidCallback onDelete) {
final title = isSpace ? 'Delete Space' : 'Delete Community';
showDialog(
context: context,
barrierDismissible: false,
builder: (BuildContext context) {
return Dialog(
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(16.0)),
shape:
RoundedRectangleBorder(borderRadius: BorderRadius.circular(16.0)),
child: SizedBox(
width: 500,
child: Container(
@ -75,7 +80,8 @@ void showProcessingPopup(BuildContext context, bool isSpace, VoidCallback onDele
const SizedBox(height: 20),
_buildDialogTitle(context, title),
const SizedBox(height: 10),
_buildDialogSubtitle(context, 'Are you sure you want to delete?'),
_buildDialogSubtitle(
context, 'Are you sure you want to delete?'),
const SizedBox(height: 20),
Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
@ -83,7 +89,8 @@ void showProcessingPopup(BuildContext context, bool isSpace, VoidCallback onDele
ElevatedButton(
onPressed: onDelete,
style: _dialogButtonStyle(ColorsManager.warningRed),
child: const Text('Delete', style: TextStyle(color: ColorsManager.whiteColors)),
child: const Text('Delete',
style: TextStyle(color: ColorsManager.whiteColors)),
),
CancelButton(
label: 'Cancel',
@ -104,7 +111,7 @@ Widget _buildWarningIcon() {
return Container(
width: 50,
height: 50,
decoration: BoxDecoration(
decoration: const BoxDecoration(
color: ColorsManager.warningRed,
shape: BoxShape.circle,
),
@ -123,7 +130,10 @@ Widget _buildDialogSubtitle(BuildContext context, String subtitle) {
return Text(
subtitle,
textAlign: TextAlign.center,
style: Theme.of(context).textTheme.bodyMedium?.copyWith(color: ColorsManager.grayColor),
style: Theme.of(context)
.textTheme
.bodyMedium
?.copyWith(color: ColorsManager.grayColor),
);
}

View File

@ -4,8 +4,7 @@ import 'package:syncrow_web/utils/color_manager.dart';
class DuplicateProcessDialog extends StatefulWidget {
final VoidCallback onDuplicate;
const DuplicateProcessDialog({required this.onDuplicate, Key? key})
: super(key: key);
const DuplicateProcessDialog({required this.onDuplicate, super.key});
@override
_DuplicateProcessDialogState createState() => _DuplicateProcessDialogState();
@ -20,7 +19,7 @@ class _DuplicateProcessDialogState extends State<DuplicateProcessDialog> {
_startDuplication();
}
void _startDuplication() async {
Future<void> _startDuplication() async {
WidgetsBinding.instance.addPostFrameCallback((_) {
widget.onDuplicate();
});
@ -55,7 +54,7 @@ class _DuplicateProcessDialogState extends State<DuplicateProcessDialog> {
),
const SizedBox(height: 15),
Text(
"Duplicating in progress",
'Duplicating in progress',
style: Theme.of(context)
.textTheme
.headlineSmall
@ -70,7 +69,7 @@ class _DuplicateProcessDialogState extends State<DuplicateProcessDialog> {
),
const SizedBox(height: 15),
Text(
"Duplicating successful",
'Duplicating successful',
textAlign: TextAlign.center,
style: Theme.of(context)
.textTheme

View File

@ -7,10 +7,10 @@ class IconSelectionDialog extends StatelessWidget {
final Function(String selectedIcon) onIconSelected;
const IconSelectionDialog({
Key? key,
super.key,
required this.spaceIconList,
required this.onIconSelected,
}) : super(key: key);
});
@override
Widget build(BuildContext context) {
@ -21,21 +21,23 @@ class IconSelectionDialog extends StatelessWidget {
elevation: 0,
backgroundColor: ColorsManager.transparentColor,
child: Container(
width: screenWidth * 0.44,
width: screenWidth * 0.44,
height: screenHeight * 0.45,
decoration: BoxDecoration(
color: ColorsManager.whiteColors,
borderRadius: BorderRadius.circular(12),
boxShadow: [
BoxShadow(
color: ColorsManager.blackColor.withOpacity(0.2), // Shadow color
color: ColorsManager.blackColor
.withValues(alpha: 0.2), // Shadow color
blurRadius: 20, // Spread of the blur
offset: const Offset(0, 8), // Offset of the shadow
),
],
),
child: AlertDialog(
title: Text('Space Icon',style: Theme.of(context).textTheme.headlineMedium),
title: Text('Space Icon',
style: Theme.of(context).textTheme.headlineMedium),
backgroundColor: ColorsManager.whiteColors,
content: Container(
width: screenWidth * 0.4,