Richard Shiue ea61c81cce
feat(flutter_desktop): open created filtered rows (#6522)
* fix: revert previous implementation

* feat: open created but hidden rows as page

* fix: cargo clippy

* test: add integration tests

* fix: typo

* fix: flutter analyzer

* chore: clean up code

* chore: code cleanup

* chore: code cleanup
2024-10-11 11:04:03 +08:00

47 lines
1.5 KiB
Dart

import 'dart:collection';
import 'package:appflowy/plugins/database/application/field/filter_entities.dart';
import 'package:appflowy_backend/protobuf/flowy-database2/protobuf.dart';
import 'package:appflowy_backend/protobuf/flowy-error/errors.pb.dart';
import 'package:appflowy_result/appflowy_result.dart';
import 'package:freezed_annotation/freezed_annotation.dart';
import 'field/field_info.dart';
import 'field/sort_entities.dart';
import 'row/row_cache.dart';
import 'row/row_service.dart';
part 'defines.freezed.dart';
typedef OnFieldsChanged = void Function(UnmodifiableListView<FieldInfo>);
typedef OnFiltersChanged = void Function(List<DatabaseFilter>);
typedef OnSortsChanged = void Function(List<DatabaseSort>);
typedef OnDatabaseChanged = void Function(DatabasePB);
typedef OnRowsCreated = void Function(List<InsertedRowPB> rows);
typedef OnRowsUpdated = void Function(
List<RowId> rowIds,
ChangedReason reason,
);
typedef OnRowsDeleted = void Function(List<RowId> rowIds);
typedef OnNumOfRowsChanged = void Function(
UnmodifiableListView<RowInfo> rows,
UnmodifiableMapView<RowId, RowInfo> rowById,
ChangedReason reason,
);
typedef OnRowsVisibilityChanged = void Function(
List<(RowId, bool)> rowVisibilityChanges,
);
@freezed
class LoadingState with _$LoadingState {
const factory LoadingState.idle() = _Idle;
const factory LoadingState.loading() = _Loading;
const factory LoadingState.finish(
FlowyResult<void, FlowyError> successOrFail,
) = _Finish;
const LoadingState._();
bool isLoading() => this is _Loading;
}