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