Updated Flutter SDK for Null-Safety
Ported Progress Detail Screen to PlatformScaffold Signed-off-by: Andreas Fahrecker <AndreasFahrecker@gmail.com>
This commit is contained in:
@ -7,22 +7,16 @@ class AppSettings {
|
||||
final Color leftColor;
|
||||
final Duration duration;
|
||||
|
||||
AppSettings({
|
||||
this.doneColor,
|
||||
this.leftColor,
|
||||
this.duration,
|
||||
const AppSettings({
|
||||
required this.doneColor,
|
||||
required this.leftColor,
|
||||
required this.duration,
|
||||
});
|
||||
|
||||
factory AppSettings.defaults() => AppSettings(
|
||||
doneColor: Colors.green,
|
||||
leftColor: Colors.red,
|
||||
duration: Duration(days: 365),
|
||||
);
|
||||
|
||||
AppSettings copyWith({
|
||||
Color doneColor,
|
||||
Color leftColor,
|
||||
Duration duration,
|
||||
Color? doneColor,
|
||||
Color? leftColor,
|
||||
Duration? duration,
|
||||
}) =>
|
||||
AppSettings(
|
||||
doneColor: doneColor ?? this.doneColor,
|
||||
|
@ -10,7 +10,7 @@ class TimeProgress {
|
||||
final DateTime startTime;
|
||||
final DateTime endTime;
|
||||
|
||||
TimeProgress(this.name, this.startTime, this.endTime, {String id})
|
||||
TimeProgress(this.name, this.startTime, this.endTime, {String? id})
|
||||
: id = id ?? Uuid().generateV4();
|
||||
|
||||
factory TimeProgress.initialDefault() {
|
||||
@ -23,7 +23,7 @@ class TimeProgress {
|
||||
TimeProgress("", DateTime.now(), DateTime.now().add(duration));
|
||||
|
||||
TimeProgress copyWith(
|
||||
{String id, String name, DateTime startTime, DateTime endTime}) =>
|
||||
{String? id, String? name, DateTime? startTime, DateTime? endTime}) =>
|
||||
TimeProgress(
|
||||
name ?? this.name,
|
||||
startTime ?? this.startTime,
|
||||
@ -87,16 +87,19 @@ class TimeProgress {
|
||||
return TimeProgressEntity(id, name, startTime, endTime);
|
||||
}
|
||||
|
||||
static TimeProgress fromEntity(TimeProgressEntity entity) =>
|
||||
TimeProgress(entity.name, entity.startTime, entity.endTime,
|
||||
id: entity.id ?? Uuid().generateV4());
|
||||
static TimeProgress fromEntity(TimeProgressEntity entity) => TimeProgress(
|
||||
entity.name,
|
||||
entity.startTime,
|
||||
entity.endTime,
|
||||
id: entity.id,
|
||||
);
|
||||
|
||||
static bool isValid(TimeProgress tp) =>
|
||||
TimeProgress.isNameValid(tp.name) &&
|
||||
TimeProgress.areTimesValid(tp.startTime, tp.endTime);
|
||||
|
||||
static bool isNameValid(String name) =>
|
||||
name != null && name != "" && name.length > 2 && name.length < 21;
|
||||
name != "" && name.length > 2 && name.length < 21;
|
||||
|
||||
static bool areTimesValid(DateTime startTime, DateTime endTime) =>
|
||||
startTime.isBefore(endTime);
|
||||
|
Reference in New Issue
Block a user