36 lines
782 B
Dart
36 lines
782 B
Dart
import 'dart:ui';
|
|
|
|
import 'package:json_annotation/json_annotation.dart';
|
|
|
|
import '../global/utils.dart';
|
|
|
|
part 'budget_category_model.g.dart';
|
|
|
|
@JsonSerializable()
|
|
class BudgetCategory {
|
|
const BudgetCategory({
|
|
this.id,
|
|
required this.budgetId,
|
|
required this.name,
|
|
required this.color,
|
|
required this.createdAt,
|
|
required this.amount,
|
|
});
|
|
|
|
final int budgetId;
|
|
final int? id;
|
|
final String name;
|
|
final double amount;
|
|
|
|
@JsonKey(fromJson: colorFromJson, toJson: colorToJson)
|
|
final Color color;
|
|
|
|
@JsonKey(fromJson: dateFromJson, toJson: dateToJson)
|
|
final DateTime createdAt;
|
|
|
|
factory BudgetCategory.fromJson(Map<String, dynamic> json) =>
|
|
_$BudgetCategoryFromJson(json);
|
|
|
|
Map<String, dynamic> toJson() => _$BudgetCategoryToJson(this);
|
|
}
|