mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2024-08-30 18:12:39 +00:00
e50d708c21
* feat: create database view on same database * feat: switch tag between views * fix: calendar tool bar * fix: set layout setting * chore: update collab rev * fix: board layout issue * test: add integration tests * test: add calendar start from day test
37 lines
1016 B
Dart
37 lines
1016 B
Dart
import 'package:appflowy/startup/plugin/plugin.dart';
|
|
import 'package:appflowy/workspace/application/view/view_listener.dart';
|
|
import 'package:dartz/dartz.dart';
|
|
import 'package:appflowy_backend/log.dart';
|
|
import 'package:appflowy_backend/protobuf/flowy-folder2/view.pb.dart';
|
|
import 'package:flutter/material.dart';
|
|
|
|
class ViewPluginNotifier extends PluginNotifier<Option<DeletedViewPB>> {
|
|
final ViewListener? _viewListener;
|
|
ViewPB view;
|
|
|
|
@override
|
|
final ValueNotifier<Option<DeletedViewPB>> isDeleted = ValueNotifier(none());
|
|
|
|
ViewPluginNotifier({
|
|
required this.view,
|
|
}) : _viewListener = ViewListener(viewId: view.id) {
|
|
_viewListener?.start(
|
|
onViewUpdated: (updatedView) {
|
|
view = updatedView;
|
|
},
|
|
onViewMoveToTrash: (result) {
|
|
result.fold(
|
|
(deletedView) => isDeleted.value = some(deletedView),
|
|
(err) => Log.error(err),
|
|
);
|
|
},
|
|
);
|
|
}
|
|
|
|
@override
|
|
void dispose() {
|
|
isDeleted.dispose();
|
|
_viewListener?.stop();
|
|
}
|
|
}
|