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