36 lines
735 B
Dart
36 lines
735 B
Dart
import 'dart:ui';
|
|
|
|
class Category {
|
|
String label;
|
|
String color;
|
|
bool essential;
|
|
bool transfert;
|
|
|
|
Category({
|
|
this.label = '',
|
|
this.color = '',
|
|
this.essential = false,
|
|
this.transfert = false,
|
|
});
|
|
|
|
factory Category.fromJson(Map<String, dynamic> json) {
|
|
return Category(
|
|
label: json['label'],
|
|
color: json['color'],
|
|
essential: bool.parse(json['essential']),
|
|
transfert: bool.parse(json['transfert']),
|
|
);
|
|
}
|
|
|
|
Map<String, String> toJson() => {
|
|
'label': label,
|
|
'color': color,
|
|
'essential': essential.toString(),
|
|
'transfert': transfert.toString(),
|
|
};
|
|
|
|
Color rgbToColor() {
|
|
return Color(int.parse(color.toUpperCase().replaceAll("#", ""), radix: 16));
|
|
}
|
|
}
|