TF-4383 Handle read only labels
This commit is contained in:
@@ -29,12 +29,15 @@ extension LabelExtension on Label {
|
||||
}
|
||||
}
|
||||
|
||||
bool get isReadOnly => readOnly == true;
|
||||
|
||||
Label copyWith({
|
||||
Id? id,
|
||||
KeyWordIdentifier? keyword,
|
||||
String? displayName,
|
||||
HexColor? color,
|
||||
String? description,
|
||||
bool? readOnly,
|
||||
}) {
|
||||
return Label(
|
||||
id: id ?? this.id,
|
||||
@@ -42,6 +45,7 @@ extension LabelExtension on Label {
|
||||
keyword: keyword ?? this.keyword,
|
||||
color: color ?? this.color,
|
||||
description: description ?? this.description,
|
||||
readOnly: readOnly ?? this.readOnly,
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
export 'package:labels/model/label.dart';
|
||||
export 'package:labels/model/hex_color.dart';
|
||||
export 'package:labels/model/labels_capability.dart';
|
||||
|
||||
export 'package:labels/utils/labels_constants.dart';
|
||||
|
||||
|
||||
@@ -24,6 +24,7 @@ class Label with EquatableMixin {
|
||||
final String? displayName;
|
||||
final HexColor? color;
|
||||
final String? description;
|
||||
final bool? readOnly;
|
||||
|
||||
Label({
|
||||
this.id,
|
||||
@@ -31,6 +32,7 @@ class Label with EquatableMixin {
|
||||
this.displayName,
|
||||
this.color,
|
||||
this.description,
|
||||
this.readOnly,
|
||||
});
|
||||
|
||||
factory Label.fromJson(Map<String, dynamic> json) => _$LabelFromJson(json);
|
||||
@@ -44,5 +46,6 @@ class Label with EquatableMixin {
|
||||
displayName,
|
||||
color,
|
||||
description,
|
||||
readOnly,
|
||||
];
|
||||
}
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
import 'package:jmap_dart_client/jmap/core/capability/capability_properties.dart';
|
||||
import 'package:json_annotation/json_annotation.dart';
|
||||
|
||||
part 'labels_capability.g.dart';
|
||||
|
||||
@JsonSerializable(explicitToJson: true, includeIfNull: false)
|
||||
class LabelsCapability extends CapabilityProperties {
|
||||
final int? version;
|
||||
|
||||
LabelsCapability({this.version});
|
||||
|
||||
factory LabelsCapability.fromJson(Map<String, dynamic> json) =>
|
||||
_$LabelsCapabilityFromJson(json);
|
||||
|
||||
Map<String, dynamic> toJson() => _$LabelsCapabilityToJson(this);
|
||||
|
||||
static LabelsCapability deserialize(Map<String, dynamic> json) {
|
||||
return LabelsCapability.fromJson(json);
|
||||
}
|
||||
|
||||
@override
|
||||
List<Object?> get props => [version];
|
||||
}
|
||||
Reference in New Issue
Block a user