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:
committed by
GitHub
parent
b520d56d1a
commit
90f2998088
@ -13,19 +13,26 @@ class AppSettings {
|
||||
this.duration,
|
||||
});
|
||||
|
||||
factory AppSettings.defaults() =>
|
||||
AppSettings(doneColor: Colors.green, leftColor: Colors.red);
|
||||
factory AppSettings.defaults() => AppSettings(
|
||||
doneColor: Colors.green,
|
||||
leftColor: Colors.red,
|
||||
duration: Duration(days: 365),
|
||||
);
|
||||
|
||||
AppSettings copyWith({
|
||||
Color doneColor,
|
||||
Color leftColor,
|
||||
Duration duration,
|
||||
}) =>
|
||||
AppSettings(
|
||||
doneColor: doneColor ?? this.doneColor,
|
||||
leftColor: leftColor ?? this.leftColor);
|
||||
doneColor: doneColor ?? this.doneColor,
|
||||
leftColor: leftColor ?? this.leftColor,
|
||||
duration: duration ?? this.duration,
|
||||
);
|
||||
|
||||
@override
|
||||
int get hashCode => doneColor.hashCode ^ leftColor.hashCode;
|
||||
int get hashCode =>
|
||||
doneColor.hashCode ^ leftColor.hashCode ^ duration.hashCode;
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) =>
|
||||
@ -33,12 +40,15 @@ class AppSettings {
|
||||
other is AppSettings &&
|
||||
runtimeType == other.runtimeType &&
|
||||
doneColor == other.doneColor &&
|
||||
leftColor == other.leftColor;
|
||||
leftColor == other.leftColor &&
|
||||
duration == other.duration;
|
||||
|
||||
AppSettingsEntity toEntity() =>
|
||||
AppSettingsEntity(doneColor.value, leftColor.value);
|
||||
AppSettingsEntity(doneColor.value, leftColor.value, duration.inDays);
|
||||
|
||||
static AppSettings fromEntity(AppSettingsEntity entity) => AppSettings(
|
||||
doneColor: Color(entity.doneColorValue),
|
||||
leftColor: Color(entity.leftColorValue));
|
||||
doneColor: Color(entity.doneColorValue),
|
||||
leftColor: Color(entity.leftColorValue),
|
||||
duration: Duration(days: entity.durationDays),
|
||||
);
|
||||
}
|
||||
|
@ -19,6 +19,9 @@ class TimeProgress {
|
||||
"Initial Name", DateTime(thisYear - 1), DateTime(thisYear + 1));
|
||||
}
|
||||
|
||||
factory TimeProgress.defaultFromDuration(Duration duration) =>
|
||||
TimeProgress("", DateTime.now(), DateTime.now().add(duration));
|
||||
|
||||
TimeProgress copyWith(
|
||||
{String id, String name, DateTime startTime, DateTime endTime}) =>
|
||||
TimeProgress(
|
||||
|
Reference in New Issue
Block a user