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

@ -16,7 +16,7 @@ abstract class BaseTag {
this.location,
}) : internalId = internalId ?? const Uuid().v4();
Map<String, dynamic> toJson();
Map<String, dynamic> toJson();
BaseTag copyWith({
String? tag,
ProductModel? product,

View File

@ -27,9 +27,12 @@ class CommunityModel {
updatedAt: DateTime.parse(json['updatedAt'] ?? ''),
name: json['name'] ?? '',
description: json['description'] ?? '',
region: json['region'] != null ? RegionModel.fromJson(json['region']) : null,
region:
json['region'] != null ? RegionModel.fromJson(json['region']) : null,
spaces: json['spaces'] != null
? (json['spaces'] as List).map((space) => SpaceModel.fromJson(space)).toList()
? (json['spaces'] as List)
.map((space) => SpaceModel.fromJson(space))
.toList()
: [],
);
}
@ -42,7 +45,9 @@ class CommunityModel {
'name': name,
'description': description,
'region': region?.toJson(),
'spaces': spaces.map((space) => space.toMap()).toList(), // Convert spaces to Map
'spaces': spaces
.map((space) => space.toMap())
.toList(), // Convert spaces to Map
};
}
}

View File

@ -1,7 +1,6 @@
import 'package:syncrow_web/pages/spaces_management/all_spaces/model/selected_product_model.dart';
import 'package:syncrow_web/utils/constants/assets.dart';
import 'selected_product_model.dart';
class ProductModel {
final String uuid;
final String catName;

View File

@ -6,7 +6,11 @@ class SelectedProduct {
final String productName;
final ProductModel? product;
SelectedProduct({required this.productId, required this.count, required this.productName, this.product});
SelectedProduct(
{required this.productId,
required this.count,
required this.productName,
this.product});
Map<String, dynamic> toJson() {
return {
@ -16,7 +20,7 @@ class SelectedProduct {
};
}
@override
@override
String toString() {
return 'SelectedProduct(productId: $productId, count: $count)';
}

View File

@ -56,7 +56,7 @@ class SpaceModel {
{String? parentInternalId}) {
final String internalId = json['internalId'] ?? const Uuid().v4();
final List<SpaceModel> children = json['children'] != null
final children = json['children'] != null
? (json['children'] as List).map((childJson) {
return SpaceModel.fromJson(
childJson,
@ -73,8 +73,8 @@ class SpaceModel {
isPrivate: json['isPrivate'] ?? false,
invitationCode: json['invitationCode'],
subspaces: (json['subspaces'] as List<dynamic>?)
?.where((e) => e is Map<String, dynamic>) // Validate type
.map((e) => SubspaceModel.fromJson(e as Map<String, dynamic>))
?.whereType<Map<String, dynamic>>() // Validate type
.map(SubspaceModel.fromJson)
.toList() ??
[],
parent: parentInternalId != null
@ -102,8 +102,8 @@ class SpaceModel {
? SpaceTemplateModel.fromJson(json['spaceModel'])
: null,
tags: (json['productAllocations'] as List<dynamic>?)
?.where((item) => item is Map<String, dynamic>) // Validate type
.map((item) => Tag.fromJson(item as Map<String, dynamic>))
?.whereType<Map<String, dynamic>>() // Validate type
.map(Tag.fromJson)
.toList() ??
[],
);
@ -150,7 +150,7 @@ class SpaceModel {
extension SpaceExtensions on SpaceModel {
List<String> listAllTagValues() {
final List<String> tagValues = [];
final tagValues = <String>[];
if (tags != null) {
tagValues.addAll(
@ -174,10 +174,10 @@ extension SpaceExtensions on SpaceModel {
bool isNoChangesSubmited(String name, icon, SpaceTemplateModel? spaceModel,
List<SubspaceModel>? subspaces, List<Tag>? tags) {
return (name == this.name &&
return name == this.name &&
icon == this.icon &&
spaceModel == this.spaceModel &&
subspaces == this.subspaces &&
tags == this.tags);
tags == this.tags;
}
}

View File

@ -1,5 +1,4 @@
import 'space_model.dart';
import 'package:syncrow_web/pages/spaces_management/all_spaces/model/space_model.dart';
class SpacesResponse {
final List<SpaceModel> data;

View File

@ -1,9 +1,8 @@
import 'package:syncrow_web/pages/spaces_management/all_spaces/model/product_model.dart';
import 'package:syncrow_web/pages/spaces_management/all_spaces/model/tag.dart';
import 'package:syncrow_web/utils/constants/action_enum.dart';
import 'package:uuid/uuid.dart';
import 'tag.dart';
class SubspaceModel {
final String? uuid;
String subspaceName;

View File

@ -6,18 +6,12 @@ import 'package:uuid/uuid.dart';
class Tag extends BaseTag {
Tag({
String? uuid,
required String? tag,
ProductModel? product,
String? internalId,
String? location,
}) : super(
uuid: uuid,
tag: tag,
product: product,
internalId: internalId,
location: location,
);
super.uuid,
required super.tag,
super.product,
super.internalId,
super.location,
});
factory Tag.fromJson(Map<String, dynamic> json) {
final String internalId = json['internalId'] ?? const Uuid().v4();
@ -50,6 +44,7 @@ class Tag extends BaseTag {
);
}
@override
Map<String, dynamic> toJson() {
return {
if (uuid != null) 'uuid': uuid,