map_state.model.dart 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. class MapState {
  2. final bool isDarkTheme;
  3. final bool showFavoriteOnly;
  4. final bool includeArchived;
  5. final int relativeTime;
  6. MapState({
  7. this.isDarkTheme = false,
  8. this.showFavoriteOnly = false,
  9. this.includeArchived = false,
  10. this.relativeTime = 0,
  11. });
  12. MapState copyWith({
  13. bool? isDarkTheme,
  14. bool? showFavoriteOnly,
  15. bool? includeArchived,
  16. int? relativeTime,
  17. }) {
  18. return MapState(
  19. isDarkTheme: isDarkTheme ?? this.isDarkTheme,
  20. showFavoriteOnly: showFavoriteOnly ?? this.showFavoriteOnly,
  21. includeArchived: includeArchived ?? this.includeArchived,
  22. relativeTime: relativeTime ?? this.relativeTime,
  23. );
  24. }
  25. @override
  26. String toString() {
  27. return 'MapSettingsState(isDarkTheme: $isDarkTheme, showFavoriteOnly: $showFavoriteOnly, relativeTime: $relativeTime, includeArchived: $includeArchived)';
  28. }
  29. @override
  30. bool operator ==(Object other) {
  31. if (identical(this, other)) return true;
  32. return other is MapState &&
  33. other.isDarkTheme == isDarkTheme &&
  34. other.showFavoriteOnly == showFavoriteOnly &&
  35. other.relativeTime == relativeTime &&
  36. other.includeArchived == includeArchived;
  37. }
  38. @override
  39. int get hashCode {
  40. return isDarkTheme.hashCode ^
  41. showFavoriteOnly.hashCode ^
  42. relativeTime.hashCode ^
  43. includeArchived.hashCode;
  44. }
  45. }