feat: Add color and icon properties to categories, enhance category management in UI

This commit is contained in:
2026-05-20 17:10:44 +02:00
parent def755e1c5
commit 3ff4efb738
8 changed files with 517 additions and 45 deletions
+20
View File
@@ -95,6 +95,8 @@ class SyncCategoryPayload {
required this.encryptedName,
required this.serverVersion,
this.isDeleted = false,
this.colorValue,
this.iconCodePoint,
required this.updatedAt,
});
@@ -102,6 +104,8 @@ class SyncCategoryPayload {
final String encryptedName;
final int serverVersion;
final bool isDeleted;
final int? colorValue;
final int? iconCodePoint;
final DateTime updatedAt;
factory SyncCategoryPayload.fromCategory(
@@ -113,6 +117,8 @@ class SyncCategoryPayload {
encryptedName: encryptedName,
serverVersion: category.serverVersion,
isDeleted: category.isDeleted,
colorValue: category.colorValue,
iconCodePoint: category.iconCodePoint,
updatedAt: category.updatedAt,
);
}
@@ -123,6 +129,8 @@ class SyncCategoryPayload {
'encrypted_name': encryptedName,
'serverVersion': serverVersion,
'isDeleted': isDeleted,
if (colorValue != null) 'colorValue': colorValue!.toSigned(32),
if (iconCodePoint != null) 'iconCodePoint': iconCodePoint,
'updatedAt': updatedAt.toIso8601String(),
};
}
@@ -213,12 +221,16 @@ class SyncCategoryResponse {
required this.encryptedName,
required this.serverVersion,
this.isDeleted = false,
this.colorValue,
this.iconCodePoint,
required this.updatedAt,
});
final String id;
final String encryptedName;
final int serverVersion;
final bool isDeleted;
final int? colorValue;
final int? iconCodePoint;
final DateTime updatedAt;
factory SyncCategoryResponse.fromJson(Map<String, dynamic> json) {
@@ -227,6 +239,12 @@ class SyncCategoryResponse {
encryptedName: _readStringValue(json['encrypted_name']),
serverVersion: _readIntValue(json['serverVersion']),
isDeleted: json['isDeleted'] as bool? ?? false,
colorValue: json['colorValue'] == null
? null
: _readIntValue(json['colorValue']),
iconCodePoint: json['iconCodePoint'] == null
? null
: _readIntValue(json['iconCodePoint']),
updatedAt: DateTime.parse(json['updatedAt'] as String),
);
}
@@ -237,6 +255,8 @@ class SyncCategoryResponse {
name: name,
serverVersion: serverVersion,
isDeleted: isDeleted,
colorValue: colorValue,
iconCodePoint: iconCodePoint,
updatedAt: updatedAt,
);
}