mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2024-08-30 18:12:39 +00:00
Merge pull request #988 from AppFlowy-IO/feat/edit_multi_text_cell
This commit is contained in:
commit
f9235491fe
@ -14,33 +14,37 @@ class EditableCellNotifier {
|
||||
}
|
||||
|
||||
class EditableRowNotifier {
|
||||
Map<EditableCellId, EditableCellNotifier> cells = {};
|
||||
final Map<EditableCellId, EditableCellNotifier> _cells = {};
|
||||
|
||||
void insertCell(
|
||||
GridCellIdentifier cellIdentifier,
|
||||
EditableCellNotifier notifier,
|
||||
) {
|
||||
cells[EditableCellId.from(cellIdentifier)] = notifier;
|
||||
_cells[EditableCellId.from(cellIdentifier)] = notifier;
|
||||
}
|
||||
|
||||
void becomeFirstResponder() {
|
||||
for (final notifier in cells.values) {
|
||||
for (final notifier in _cells.values) {
|
||||
notifier.becomeFirstResponder.notify();
|
||||
}
|
||||
}
|
||||
|
||||
void resignFirstResponder() {
|
||||
for (final notifier in cells.values) {
|
||||
for (final notifier in _cells.values) {
|
||||
notifier.resignFirstResponder.notify();
|
||||
}
|
||||
}
|
||||
|
||||
void clear() {
|
||||
_cells.clear();
|
||||
}
|
||||
|
||||
void dispose() {
|
||||
for (final notifier in cells.values) {
|
||||
for (final notifier in _cells.values) {
|
||||
notifier.resignFirstResponder.notify();
|
||||
}
|
||||
|
||||
cells.clear();
|
||||
_cells.clear();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -89,20 +89,20 @@ class _BoardCardState extends State<BoardCard> {
|
||||
List<GridCellIdentifier> cells,
|
||||
) {
|
||||
final List<Widget> children = [];
|
||||
rowNotifier.clear();
|
||||
cells.asMap().forEach(
|
||||
(int index, GridCellIdentifier cellId) {
|
||||
final cellNotifier = EditableCellNotifier();
|
||||
Widget child = widget.cellBuilder.buildCell(
|
||||
widget.groupId,
|
||||
cellId,
|
||||
widget.isEditing,
|
||||
index == 0 ? widget.isEditing : false,
|
||||
cellNotifier,
|
||||
);
|
||||
|
||||
if (index == 0) {
|
||||
rowNotifier.insertCell(cellId, cellNotifier);
|
||||
}
|
||||
|
||||
child = Padding(
|
||||
key: cellId.key(),
|
||||
padding: const EdgeInsets.only(left: 4, right: 4),
|
||||
|
Loading…
Reference in New Issue
Block a user