Bring projects, wikis, and teams together with AI. AppFlowy is the AI collaborative workspace where you achieve more without losing control of your data. The leading open source Notion alternative.
Dart blogconfluence-alternativecontent-managementcontent-servicesdocumentationflutternote-takingnotion-alternativeproject-managementtask-managementteam-collaborationwiki
chore: remove field listener in cell
appflowy5af378c81087
diff --git a/frontend/app_flowy/lib/startup/deps_resolver.dart b/frontend/app_flowy/lib/startup/deps_resolver.dartindex da5274b0ca..f8583046b6 100644--- a/frontend/app_flowy/lib/startup/deps_resolver.dart+++ b/frontend/app_flowy/lib/startup/deps_resolver.dart@@ -168,34 +168,34 @@ void _resolveGridDeps(GetIt getIt) {),);- getIt.registerFactoryParam<TextCellBloc, GridCellDataContext, void>(+ getIt.registerFactoryParam<TextCellBloc, GridCellContext, void>((context, _) => TextCellBloc(- cellDataContext: context,+ cellContext: context,),);- getIt.registerFactoryParam<SelectionCellBloc, GridCellDataContext, void>(+ getIt.registerFactoryParam<SelectionCellBloc, GridCellContext, void>((context, _) => SelectionCellBloc(- cellDataContext: context,+ cellContext: context,),);- getIt.registerFactoryParam<NumberCellBloc, GridCellDataContext, void>(+ getIt.registerFactoryParam<NumberCellBloc, GridCellContext, void>((context, _) => NumberCellBloc(- cellDataContext: context,+ cellContext: context,),);- getIt.registerFactoryParam<DateCellBloc, GridCellDataContext, void>(+ getIt.registerFactoryParam<DateCellBloc, GridCellContext, void>((context, _) => DateCellBloc(- cellDataContext: context,+ cellContext: context,),);- getIt.registerFactoryParam<CheckboxCellBloc, GridCellDataContext, void>(+ getIt.registerFactoryParam<CheckboxCellBloc, GridCellContext, void>((cellData, _) => CheckboxCellBloc(service: CellService(),- cellDataContext: cellData,+ cellContext: cellData,),);diff --git a/frontend/app_flowy/lib/workspace/application/grid/cell/cell_service.dart b/frontend/app_flowy/lib/workspace/application/grid/cell/cell_service.dartindex 9cf5ddd042..2156d86ebc 100644--- a/frontend/app_flowy/lib/workspace/application/grid/cell/cell_service.dart+++ b/frontend/app_flowy/lib/workspace/application/grid/cell/cell_service.dart@@ -11,10 +11,10 @@ import 'package:freezed_annotation/freezed_annotation.dart';part 'cell_service.freezed.dart';-class GridCellDataContext {+class GridCellContext {GridCell cellData;GridCellCache cellCache;- GridCellDataContext({+ GridCellContext({required this.cellData,required this.cellCache,});@@ -30,15 +30,47 @@ class GridCellDataContext {FieldType get fieldType => cellData.field.fieldType;Field get field => cellData.field;++ GridCellCacheKey get cacheKey => GridCellCacheKey(rowId: cellData.rowId, fieldId: cellData.field.id);++ T? getCacheData<T>() {+ return cellCache.get(cacheKey);+ }++ void setCacheData(dynamic data) {+ cellCache.insert(GridCellCacheData(key: cacheKey, value: data));+ }++ void onFieldChanged(VoidCallback callback) {+ cellCache.addListener(fieldId, rowId, callback);+ }++ void removeListener() {+ cellCache.removeListener(fieldId, rowId);+ }}// key: rowIdtypedef CellDataMap = LinkedHashMap<String, GridCell>;-abstract class GridCellCacheData {- String get fieldId;- String get cacheKey;- dynamic get cacheData;+class GridCellCacheData {+ GridCellCacheKey key;+ dynamic value;+ GridCellCacheData({+ required this.key,+ required this.value,+ });+}++class GridCellCacheKey {+ final String fieldId;+ final String rowId;+ GridCellCacheKey({+ required this.fieldId,+ required this.rowId,+ });++ String get cellId => "$rowId + $fieldId";}abstract class GridCellFieldDelegate {@@ -49,33 +81,56 @@ class GridCellCache {final String gridId;final GridCellFieldDelegate fieldDelegate;+ /// fieldId: {rowId: callback}+ final Map<String, Map<String, VoidCallback>> _cellListenerByFieldId = {};+/// fieldId: {cacheKey: cacheData}- final Map<String, Map<String, dynamic>> _cells = {};+ final Map<String, Map<String, dynamic>> _cellCacheByFieldId = {};GridCellCache({required this.gridId,required this.fieldDelegate,}) {fieldDelegate.onFieldChanged((fieldId) {- _cells.remove(fieldId);+ _cellCacheByFieldId.remove(fieldId);+ final map = _cellListenerByFieldId[fieldId];+ if (map != null) {+ for (final callback in map.values) {+ callback();+ }+ }});}- void insert<T extends GridCellCacheData>(T cacheData) {- var map = _cells[cacheData.fieldId];+ void addListener(String fieldId, String rowId, VoidCallback callback) {+ var map = _cellListenerByFieldId[fieldId];+ if (map == null) {+ _cellListenerByFieldId[fieldId] = {};+ map = _cellListenerByFieldId[fieldId];+ }++ map![rowId] = callback;+ }++ void removeListener(String fieldId, String rowId) {+ _cellListenerByFieldId[fieldId]?.remove(rowId);+ }++ void insert<T extends GridCellCacheData>(T item) {+ var map = _cellCacheByFieldId[item.key.fieldId];if (map == null) {- _cells[cacheData.fieldId] = {};- map = _cells[cacheData.fieldId];+ _cellCacheByFieldId[item.key.fieldId] = {};+ map = _cellCacheByFieldId[item.key.fieldId];}- map![cacheData.cacheKey] = cacheData.cacheData;+ map![item.key.cellId] = item.value;}- T? get<T>(String fieldId, String cacheKey) {- final map = _cells[fieldId];+ T? get<T>(GridCellCacheKey key) {+ final map = _cellCacheByFieldId[key.fieldId];if (map == null) {return null;} else {- final object = map[cacheKey];+ final object = map[key.cellId];if (object is T) {return object;} else {diff --git a/frontend/app_flowy/lib/workspace/application/grid/cell/checkbox_cell_bloc.dart b/frontend/app_flowy/lib/workspace/application/grid/cell/checkbox_cell_bloc.dartindex 11ab2d2d8a..5acf532af6 100644--- a/frontend/app_flowy/lib/workspace/application/grid/cell/checkbox_cell_bloc.dart+++ b/frontend/app_flowy/lib/workspace/application/grid/cell/checkbox_cell_bloc.dart@@ -14,10 +14,10 @@ class CheckboxCellBloc extends Bloc<CheckboxCellEvent, CheckboxCellState> {CheckboxCellBloc({required CellService service,- required GridCellDataContext cellDataContext,+ required GridCellContext cellContext,}) : _service = service,- _cellListener = CellListener(rowId: cellDataContext.rowId, fieldId: cellDataContext.fieldId),- super(CheckboxCellState.initial(cellDataContext.cellData)) {+ _cellListener = CellListener(rowId: cellContext.rowId, fieldId: cellContext.fieldId),+ super(CheckboxCellState.initial(cellContext.cellData)) {on<CheckboxCellEvent>((event, emit) async {await event.map(diff --git a/frontend/app_flowy/lib/workspace/application/grid/cell/date_cell_bloc.dart b/frontend/app_flowy/lib/workspace/application/grid/cell/date_cell_bloc.dartindex 3f08ede31f..7f5f1fc808 100644--- a/frontend/app_flowy/lib/workspace/application/grid/cell/date_cell_bloc.dart+++ b/frontend/app_flowy/lib/workspace/application/grid/cell/date_cell_bloc.dart@@ -14,11 +14,11 @@ class DateCellBloc extends Bloc<DateCellEvent, DateCellState> {final CellListener _cellListener;final SingleFieldListener _fieldListener;- DateCellBloc({required GridCellDataContext cellDataContext})+ DateCellBloc({required GridCellContext cellContext}): _service = CellService(),- _cellListener = CellListener(rowId: cellDataContext.rowId, fieldId: cellDataContext.fieldId),- _fieldListener = SingleFieldListener(fieldId: cellDataContext.fieldId),- super(DateCellState.initial(cellDataContext.cellData)) {+ _cellListener = CellListener(rowId: cellContext.rowId, fieldId: cellContext.fieldId),+ _fieldListener = SingleFieldListener(fieldId: cellContext.fieldId),+ super(DateCellState.initial(cellContext.cellData)) {on<DateCellEvent>((event, emit) async {event.map(diff --git a/frontend/app_flowy/lib/workspace/application/grid/cell/number_cell_bloc.dart b/frontend/app_flowy/lib/workspace/application/grid/cell/number_cell_bloc.dartindex 9ebd59f1e2..b46d70cc8f 100644--- a/frontend/app_flowy/lib/workspace/application/grid/cell/number_cell_bloc.dart+++ b/frontend/app_flowy/lib/workspace/application/grid/cell/number_cell_bloc.dart@@ -15,11 +15,11 @@ class NumberCellBloc extends Bloc<NumberCellEvent, NumberCellState> {final SingleFieldListener _fieldListener;NumberCellBloc({- required GridCellDataContext cellDataContext,+ required GridCellContext cellContext,}) : _service = CellService(),- _cellListener = CellListener(rowId: cellDataContext.rowId, fieldId: cellDataContext.fieldId),- _fieldListener = SingleFieldListener(fieldId: cellDataContext.fieldId),- super(NumberCellState.initial(cellDataContext.cellData)) {+ _cellListener = CellListener(rowId: cellContext.rowId, fieldId: cellContext.fieldId),+ _fieldListener = SingleFieldListener(fieldId: cellContext.fieldId),+ super(NumberCellState.initial(cellContext.cellData)) {on<NumberCellEvent>((event, emit) async {await event.map(diff --git a/frontend/app_flowy/lib/workspace/application/grid/cell/selection_cell_bloc.dart b/frontend/app_flowy/lib/workspace/application/grid/cell/selection_cell_bloc.dartindex e5a50d478a..a10757d220 100644--- a/frontend/app_flowy/lib/workspace/application/grid/cell/selection_cell_bloc.dart+++ b/frontend/app_flowy/lib/workspace/application/grid/cell/selection_cell_bloc.dart@@ -1,12 +1,14 @@-import 'package:app_flowy/workspace/application/grid/cell/cell_listener.dart';-import 'package:app_flowy/workspace/application/grid/cell/cell_service.dart';-import 'package:app_flowy/workspace/application/grid/cell/select_option_service.dart';-import 'package:app_flowy/workspace/application/grid/field/field_listener.dart';+import 'dart:async';+import 'package:flowy_sdk/log.dart';import 'package:flowy_sdk/protobuf/flowy-grid/selection_type_option.pb.dart';import 'package:flutter_bloc/flutter_bloc.dart';import 'package:freezed_annotation/freezed_annotation.dart';-import 'dart:async';++import 'package:app_flowy/workspace/application/grid/cell/cell_listener.dart';+import 'package:app_flowy/workspace/application/grid/cell/cell_service.dart';+import 'package:app_flowy/workspace/application/grid/cell/select_option_service.dart';+import 'package:app_flowy/workspace/application/grid/field/field_listener.dart';part 'selection_cell_bloc.freezed.dart';@@ -14,19 +16,21 @@ class SelectionCellBloc extends Bloc<SelectionCellEvent, SelectionCellState> {final SelectOptionService _service;final CellListener _cellListener;final SingleFieldListener _fieldListener;+ final GridCellContext _cellContext;SelectionCellBloc({- required GridCellDataContext cellDataContext,+ required GridCellContext cellContext,}) : _service = SelectOptionService(),- _cellListener = CellListener(rowId: cellDataContext.rowId, fieldId: cellDataContext.fieldId),- _fieldListener = SingleFieldListener(fieldId: cellDataContext.fieldId),- super(SelectionCellState.initial(cellDataContext.cellData)) {+ _cellContext = cellContext,+ _cellListener = CellListener(rowId: cellContext.rowId, fieldId: cellContext.fieldId),+ _fieldListener = SingleFieldListener(fieldId: cellContext.fieldId),+ super(SelectionCellState.initial(cellContext.cellData)) {on<SelectionCellEvent>((event, emit) async {await event.map(initial: (_InitialCell value) async {- _loadOptions();_startListening();+ _loadOptions();},didReceiveOptions: (_DidReceiveOptions value) {emit(state.copyWith(options: value.options, selectedOptions: value.selectedOptions));@@ -40,26 +44,35 @@ class SelectionCellBloc extends Bloc<SelectionCellEvent, SelectionCellState> {Future<void> close() async {await _cellListener.stop();await _fieldListener.stop();+ _cellContext.removeListener();return super.close();}void _loadOptions() async {- final result = await _service.getOpitonContext(- gridId: state.cellData.gridId,- fieldId: state.cellData.field.id,- rowId: state.cellData.rowId,- );- if (isClosed) {- return;+ var selectOptionContext = _cellContext.getCacheData<SelectOptionContext>();+ if (selectOptionContext == null) {+ final result = await _service.getOpitonContext(+ gridId: state.cellData.gridId,+ fieldId: state.cellData.field.id,+ rowId: state.cellData.rowId,+ );+ if (isClosed) {+ return;+ }++ result.fold(+ (newSelectOptionContext) {+ _cellContext.setCacheData(newSelectOptionContext);+ selectOptionContext = newSelectOptionContext;+ },+ (err) => Log.error(err),+ );}- result.fold(- (selectOptionContext) => add(SelectionCellEvent.didReceiveOptions(- selectOptionContext.options,- selectOptionContext.selectOptions,- )),- (err) => Log.error(err),- );+ add(SelectionCellEvent.didReceiveOptions(+ selectOptionContext!.options,+ selectOptionContext!.selectOptions,+ ));}void _startListening() {@@ -71,13 +84,15 @@ class SelectionCellBloc extends Bloc<SelectionCellEvent, SelectionCellState> {});_cellListener.start();- _fieldListener.updateFieldNotifier?.addPublishListener((result) {- result.fold(- (field) => _loadOptions(),- (err) => Log.error(err),- );- });- _fieldListener.start();+ _cellContext.onFieldChanged(() => _loadOptions());++ // _fieldListener.updateFieldNotifier?.addPublishListener((result) {+ // result.fold(+ // (field) => _loadOptions(),+ // (err) => Log.error(err),+ // );+ // });+ // _fieldListener.start();}}diff --git a/frontend/app_flowy/lib/workspace/application/grid/cell/text_cell_bloc.dart b/frontend/app_flowy/lib/workspace/application/grid/cell/text_cell_bloc.dartindex da7759d253..94cb749eb2 100644--- a/frontend/app_flowy/lib/workspace/application/grid/cell/text_cell_bloc.dart+++ b/frontend/app_flowy/lib/workspace/application/grid/cell/text_cell_bloc.dart@@ -13,10 +13,10 @@ class TextCellBloc extends Bloc<TextCellEvent, TextCellState> {final CellListener _cellListener;TextCellBloc({- required GridCellDataContext cellDataContext,+ required GridCellContext cellContext,}) : _service = CellService(),- _cellListener = CellListener(rowId: cellDataContext.rowId, fieldId: cellDataContext.fieldId),- super(TextCellState.initial(cellDataContext.cellData)) {+ _cellListener = CellListener(rowId: cellContext.rowId, fieldId: cellContext.fieldId),+ super(TextCellState.initial(cellContext.cellData)) {on<TextCellEvent>((event, emit) async {await event.map(diff --git a/frontend/app_flowy/lib/workspace/presentation/plugins/grid/src/widgets/cell/cell_builder.dart b/frontend/app_flowy/lib/workspace/presentation/plugins/grid/src/widgets/cell/cell_builder.dartindex b66cea7b07..e95fcd9a53 100755--- a/frontend/app_flowy/lib/workspace/presentation/plugins/grid/src/widgets/cell/cell_builder.dart+++ b/frontend/app_flowy/lib/workspace/presentation/plugins/grid/src/widgets/cell/cell_builder.dart@@ -8,22 +8,22 @@ import 'number_cell.dart';import 'selection_cell/selection_cell.dart';import 'text_cell.dart';-GridCellWidget buildGridCell(GridCellDataContext cellDataContext, {GridCellStyle? style}) {- final key = ValueKey(cellDataContext.cellId);- final fieldType = cellDataContext.cellData.field.fieldType;+GridCellWidget buildGridCell(GridCellContext cellContext, {GridCellStyle? style}) {+ final key = ValueKey(cellContext.cellId);+ final fieldType = cellContext.cellData.field.fieldType;switch (fieldType) {case FieldType.Checkbox:- return CheckboxCell(cellDataContext: cellDataContext, key: key);+ return CheckboxCell(cellContext: cellContext, key: key);case FieldType.DateTime:- return DateCell(cellDataContext: cellDataContext, key: key);+ return DateCell(cellContext: cellContext, key: key);case FieldType.MultiSelect:- return MultiSelectCell(cellDataContext: cellDataContext, style: style, key: key);+ return MultiSelectCell(cellContext: cellContext, style: style, key: key);case FieldType.Number:- return NumberCell(cellDataContext: cellDataContext, key: key);+ return NumberCell(cellContext: cellContext, key: key);case FieldType.RichText:- return GridTextCell(cellDataContext: cellDataContext, style: style, key: key);+ return GridTextCell(cellContext: cellContext, style: style, key: key);case FieldType.SingleSelect:- return SingleSelectCell(cellDataContext: cellDataContext, style: style, key: key);+ return SingleSelectCell(cellContext: cellContext, style: style, key: key);default:throw UnimplementedError;}diff --git a/frontend/app_flowy/lib/workspace/presentation/plugins/grid/src/widgets/cell/checkbox_cell.dart b/frontend/app_flowy/lib/workspace/presentation/plugins/grid/src/widgets/cell/checkbox_cell.dartindex 80e0468274..991b56a832 100644--- a/frontend/app_flowy/lib/workspace/presentation/plugins/grid/src/widgets/cell/checkbox_cell.dart+++ b/frontend/app_flowy/lib/workspace/presentation/plugins/grid/src/widgets/cell/checkbox_cell.dart@@ -7,10 +7,10 @@ import 'package:flutter_bloc/flutter_bloc.dart';import 'cell_builder.dart';class CheckboxCell extends GridCellWidget {- final GridCellDataContext cellDataContext;+ final GridCellContext cellContext;CheckboxCell({- required this.cellDataContext,+ required this.cellContext,Key? key,}) : super(key: key);@@ -23,7 +23,7 @@ class _CheckboxCellState extends State<CheckboxCell> {@overridevoid initState() {- _cellBloc = getIt<CheckboxCellBloc>(param1: widget.cellDataContext)..add(const CheckboxCellEvent.initial());+ _cellBloc = getIt<CheckboxCellBloc>(param1: widget.cellContext)..add(const CheckboxCellEvent.initial());super.initState();}diff --git a/frontend/app_flowy/lib/workspace/presentation/plugins/grid/src/widgets/cell/date_cell.dart b/frontend/app_flowy/lib/workspace/presentation/plugins/grid/src/widgets/cell/date_cell.dartindex 2be56133f2..a3cc807266 100644--- a/frontend/app_flowy/lib/workspace/presentation/plugins/grid/src/widgets/cell/date_cell.dart+++ b/frontend/app_flowy/lib/workspace/presentation/plugins/grid/src/widgets/cell/date_cell.dart@@ -14,10 +14,10 @@ abstract class GridCellDelegate {}class DateCell extends GridCellWidget {- final GridCellDataContext cellDataContext;+ final GridCellContext cellContext;DateCell({- required this.cellDataContext,+ required this.cellContext,Key? key,}) : super(key: key);@@ -30,7 +30,7 @@ class _DateCellState extends State<DateCell> {@overridevoid initState() {- _cellBloc = getIt<DateCellBloc>(param1: widget.cellDataContext)..add(const DateCellEvent.initial());+ _cellBloc = getIt<DateCellBloc>(param1: widget.cellContext)..add(const DateCellEvent.initial());super.initState();}diff --git a/frontend/app_flowy/lib/workspace/presentation/plugins/grid/src/widgets/cell/number_cell.dart b/frontend/app_flowy/lib/workspace/presentation/plugins/grid/src/widgets/cell/number_cell.dartindex 1b57a69ec8..168d2258d3 100644--- a/frontend/app_flowy/lib/workspace/presentation/plugins/grid/src/widgets/cell/number_cell.dart+++ b/frontend/app_flowy/lib/workspace/presentation/plugins/grid/src/widgets/cell/number_cell.dart@@ -8,10 +8,10 @@ import 'package:flutter_bloc/flutter_bloc.dart';import 'cell_builder.dart';class NumberCell extends GridCellWidget {- final GridCellDataContext cellDataContext;+ final GridCellContext cellContext;NumberCell({- required this.cellDataContext,+ required this.cellContext,Key? key,}) : super(key: key);@@ -27,7 +27,7 @@ class _NumberCellState extends State<NumberCell> {@overridevoid initState() {- _cellBloc = getIt<NumberCellBloc>(param1: widget.cellDataContext)..add(const NumberCellEvent.initial());+ _cellBloc = getIt<NumberCellBloc>(param1: widget.cellContext)..add(const NumberCellEvent.initial());_controller = TextEditingController(text: _cellBloc.state.content);_focusNode = FocusNode();_focusNode.addListener(() {diff --git a/frontend/app_flowy/lib/workspace/presentation/plugins/grid/src/widgets/cell/selection_cell/selection_cell.dart b/frontend/app_flowy/lib/workspace/presentation/plugins/grid/src/widgets/cell/selection_cell/selection_cell.dartindex 3402c05060..41ea4b2002 100644--- a/frontend/app_flowy/lib/workspace/presentation/plugins/grid/src/widgets/cell/selection_cell/selection_cell.dart+++ b/frontend/app_flowy/lib/workspace/presentation/plugins/grid/src/widgets/cell/selection_cell/selection_cell.dart@@ -18,11 +18,11 @@ class SelectOptionCellStyle extends GridCellStyle {}class SingleSelectCell extends GridCellWidget {- final GridCellDataContext cellDataContext;+ final GridCellContext cellContext;late final SelectOptionCellStyle? cellStyle;SingleSelectCell({- required this.cellDataContext,+ required this.cellContext,GridCellStyle? style,Key? key,}) : super(key: key) {@@ -42,7 +42,7 @@ class _SingleSelectCellState extends State<SingleSelectCell> {@overridevoid initState() {- _cellBloc = getIt<SelectionCellBloc>(param1: widget.cellDataContext)..add(const SelectionCellEvent.initial());+ _cellBloc = getIt<SelectionCellBloc>(param1: widget.cellContext)..add(const SelectionCellEvent.initial());super.initState();}@@ -89,11 +89,11 @@ class _SingleSelectCellState extends State<SingleSelectCell> {//----------------------------------------------------------------class MultiSelectCell extends GridCellWidget {- final GridCellDataContext cellDataContext;+ final GridCellContext cellContext;late final SelectOptionCellStyle? cellStyle;MultiSelectCell({- required this.cellDataContext,+ required this.cellContext,GridCellStyle? style,Key? key,}) : super(key: key) {@@ -113,7 +113,7 @@ class _MultiSelectCellState extends State<MultiSelectCell> {@overridevoid initState() {- _cellBloc = getIt<SelectionCellBloc>(param1: widget.cellDataContext)..add(const SelectionCellEvent.initial());+ _cellBloc = getIt<SelectionCellBloc>(param1: widget.cellContext)..add(const SelectionCellEvent.initial());super.initState();}diff --git a/frontend/app_flowy/lib/workspace/presentation/plugins/grid/src/widgets/cell/text_cell.dart b/frontend/app_flowy/lib/workspace/presentation/plugins/grid/src/widgets/cell/text_cell.dartindex 7a32583b20..6d77f5f2cf 100644--- a/frontend/app_flowy/lib/workspace/presentation/plugins/grid/src/widgets/cell/text_cell.dart+++ b/frontend/app_flowy/lib/workspace/presentation/plugins/grid/src/widgets/cell/text_cell.dart@@ -14,10 +14,10 @@ class GridTextCellStyle extends GridCellStyle {}class GridTextCell extends GridCellWidget {- final GridCellDataContext cellDataContext;+ final GridCellContext cellContext;late final GridTextCellStyle? cellStyle;GridTextCell({- required this.cellDataContext,+ required this.cellContext,GridCellStyle? style,Key? key,}) : super(key: key) {@@ -41,7 +41,7 @@ class _GridTextCellState extends State<GridTextCell> {@overridevoid initState() {- _cellBloc = getIt<TextCellBloc>(param1: widget.cellDataContext);+ _cellBloc = getIt<TextCellBloc>(param1: widget.cellContext);_cellBloc.add(const TextCellEvent.initial());_controller = TextEditingController(text: _cellBloc.state.content);_focusNode = FocusNode();diff --git a/frontend/app_flowy/lib/workspace/presentation/plugins/grid/src/widgets/row/grid_row.dart b/frontend/app_flowy/lib/workspace/presentation/plugins/grid/src/widgets/row/grid_row.dartindex a543693f82..cc56d3bed0 100755--- a/frontend/app_flowy/lib/workspace/presentation/plugins/grid/src/widgets/row/grid_row.dart+++ b/frontend/app_flowy/lib/workspace/presentation/plugins/grid/src/widgets/row/grid_row.dart@@ -178,14 +178,14 @@ class _RowCells extends StatelessWidget {expander = _CellExpander(onExpand: onExpand);}- final cellDataContext = GridCellDataContext(+ final cellContext = GridCellContext(cellData: cellData,cellCache: cellCache,);return CellContainer(width: cellData.field.width.toDouble(),- child: buildGridCell(cellDataContext),+ child: buildGridCell(cellContext),expander: expander,);},diff --git a/frontend/app_flowy/lib/workspace/presentation/plugins/grid/src/widgets/row/row_detail.dart b/frontend/app_flowy/lib/workspace/presentation/plugins/grid/src/widgets/row/row_detail.dartindex 81d64d87da..e61516ba4f 100644--- a/frontend/app_flowy/lib/workspace/presentation/plugins/grid/src/widgets/row/row_detail.dart+++ b/frontend/app_flowy/lib/workspace/presentation/plugins/grid/src/widgets/row/row_detail.dart@@ -94,11 +94,11 @@ class _PropertyList extends StatelessWidget {controller: _scrollController,itemCount: state.cellDatas.length,itemBuilder: (BuildContext context, int index) {- final cellDataContext = GridCellDataContext(+ final cellContext = GridCellContext(cellData: state.cellDatas[index],cellCache: cellCache,);- return _RowDetailCell(cellDataContext: cellDataContext);+ return _RowDetailCell(cellContext: cellContext);},separatorBuilder: (BuildContext context, int index) {return const VSpace(2);@@ -111,16 +111,16 @@ class _PropertyList extends StatelessWidget {}class _RowDetailCell extends StatelessWidget {- final GridCellDataContext cellDataContext;- const _RowDetailCell({required this.cellDataContext, Key? key}) : super(key: key);+ final GridCellContext cellContext;+ const _RowDetailCell({required this.cellContext, Key? key}) : super(key: key);@overrideWidget build(BuildContext context) {final theme = context.watch<AppTheme>();final cell = buildGridCell(- cellDataContext,- style: _buildCellStyle(theme, cellDataContext.fieldType),+ cellContext,+ style: _buildCellStyle(theme, cellContext.fieldType),);return SizedBox(height: 36,@@ -130,7 +130,7 @@ class _RowDetailCell extends StatelessWidget {children: [SizedBox(width: 150,- child: FieldCellButton(field: cellDataContext.field, onTap: () => _showFieldEditor(context)),+ child: FieldCellButton(field: cellContext.field, onTap: () => _showFieldEditor(context)),),const HSpace(10),Expanded(@@ -146,10 +146,10 @@ class _RowDetailCell extends StatelessWidget {void _showFieldEditor(BuildContext context) {FieldEditor(- gridId: cellDataContext.gridId,+ gridId: cellContext.gridId,fieldContextLoader: FieldContextLoaderAdaptor(- gridId: cellDataContext.gridId,- field: cellDataContext.field,+ gridId: cellContext.gridId,+ field: cellContext.field,),).show(context);}