| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697 | 
							- import 'package:app_flowy/plugins/grid/application/prelude.dart';
 
- import 'package:flutter/material.dart';
 
- abstract class FocusableBoardCell {
 
-   set becomeFocus(bool isFocus);
 
- }
 
- class EditableCellNotifier {
 
-   final ValueNotifier<bool> isCellEditing;
 
-   EditableCellNotifier({bool isEditing = false})
 
-       : isCellEditing = ValueNotifier(isEditing);
 
-   void dispose() {
 
-     isCellEditing.dispose();
 
-   }
 
- }
 
- class EditableRowNotifier {
 
-   final Map<EditableCellId, EditableCellNotifier> _cells = {};
 
-   final ValueNotifier<bool> isEditing;
 
-   EditableRowNotifier({required bool isEditing})
 
-       : isEditing = ValueNotifier(isEditing);
 
-   void bindCell(
 
-     GridCellIdentifier cellIdentifier,
 
-     EditableCellNotifier notifier,
 
-   ) {
 
-     assert(
 
-       _cells.values.isEmpty,
 
-       'Only one cell can receive the notification',
 
-     );
 
-     final id = EditableCellId.from(cellIdentifier);
 
-     _cells[id]?.dispose();
 
-     notifier.isCellEditing.addListener(() {
 
-       isEditing.value = notifier.isCellEditing.value;
 
-     });
 
-     _cells[EditableCellId.from(cellIdentifier)] = notifier;
 
-   }
 
-   void becomeFirstResponder() {
 
-     if (_cells.values.isEmpty) return;
 
-     assert(
 
-       _cells.values.length == 1,
 
-       'Only one cell can receive the notification',
 
-     );
 
-     _cells.values.first.isCellEditing.value = true;
 
-   }
 
-   void resignFirstResponder() {
 
-     if (_cells.values.isEmpty) return;
 
-     assert(
 
-       _cells.values.length == 1,
 
-       'Only one cell can receive the notification',
 
-     );
 
-     _cells.values.first.isCellEditing.value = false;
 
-   }
 
-   void unbind() {
 
-     for (final notifier in _cells.values) {
 
-       notifier.dispose();
 
-     }
 
-     _cells.clear();
 
-   }
 
-   void dispose() {
 
-     for (final notifier in _cells.values) {
 
-       notifier.dispose();
 
-     }
 
-     _cells.clear();
 
-   }
 
- }
 
- abstract class EditableCell {
 
-   // Each cell notifier will be bind to the [EditableRowNotifier], which enable
 
-   // the row notifier receive its cells event. For example: begin editing the
 
-   // cell or end editing the cell.
 
-   //
 
-   EditableCellNotifier? get editableNotifier;
 
- }
 
- class EditableCellId {
 
-   String fieldId;
 
-   String rowId;
 
-   EditableCellId(this.rowId, this.fieldId);
 
-   factory EditableCellId.from(GridCellIdentifier cellIdentifier) =>
 
-       EditableCellId(
 
-         cellIdentifier.rowId,
 
-         cellIdentifier.fieldId,
 
-       );
 
- }
 
 
  |