immich/mobile/lib/domain/models/time_range.model.dart
Adam Gastineau dc813e2816
fix(mobile): handle transient loading states for map timelines (#29735)
* fix(mobile): handle transient loading states for map timelines

* fix(mobile): handle transient loading states for map timelines

* Add support for new method

* Rewrote map options notifier to be more Riverpody
2026-08-28 06:06:10 -07:00

19 lines
668 B
Dart

import 'package:freezed_annotation/freezed_annotation.dart';
import 'package:immich_mobile/utils/option.dart';
part 'time_range.model.freezed.dart';
// copyWith is hand-written so that fields can be cleared via optionals
@Freezed(copyWith: false, fromJson: false, toJson: false)
abstract class TimeRange with _$TimeRange {
const TimeRange._();
const factory TimeRange({DateTime? from, DateTime? to}) = _TimeRange;
TimeRange copyWith({Option<DateTime>? from, Option<DateTime>? to}) {
return TimeRange(from: from.patch(this.from), to: to.patch(this.to));
}
TimeRange clearFrom() => TimeRange(to: to);
TimeRange clearTo() => TimeRange(from: from);
}