Added isLoading bool and changed timer to a List of Timer called timers
Signed-off-by: Andreas Fahrecker <AndreasFahrecker@gmail.com>
This commit is contained in:
parent
65fc97c9d1
commit
88a9026966
@ -3,21 +3,33 @@ import 'package:time_progress_calculator/models/timer.dart';
|
|||||||
|
|
||||||
@immutable
|
@immutable
|
||||||
class AppState {
|
class AppState {
|
||||||
final Timer timer;
|
final bool isLoading;
|
||||||
|
final List<Timer> timers;
|
||||||
|
|
||||||
AppState({this.timer});
|
AppState({
|
||||||
|
this.isLoading = false,
|
||||||
|
this.timers = const [],
|
||||||
|
});
|
||||||
|
|
||||||
AppState copyWith({Timer timer}) {
|
factory AppState.initial() => AppState(isLoading: true);
|
||||||
return AppState(timer: timer ?? this.timer);
|
|
||||||
|
AppState copyWith({
|
||||||
|
bool isLoading,
|
||||||
|
List<Timer> timers,
|
||||||
|
}) {
|
||||||
|
return AppState(
|
||||||
|
isLoading: isLoading ?? this.isLoading,
|
||||||
|
timers: timers ?? this.timers,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
int get hashCode => timer.hashCode;
|
int get hashCode => timers.hashCode;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
bool operator ==(Object other) =>
|
bool operator ==(Object other) =>
|
||||||
identical(this, other) ||
|
identical(this, other) ||
|
||||||
other is AppState &&
|
other is AppState &&
|
||||||
runtimeType == other.runtimeType &&
|
runtimeType == other.runtimeType &&
|
||||||
timer == other.timer;
|
timers == other.timers;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user