2023-11-09 18:10:56 +02:00
|
|
|
import 'package:vector_map_tiles/vector_map_tiles.dart';
|
|
|
|
|
2023-08-27 07:07:35 +02:00
|
|
|
class MapState {
|
|
|
|
final bool isDarkTheme;
|
|
|
|
final bool showFavoriteOnly;
|
2023-10-04 15:51:07 +02:00
|
|
|
final bool includeArchived;
|
2023-08-27 07:07:35 +02:00
|
|
|
final int relativeTime;
|
2023-11-09 18:10:56 +02:00
|
|
|
final Style? mapStyle;
|
|
|
|
final bool isLoading;
|
2023-08-27 07:07:35 +02:00
|
|
|
|
|
|
|
MapState({
|
|
|
|
this.isDarkTheme = false,
|
|
|
|
this.showFavoriteOnly = false,
|
2023-10-04 15:51:07 +02:00
|
|
|
this.includeArchived = false,
|
2023-08-27 07:07:35 +02:00
|
|
|
this.relativeTime = 0,
|
2023-11-09 18:10:56 +02:00
|
|
|
this.mapStyle,
|
|
|
|
this.isLoading = false,
|
2023-08-27 07:07:35 +02:00
|
|
|
});
|
|
|
|
|
|
|
|
MapState copyWith({
|
|
|
|
bool? isDarkTheme,
|
|
|
|
bool? showFavoriteOnly,
|
2023-10-04 15:51:07 +02:00
|
|
|
bool? includeArchived,
|
2023-08-27 07:07:35 +02:00
|
|
|
int? relativeTime,
|
2023-11-09 18:10:56 +02:00
|
|
|
Style? mapStyle,
|
|
|
|
bool? isLoading,
|
2023-08-27 07:07:35 +02:00
|
|
|
}) {
|
|
|
|
return MapState(
|
|
|
|
isDarkTheme: isDarkTheme ?? this.isDarkTheme,
|
|
|
|
showFavoriteOnly: showFavoriteOnly ?? this.showFavoriteOnly,
|
2023-10-04 15:51:07 +02:00
|
|
|
includeArchived: includeArchived ?? this.includeArchived,
|
2023-08-27 07:07:35 +02:00
|
|
|
relativeTime: relativeTime ?? this.relativeTime,
|
2023-11-09 18:10:56 +02:00
|
|
|
mapStyle: mapStyle ?? this.mapStyle,
|
|
|
|
isLoading: isLoading ?? this.isLoading,
|
2023-08-27 07:07:35 +02:00
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
@override
|
|
|
|
String toString() {
|
2023-11-09 18:10:56 +02:00
|
|
|
return 'MapSettingsState(isDarkTheme: $isDarkTheme, showFavoriteOnly: $showFavoriteOnly, relativeTime: $relativeTime, includeArchived: $includeArchived, mapStyle: $mapStyle, isLoading: $isLoading)';
|
2023-08-27 07:07:35 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
@override
|
|
|
|
bool operator ==(Object other) {
|
|
|
|
if (identical(this, other)) return true;
|
|
|
|
|
|
|
|
return other is MapState &&
|
|
|
|
other.isDarkTheme == isDarkTheme &&
|
|
|
|
other.showFavoriteOnly == showFavoriteOnly &&
|
2023-10-04 15:51:07 +02:00
|
|
|
other.relativeTime == relativeTime &&
|
2023-11-09 18:10:56 +02:00
|
|
|
other.includeArchived == includeArchived &&
|
|
|
|
other.mapStyle == mapStyle &&
|
|
|
|
other.isLoading == isLoading;
|
2023-08-27 07:07:35 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
@override
|
|
|
|
int get hashCode {
|
|
|
|
return isDarkTheme.hashCode ^
|
|
|
|
showFavoriteOnly.hashCode ^
|
2023-10-04 15:51:07 +02:00
|
|
|
relativeTime.hashCode ^
|
2023-11-09 18:10:56 +02:00
|
|
|
includeArchived.hashCode ^
|
|
|
|
mapStyle.hashCode ^
|
|
|
|
isLoading.hashCode;
|
2023-08-27 07:07:35 +02:00
|
|
|
}
|
|
|
|
}
|