2024-01-12 19:53:14 +01:00
|
|
|
part of '../home_photos2.dart';
|
|
|
|
|
|
|
|
@genCopyWith
|
|
|
|
@toString
|
|
|
|
class _State {
|
|
|
|
const _State({
|
|
|
|
required this.files,
|
|
|
|
required this.isLoading,
|
|
|
|
required this.transformedItems,
|
|
|
|
required this.selectedItems,
|
2024-05-06 09:33:36 +02:00
|
|
|
required this.visibleDates,
|
|
|
|
required this.queriedDates,
|
2024-01-12 19:53:14 +01:00
|
|
|
required this.isEnableMemoryCollection,
|
|
|
|
required this.memoryCollections,
|
|
|
|
this.contentListMaxExtent,
|
2024-01-13 11:57:44 +01:00
|
|
|
this.syncProgress,
|
2024-01-12 19:53:14 +01:00
|
|
|
required this.zoom,
|
|
|
|
this.scale,
|
2024-05-06 09:33:36 +02:00
|
|
|
this.viewWidth,
|
|
|
|
this.viewHeight,
|
|
|
|
this.itemPerRow,
|
|
|
|
this.itemSize,
|
|
|
|
required this.isScrolling,
|
|
|
|
required this.filesSummary,
|
|
|
|
this.minimapItems,
|
|
|
|
required this.minimapYRatio,
|
|
|
|
this.scrollDate,
|
2024-01-12 19:53:14 +01:00
|
|
|
this.error,
|
|
|
|
});
|
|
|
|
|
|
|
|
factory _State.init({
|
|
|
|
required bool isEnableMemoryCollection,
|
|
|
|
required int zoom,
|
|
|
|
}) =>
|
|
|
|
_State(
|
|
|
|
files: const [],
|
|
|
|
isLoading: false,
|
|
|
|
transformedItems: const [],
|
|
|
|
selectedItems: const {},
|
2024-05-06 09:33:36 +02:00
|
|
|
visibleDates: const {},
|
|
|
|
queriedDates: const {},
|
2024-01-12 19:53:14 +01:00
|
|
|
isEnableMemoryCollection: isEnableMemoryCollection,
|
|
|
|
memoryCollections: const [],
|
|
|
|
zoom: zoom,
|
2024-05-06 09:33:36 +02:00
|
|
|
isScrolling: false,
|
|
|
|
filesSummary: const DbFilesSummary(items: {}),
|
|
|
|
minimapYRatio: 1,
|
2024-01-12 19:53:14 +01:00
|
|
|
);
|
|
|
|
|
|
|
|
@override
|
|
|
|
String toString() => _$toString();
|
|
|
|
|
|
|
|
final List<FileDescriptor> files;
|
|
|
|
final bool isLoading;
|
|
|
|
final List<_Item> transformedItems;
|
|
|
|
final Set<_Item> selectedItems;
|
2024-05-06 09:33:36 +02:00
|
|
|
final DbFilesSummary filesSummary;
|
|
|
|
final Set<_VisibleDate> visibleDates;
|
|
|
|
final Set<Date> queriedDates;
|
2024-01-12 19:53:14 +01:00
|
|
|
|
|
|
|
final bool isEnableMemoryCollection;
|
|
|
|
final List<Collection> memoryCollections;
|
|
|
|
|
|
|
|
final double? contentListMaxExtent;
|
2024-01-13 11:57:44 +01:00
|
|
|
final Progress? syncProgress;
|
2024-01-12 19:53:14 +01:00
|
|
|
|
|
|
|
final int zoom;
|
|
|
|
final double? scale;
|
|
|
|
|
2024-05-06 09:33:36 +02:00
|
|
|
final double? viewWidth;
|
|
|
|
final double? viewHeight;
|
|
|
|
final int? itemPerRow;
|
|
|
|
final double? itemSize;
|
|
|
|
final bool isScrolling;
|
|
|
|
final List<_MinimapItem>? minimapItems;
|
|
|
|
final double minimapYRatio;
|
|
|
|
final Date? scrollDate;
|
|
|
|
|
2024-01-12 19:53:14 +01:00
|
|
|
final ExceptionEvent? error;
|
|
|
|
}
|
|
|
|
|
|
|
|
abstract class _Event {}
|
|
|
|
|
|
|
|
/// Load the files
|
|
|
|
@toString
|
|
|
|
class _LoadItems implements _Event {
|
|
|
|
const _LoadItems();
|
|
|
|
|
|
|
|
@override
|
|
|
|
String toString() => _$toString();
|
|
|
|
}
|
|
|
|
|
2024-01-30 18:31:52 +01:00
|
|
|
/// User explicitly requested to refresh the data, e.g., performed the
|
|
|
|
/// pull-to-refresh action
|
2024-01-12 19:53:14 +01:00
|
|
|
@toString
|
2024-01-30 18:31:52 +01:00
|
|
|
class _RequestRefresh implements _Event {
|
|
|
|
const _RequestRefresh();
|
2024-01-12 19:53:14 +01:00
|
|
|
|
|
|
|
@override
|
|
|
|
String toString() => _$toString();
|
|
|
|
}
|
|
|
|
|
|
|
|
/// Transform the file list (e.g., filtering, sorting, etc)
|
|
|
|
@toString
|
|
|
|
class _TransformItems implements _Event {
|
2024-05-06 09:33:36 +02:00
|
|
|
const _TransformItems(this.files, this.summary);
|
2024-01-12 19:53:14 +01:00
|
|
|
|
|
|
|
@override
|
|
|
|
String toString() => _$toString();
|
|
|
|
|
2024-05-06 09:33:36 +02:00
|
|
|
final List<FileDescriptor> files;
|
|
|
|
final DbFilesSummary summary;
|
2024-01-12 19:53:14 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
@toString
|
|
|
|
class _OnItemTransformed implements _Event {
|
2024-05-06 09:33:36 +02:00
|
|
|
const _OnItemTransformed(this.items, this.memoryCollections, this.dates);
|
2024-01-12 19:53:14 +01:00
|
|
|
|
|
|
|
@override
|
|
|
|
String toString() => _$toString();
|
|
|
|
|
|
|
|
final List<_Item> items;
|
|
|
|
final List<Collection> memoryCollections;
|
2024-05-06 09:33:36 +02:00
|
|
|
final Set<Date> dates;
|
2024-01-12 19:53:14 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/// Set the currently selected items
|
|
|
|
@toString
|
|
|
|
class _SetSelectedItems implements _Event {
|
|
|
|
const _SetSelectedItems({
|
|
|
|
required this.items,
|
|
|
|
});
|
|
|
|
|
|
|
|
@override
|
|
|
|
String toString() => _$toString();
|
|
|
|
|
|
|
|
final Set<_Item> items;
|
|
|
|
}
|
|
|
|
|
|
|
|
@toString
|
|
|
|
class _AddSelectedItemsToCollection implements _Event {
|
|
|
|
const _AddSelectedItemsToCollection(this.collection);
|
|
|
|
|
|
|
|
@override
|
|
|
|
String toString() => _$toString();
|
|
|
|
|
|
|
|
final Collection collection;
|
|
|
|
}
|
|
|
|
|
|
|
|
@toString
|
|
|
|
class _ArchiveSelectedItems implements _Event {
|
|
|
|
const _ArchiveSelectedItems();
|
|
|
|
|
|
|
|
@override
|
|
|
|
String toString() => _$toString();
|
|
|
|
}
|
|
|
|
|
|
|
|
@toString
|
|
|
|
class _DeleteSelectedItems implements _Event {
|
|
|
|
const _DeleteSelectedItems();
|
|
|
|
|
|
|
|
@override
|
|
|
|
String toString() => _$toString();
|
|
|
|
}
|
|
|
|
|
|
|
|
@toString
|
|
|
|
class _DownloadSelectedItems implements _Event {
|
|
|
|
const _DownloadSelectedItems();
|
|
|
|
|
|
|
|
@override
|
|
|
|
String toString() => _$toString();
|
|
|
|
}
|
|
|
|
|
|
|
|
@toString
|
2024-05-06 09:33:36 +02:00
|
|
|
class _AddVisibleDate implements _Event {
|
|
|
|
const _AddVisibleDate(this.date);
|
2024-01-12 19:53:14 +01:00
|
|
|
|
|
|
|
@override
|
|
|
|
String toString() => _$toString();
|
|
|
|
|
2024-05-06 09:33:36 +02:00
|
|
|
final _VisibleDate date;
|
2024-01-12 19:53:14 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
@toString
|
2024-05-06 09:33:36 +02:00
|
|
|
class _RemoveVisibleDate implements _Event {
|
|
|
|
const _RemoveVisibleDate(this.date);
|
2024-01-12 19:53:14 +01:00
|
|
|
|
|
|
|
@override
|
|
|
|
String toString() => _$toString();
|
|
|
|
|
2024-05-06 09:33:36 +02:00
|
|
|
final _VisibleDate date;
|
2024-01-12 19:53:14 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
@toString
|
|
|
|
class _SetContentListMaxExtent implements _Event {
|
|
|
|
const _SetContentListMaxExtent(this.value);
|
|
|
|
|
|
|
|
@override
|
|
|
|
String toString() => _$toString();
|
|
|
|
|
|
|
|
final double? value;
|
|
|
|
}
|
|
|
|
|
2024-01-13 11:57:44 +01:00
|
|
|
@toString
|
|
|
|
class _SetSyncProgress implements _Event {
|
|
|
|
const _SetSyncProgress(this.progress);
|
|
|
|
|
|
|
|
@override
|
|
|
|
String toString() => _$toString();
|
|
|
|
|
|
|
|
final Progress? progress;
|
|
|
|
}
|
|
|
|
|
2024-01-12 19:53:14 +01:00
|
|
|
@toString
|
|
|
|
class _StartScaling implements _Event {
|
|
|
|
const _StartScaling();
|
|
|
|
|
|
|
|
@override
|
|
|
|
String toString() => _$toString();
|
|
|
|
}
|
|
|
|
|
|
|
|
@toString
|
|
|
|
class _EndScaling implements _Event {
|
|
|
|
const _EndScaling();
|
|
|
|
|
|
|
|
@override
|
|
|
|
String toString() => _$toString();
|
|
|
|
}
|
|
|
|
|
|
|
|
@toString
|
|
|
|
class _SetScale implements _Event {
|
|
|
|
const _SetScale(this.scale);
|
|
|
|
|
|
|
|
@override
|
|
|
|
String toString() => _$toString();
|
|
|
|
|
|
|
|
final double scale;
|
|
|
|
}
|
|
|
|
|
2024-05-06 09:33:36 +02:00
|
|
|
@toString
|
|
|
|
class _StartScrolling implements _Event {
|
|
|
|
const _StartScrolling();
|
|
|
|
|
|
|
|
@override
|
|
|
|
String toString() => _$toString();
|
|
|
|
}
|
|
|
|
|
|
|
|
@toString
|
|
|
|
class _EndScrolling implements _Event {
|
|
|
|
const _EndScrolling();
|
|
|
|
|
|
|
|
@override
|
|
|
|
String toString() => _$toString();
|
|
|
|
}
|
|
|
|
|
|
|
|
@toString
|
|
|
|
class _SetLayoutConstraint implements _Event {
|
|
|
|
const _SetLayoutConstraint(this.viewWidth, this.viewHeight);
|
|
|
|
|
|
|
|
@override
|
|
|
|
String toString() => _$toString();
|
|
|
|
|
|
|
|
final double viewWidth;
|
|
|
|
final double viewHeight;
|
|
|
|
}
|
|
|
|
|
|
|
|
@toString
|
|
|
|
class _TransformMinimap implements _Event {
|
|
|
|
const _TransformMinimap();
|
|
|
|
|
|
|
|
@override
|
|
|
|
String toString() => _$toString();
|
|
|
|
}
|
|
|
|
|
|
|
|
@toString
|
|
|
|
class _UpdateScrollDate implements _Event {
|
|
|
|
const _UpdateScrollDate();
|
|
|
|
|
|
|
|
@override
|
|
|
|
String toString() => _$toString();
|
|
|
|
}
|
|
|
|
|
2024-01-12 19:53:14 +01:00
|
|
|
@toString
|
|
|
|
class _SetEnableMemoryCollection implements _Event {
|
|
|
|
const _SetEnableMemoryCollection(this.value);
|
|
|
|
|
|
|
|
@override
|
|
|
|
String toString() => _$toString();
|
|
|
|
|
|
|
|
final bool value;
|
|
|
|
}
|
|
|
|
|
2024-01-13 19:23:30 +01:00
|
|
|
@toString
|
|
|
|
class _SetMemoriesRange implements _Event {
|
|
|
|
const _SetMemoriesRange(this.value);
|
|
|
|
|
|
|
|
@override
|
|
|
|
String toString() => _$toString();
|
|
|
|
|
|
|
|
final int value;
|
|
|
|
}
|
|
|
|
|
2024-01-13 19:48:49 +01:00
|
|
|
@toString
|
|
|
|
class _UpdateDateTimeGroup implements _Event {
|
|
|
|
const _UpdateDateTimeGroup();
|
|
|
|
|
|
|
|
@override
|
|
|
|
String toString() => _$toString();
|
|
|
|
}
|
|
|
|
|
2024-01-12 19:53:14 +01:00
|
|
|
@toString
|
|
|
|
class _SetError implements _Event {
|
|
|
|
const _SetError(this.error, [this.stackTrace]);
|
|
|
|
|
|
|
|
@override
|
|
|
|
String toString() => _$toString();
|
|
|
|
|
|
|
|
final Object error;
|
|
|
|
final StackTrace? stackTrace;
|
|
|
|
}
|