fix: options don't refresh after moving the card (#1536)

Co-authored-by: nathan <nathan@appflowy.io>
This commit is contained in:
Nathan.fooo
2022-12-05 15:23:59 +08:00
committed by GitHub
parent 72dc0b8f67
commit a2f9ca2f28
5 changed files with 36 additions and 9 deletions

View File

@ -97,11 +97,22 @@ class GridRowCache {
}
}
void _updateRows(List<RowPB> updatedRows) {
void _updateRows(List<UpdatedRowPB> updatedRows) {
if (updatedRows.isEmpty) return;
List<RowPB> rowPBs = [];
for (final updatedRow in updatedRows) {
for (final fieldId in updatedRow.fieldIds) {
final key = GridCellCacheKey(
fieldId: fieldId,
rowId: updatedRow.row.id,
);
_cellCache.remove(key);
}
rowPBs.add(updatedRow.row);
}
final updatedIndexs =
_rowList.updateRows(updatedRows, (rowPB) => buildGridRow(rowPB));
_rowList.updateRows(rowPBs, (rowPB) => buildGridRow(rowPB));
if (updatedIndexs.isNotEmpty) {
_rowChangeReasonNotifier.receive(RowsChangedReason.update(updatedIndexs));
}

View File

@ -114,7 +114,7 @@ class _PropertyList extends StatelessWidget {
builder: (context, state) {
return Column(
children: [
Expanded(child: _wrapScrollbar(buildList(state))),
Expanded(child: _wrapScrollbar(buildRowCells(state))),
const VSpace(10),
_CreateFieldButton(
viewId: viewId,
@ -126,7 +126,7 @@ class _PropertyList extends StatelessWidget {
);
}
Widget buildList(RowDetailState state) {
Widget buildRowCells(RowDetailState state) {
return ListView.separated(
controller: _scrollController,
itemCount: state.gridCells.length,