Created DatePickerBtn and Started Using it in ProgressCreationScreen
Signed-off-by: Andreas Fahrecker <AndreasFahrecker@gmail.com>
This commit is contained in:
@ -5,3 +5,14 @@ class TimeProgressInvalidNameException implements Exception {
|
||||
|
||||
String errMsg() => "The name of a TimeProgress can't be: $invalidName";
|
||||
}
|
||||
|
||||
class TimeProgressStartTimeIsNotBeforeEndTimeException implements Exception {
|
||||
final startTime;
|
||||
final endTime;
|
||||
|
||||
TimeProgressStartTimeIsNotBeforeEndTimeException(
|
||||
this.startTime, this.endTime);
|
||||
|
||||
String errMsg() =>
|
||||
"The Start Time has to be before the end time. Therefore these values are invalid: Start Time: $startTime EndTime: $endTime";
|
||||
}
|
||||
|
@ -12,9 +12,11 @@ class TimeProgress {
|
||||
|
||||
TimeProgress(this.name, this.startTime, this.endTime, {String id})
|
||||
: id = id ?? Uuid().generateV4() {
|
||||
if (this.name == null || this.name == "") {
|
||||
if (this.name == null || this.name == "")
|
||||
throw new TimeProgressInvalidNameException(this.name);
|
||||
}
|
||||
if (!this.startTime.isBefore(this.endTime))
|
||||
throw new TimeProgressStartTimeIsNotBeforeEndTimeException(
|
||||
startTime, endTime);
|
||||
}
|
||||
|
||||
factory TimeProgress.initialDefault() {
|
||||
|
Reference in New Issue
Block a user