more refactors and logs page handling

This commit is contained in:
shenlong-tanwen
2024-10-23 02:30:46 +05:30
parent 8f47645cdb
commit a0afea04d8
90 changed files with 2386 additions and 584 deletions
@@ -26,6 +26,17 @@ class AssetGridState {
renderList: renderList ?? this.renderList,
);
}
@override
bool operator ==(covariant AssetGridState other) {
if (identical(this, other)) return true;
return other.renderList == renderList &&
other.isDragScrolling == isDragScrolling;
}
@override
int get hashCode => renderList.hashCode ^ isDragScrolling.hashCode;
}
class AssetGridCubit extends Cubit<AssetGridState> {
@@ -43,6 +54,9 @@ class AssetGridCubit extends Cubit<AssetGridState> {
super(AssetGridState.empty()) {
_renderListSubscription =
_renderListProvider.renderStreamProvider().listen((renderList) {
if (renderList == state.renderList) {
return;
}
_bufOffset = 0;
_buf = [];
emit(state.copyWith(renderList: renderList));
@@ -87,8 +101,8 @@ class AssetGridCubit extends Cubit<AssetGridState> {
// load the calculated batch (start:start+len) from the DB and put it into the buffer
_buf = await _renderListProvider.renderAssetProvider(
offset: start,
limit: len,
offset: start,
);
_bufOffset = start;