Feature/default duration setting (#7)

* Implemented Basic Duration Settings into AppSettings Model

* Implemented Basic Duration Settings into AppSettings Model

* Created Duration Settings Widget and Started using ViewModel in HomeSettingsTab

* Updated Version Number
This commit is contained in:
Andreas Fahrecker
2021-03-03 19:59:33 +01:00
committed by GitHub
parent b520d56d1a
commit 90f2998088
9 changed files with 219 additions and 96 deletions

View File

@ -23,10 +23,13 @@ class AppSettingsRepository {
}
class AppSettingsEntity {
static const String _doneKey = "doneColorValue", _leftKey = "leftColorValue";
final int doneColorValue, leftColorValue;
static const String _doneKey = "doneColorValue",
_leftKey = "leftColorValue",
_durationDaysKey = "durationDays";
final int doneColorValue, leftColorValue, durationDays;
AppSettingsEntity(this.doneColorValue, this.leftColorValue);
AppSettingsEntity(
this.doneColorValue, this.leftColorValue, this.durationDays);
factory AppSettingsEntity.defaults() => AppSettings.defaults().toEntity();
@ -41,9 +44,16 @@ class AppSettingsEntity {
doneColorValue == other.doneColorValue &&
leftColorValue == other.leftColorValue;
Map<String, Object> toJson() =>
{_doneKey: doneColorValue, _leftKey: leftColorValue};
Map<String, Object> toJson() => {
_doneKey: doneColorValue,
_leftKey: leftColorValue,
_durationDaysKey: durationDays,
};
static AppSettingsEntity fromJson(Map<String, Object> json) =>
AppSettingsEntity(json[_doneKey], json[_leftKey]);
AppSettingsEntity(
json[_doneKey],
json[_leftKey],
json[_durationDaysKey],
);
}