map_state.model.dart 1.1 KB

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