Renamed all Timer named things to TimeProgress

Signed-off-by: Andreas Fahrecker <AndreasFahrecker@gmail.com>
This commit is contained in:
Andreas Fahrecker
2020-10-16 14:25:15 +02:00
parent 7f6eec43de
commit 976fbec455
16 changed files with 198 additions and 188 deletions

View File

@ -1,35 +1,35 @@
import 'package:meta/meta.dart';
import 'package:time_progress_calculator/models/timer.dart';
import 'package:time_progress_calculator/models/time_progress.dart';
@immutable
class AppState {
final bool isLoading;
final List<Timer> timers;
final List<TimeProgress> timeProgressList;
AppState({
this.isLoading = false,
this.timers = const [],
this.timeProgressList = const [],
});
factory AppState.initial() => AppState(isLoading: true);
AppState copyWith({
bool isLoading,
List<Timer> timers,
List<TimeProgress> timeProgressList,
}) {
return AppState(
isLoading: isLoading ?? this.isLoading,
timers: timers ?? this.timers,
timeProgressList: timeProgressList ?? this.timeProgressList,
);
}
@override
int get hashCode => timers.hashCode;
int get hashCode => timeProgressList.hashCode;
@override
bool operator ==(Object other) =>
identical(this, other) ||
other is AppState &&
runtimeType == other.runtimeType &&
timers == other.timers;
timeProgressList == other.timeProgressList;
}

View File

@ -1,18 +1,18 @@
import 'package:meta/meta.dart';
import 'package:time_progress_calculator/persistence/timer_entity.dart';
import 'package:time_progress_calculator/persistence/time_progress_entity.dart';
import 'package:time_progress_calculator/uuid.dart';
@immutable
class Timer {
class TimeProgress {
final String id;
final DateTime startTime;
final DateTime endTime;
Timer(this.startTime, this.endTime, {String id})
TimeProgress(this.startTime, this.endTime, {String id})
: id = id ?? Uuid().generateV4();
Timer copyWith({String id, DateTime startTime, DateTime endTime}) {
return Timer(
TimeProgress copyWith({String id, DateTime startTime, DateTime endTime}) {
return TimeProgress(
startTime ?? this.startTime,
endTime ?? this.endTime,
id: id ?? this.id,
@ -25,7 +25,7 @@ class Timer {
@override
bool operator ==(Object other) =>
identical(this, other) ||
other is Timer &&
other is TimeProgress &&
runtimeType == other.runtimeType &&
id == other.id &&
startTime == other.startTime &&
@ -36,12 +36,12 @@ class Timer {
return "Timer{id: $id, startTimer: $startTime, endTimer: $endTime}";
}
TimerEntity toEntity() {
return TimerEntity(id, startTime, endTime);
TimeProgressEntity toEntity() {
return TimeProgressEntity(id, startTime, endTime);
}
static Timer fromEntity(TimerEntity entity) {
return Timer(
static TimeProgress fromEntity(TimeProgressEntity entity) {
return TimeProgress(
entity.startTime,
entity.endTime,
id: entity.id ?? Uuid().generateV4(),