chore: remove field listener in cell

This commit is contained in:
appflowy 2022-04-22 23:36:39 +08:00
parent b0f5af679c
commit 5af378c810
15 changed files with 180 additions and 110 deletions

View File

@ -168,34 +168,34 @@ void _resolveGridDeps(GetIt getIt) {
), ),
); );
getIt.registerFactoryParam<TextCellBloc, GridCellDataContext, void>( getIt.registerFactoryParam<TextCellBloc, GridCellContext, void>(
(context, _) => TextCellBloc( (context, _) => TextCellBloc(
cellDataContext: context, cellContext: context,
), ),
); );
getIt.registerFactoryParam<SelectionCellBloc, GridCellDataContext, void>( getIt.registerFactoryParam<SelectionCellBloc, GridCellContext, void>(
(context, _) => SelectionCellBloc( (context, _) => SelectionCellBloc(
cellDataContext: context, cellContext: context,
), ),
); );
getIt.registerFactoryParam<NumberCellBloc, GridCellDataContext, void>( getIt.registerFactoryParam<NumberCellBloc, GridCellContext, void>(
(context, _) => NumberCellBloc( (context, _) => NumberCellBloc(
cellDataContext: context, cellContext: context,
), ),
); );
getIt.registerFactoryParam<DateCellBloc, GridCellDataContext, void>( getIt.registerFactoryParam<DateCellBloc, GridCellContext, void>(
(context, _) => DateCellBloc( (context, _) => DateCellBloc(
cellDataContext: context, cellContext: context,
), ),
); );
getIt.registerFactoryParam<CheckboxCellBloc, GridCellDataContext, void>( getIt.registerFactoryParam<CheckboxCellBloc, GridCellContext, void>(
(cellData, _) => CheckboxCellBloc( (cellData, _) => CheckboxCellBloc(
service: CellService(), service: CellService(),
cellDataContext: cellData, cellContext: cellData,
), ),
); );

View File

@ -11,10 +11,10 @@ import 'package:freezed_annotation/freezed_annotation.dart';
part 'cell_service.freezed.dart'; part 'cell_service.freezed.dart';
class GridCellDataContext { class GridCellContext {
GridCell cellData; GridCell cellData;
GridCellCache cellCache; GridCellCache cellCache;
GridCellDataContext({ GridCellContext({
required this.cellData, required this.cellData,
required this.cellCache, required this.cellCache,
}); });
@ -30,15 +30,47 @@ class GridCellDataContext {
FieldType get fieldType => cellData.field.fieldType; FieldType get fieldType => cellData.field.fieldType;
Field get field => cellData.field; 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: rowId // key: rowId
typedef CellDataMap = LinkedHashMap<String, GridCell>; typedef CellDataMap = LinkedHashMap<String, GridCell>;
abstract class GridCellCacheData { class GridCellCacheData {
String get fieldId; GridCellCacheKey key;
String get cacheKey; dynamic value;
dynamic get cacheData; 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 { abstract class GridCellFieldDelegate {
@ -49,33 +81,56 @@ class GridCellCache {
final String gridId; final String gridId;
final GridCellFieldDelegate fieldDelegate; final GridCellFieldDelegate fieldDelegate;
/// fieldId: {rowId: callback}
final Map<String, Map<String, VoidCallback>> _cellListenerByFieldId = {};
/// fieldId: {cacheKey: cacheData} /// fieldId: {cacheKey: cacheData}
final Map<String, Map<String, dynamic>> _cells = {}; final Map<String, Map<String, dynamic>> _cellCacheByFieldId = {};
GridCellCache({ GridCellCache({
required this.gridId, required this.gridId,
required this.fieldDelegate, required this.fieldDelegate,
}) { }) {
fieldDelegate.onFieldChanged((fieldId) { 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) { void addListener(String fieldId, String rowId, VoidCallback callback) {
var map = _cells[cacheData.fieldId]; var map = _cellListenerByFieldId[fieldId];
if (map == null) { if (map == null) {
_cells[cacheData.fieldId] = {}; _cellListenerByFieldId[fieldId] = {};
map = _cells[cacheData.fieldId]; map = _cellListenerByFieldId[fieldId];
} }
map![cacheData.cacheKey] = cacheData.cacheData; map![rowId] = callback;
} }
T? get<T>(String fieldId, String cacheKey) { void removeListener(String fieldId, String rowId) {
final map = _cells[fieldId]; _cellListenerByFieldId[fieldId]?.remove(rowId);
}
void insert<T extends GridCellCacheData>(T item) {
var map = _cellCacheByFieldId[item.key.fieldId];
if (map == null) {
_cellCacheByFieldId[item.key.fieldId] = {};
map = _cellCacheByFieldId[item.key.fieldId];
}
map![item.key.cellId] = item.value;
}
T? get<T>(GridCellCacheKey key) {
final map = _cellCacheByFieldId[key.fieldId];
if (map == null) { if (map == null) {
return null; return null;
} else { } else {
final object = map[cacheKey]; final object = map[key.cellId];
if (object is T) { if (object is T) {
return object; return object;
} else { } else {

View File

@ -14,10 +14,10 @@ class CheckboxCellBloc extends Bloc<CheckboxCellEvent, CheckboxCellState> {
CheckboxCellBloc({ CheckboxCellBloc({
required CellService service, required CellService service,
required GridCellDataContext cellDataContext, required GridCellContext cellContext,
}) : _service = service, }) : _service = service,
_cellListener = CellListener(rowId: cellDataContext.rowId, fieldId: cellDataContext.fieldId), _cellListener = CellListener(rowId: cellContext.rowId, fieldId: cellContext.fieldId),
super(CheckboxCellState.initial(cellDataContext.cellData)) { super(CheckboxCellState.initial(cellContext.cellData)) {
on<CheckboxCellEvent>( on<CheckboxCellEvent>(
(event, emit) async { (event, emit) async {
await event.map( await event.map(

View File

@ -14,11 +14,11 @@ class DateCellBloc extends Bloc<DateCellEvent, DateCellState> {
final CellListener _cellListener; final CellListener _cellListener;
final SingleFieldListener _fieldListener; final SingleFieldListener _fieldListener;
DateCellBloc({required GridCellDataContext cellDataContext}) DateCellBloc({required GridCellContext cellContext})
: _service = CellService(), : _service = CellService(),
_cellListener = CellListener(rowId: cellDataContext.rowId, fieldId: cellDataContext.fieldId), _cellListener = CellListener(rowId: cellContext.rowId, fieldId: cellContext.fieldId),
_fieldListener = SingleFieldListener(fieldId: cellDataContext.fieldId), _fieldListener = SingleFieldListener(fieldId: cellContext.fieldId),
super(DateCellState.initial(cellDataContext.cellData)) { super(DateCellState.initial(cellContext.cellData)) {
on<DateCellEvent>( on<DateCellEvent>(
(event, emit) async { (event, emit) async {
event.map( event.map(

View File

@ -15,11 +15,11 @@ class NumberCellBloc extends Bloc<NumberCellEvent, NumberCellState> {
final SingleFieldListener _fieldListener; final SingleFieldListener _fieldListener;
NumberCellBloc({ NumberCellBloc({
required GridCellDataContext cellDataContext, required GridCellContext cellContext,
}) : _service = CellService(), }) : _service = CellService(),
_cellListener = CellListener(rowId: cellDataContext.rowId, fieldId: cellDataContext.fieldId), _cellListener = CellListener(rowId: cellContext.rowId, fieldId: cellContext.fieldId),
_fieldListener = SingleFieldListener(fieldId: cellDataContext.fieldId), _fieldListener = SingleFieldListener(fieldId: cellContext.fieldId),
super(NumberCellState.initial(cellDataContext.cellData)) { super(NumberCellState.initial(cellContext.cellData)) {
on<NumberCellEvent>( on<NumberCellEvent>(
(event, emit) async { (event, emit) async {
await event.map( await event.map(

View File

@ -1,12 +1,14 @@
import 'package:app_flowy/workspace/application/grid/cell/cell_listener.dart'; import 'dart:async';
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 'package:flowy_sdk/log.dart'; import 'package:flowy_sdk/log.dart';
import 'package:flowy_sdk/protobuf/flowy-grid/selection_type_option.pb.dart'; import 'package:flowy_sdk/protobuf/flowy-grid/selection_type_option.pb.dart';
import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:freezed_annotation/freezed_annotation.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'; part 'selection_cell_bloc.freezed.dart';
@ -14,19 +16,21 @@ class SelectionCellBloc extends Bloc<SelectionCellEvent, SelectionCellState> {
final SelectOptionService _service; final SelectOptionService _service;
final CellListener _cellListener; final CellListener _cellListener;
final SingleFieldListener _fieldListener; final SingleFieldListener _fieldListener;
final GridCellContext _cellContext;
SelectionCellBloc({ SelectionCellBloc({
required GridCellDataContext cellDataContext, required GridCellContext cellContext,
}) : _service = SelectOptionService(), }) : _service = SelectOptionService(),
_cellListener = CellListener(rowId: cellDataContext.rowId, fieldId: cellDataContext.fieldId), _cellContext = cellContext,
_fieldListener = SingleFieldListener(fieldId: cellDataContext.fieldId), _cellListener = CellListener(rowId: cellContext.rowId, fieldId: cellContext.fieldId),
super(SelectionCellState.initial(cellDataContext.cellData)) { _fieldListener = SingleFieldListener(fieldId: cellContext.fieldId),
super(SelectionCellState.initial(cellContext.cellData)) {
on<SelectionCellEvent>( on<SelectionCellEvent>(
(event, emit) async { (event, emit) async {
await event.map( await event.map(
initial: (_InitialCell value) async { initial: (_InitialCell value) async {
_loadOptions();
_startListening(); _startListening();
_loadOptions();
}, },
didReceiveOptions: (_DidReceiveOptions value) { didReceiveOptions: (_DidReceiveOptions value) {
emit(state.copyWith(options: value.options, selectedOptions: value.selectedOptions)); emit(state.copyWith(options: value.options, selectedOptions: value.selectedOptions));
@ -40,10 +44,13 @@ class SelectionCellBloc extends Bloc<SelectionCellEvent, SelectionCellState> {
Future<void> close() async { Future<void> close() async {
await _cellListener.stop(); await _cellListener.stop();
await _fieldListener.stop(); await _fieldListener.stop();
_cellContext.removeListener();
return super.close(); return super.close();
} }
void _loadOptions() async { void _loadOptions() async {
var selectOptionContext = _cellContext.getCacheData<SelectOptionContext>();
if (selectOptionContext == null) {
final result = await _service.getOpitonContext( final result = await _service.getOpitonContext(
gridId: state.cellData.gridId, gridId: state.cellData.gridId,
fieldId: state.cellData.field.id, fieldId: state.cellData.field.id,
@ -54,14 +61,20 @@ class SelectionCellBloc extends Bloc<SelectionCellEvent, SelectionCellState> {
} }
result.fold( result.fold(
(selectOptionContext) => add(SelectionCellEvent.didReceiveOptions( (newSelectOptionContext) {
selectOptionContext.options, _cellContext.setCacheData(newSelectOptionContext);
selectOptionContext.selectOptions, selectOptionContext = newSelectOptionContext;
)), },
(err) => Log.error(err), (err) => Log.error(err),
); );
} }
add(SelectionCellEvent.didReceiveOptions(
selectOptionContext!.options,
selectOptionContext!.selectOptions,
));
}
void _startListening() { void _startListening() {
_cellListener.updateCellNotifier?.addPublishListener((result) { _cellListener.updateCellNotifier?.addPublishListener((result) {
result.fold( result.fold(
@ -71,13 +84,15 @@ class SelectionCellBloc extends Bloc<SelectionCellEvent, SelectionCellState> {
}); });
_cellListener.start(); _cellListener.start();
_fieldListener.updateFieldNotifier?.addPublishListener((result) { _cellContext.onFieldChanged(() => _loadOptions());
result.fold(
(field) => _loadOptions(), // _fieldListener.updateFieldNotifier?.addPublishListener((result) {
(err) => Log.error(err), // result.fold(
); // (field) => _loadOptions(),
}); // (err) => Log.error(err),
_fieldListener.start(); // );
// });
// _fieldListener.start();
} }
} }

View File

@ -13,10 +13,10 @@ class TextCellBloc extends Bloc<TextCellEvent, TextCellState> {
final CellListener _cellListener; final CellListener _cellListener;
TextCellBloc({ TextCellBloc({
required GridCellDataContext cellDataContext, required GridCellContext cellContext,
}) : _service = CellService(), }) : _service = CellService(),
_cellListener = CellListener(rowId: cellDataContext.rowId, fieldId: cellDataContext.fieldId), _cellListener = CellListener(rowId: cellContext.rowId, fieldId: cellContext.fieldId),
super(TextCellState.initial(cellDataContext.cellData)) { super(TextCellState.initial(cellContext.cellData)) {
on<TextCellEvent>( on<TextCellEvent>(
(event, emit) async { (event, emit) async {
await event.map( await event.map(

View File

@ -8,22 +8,22 @@ import 'number_cell.dart';
import 'selection_cell/selection_cell.dart'; import 'selection_cell/selection_cell.dart';
import 'text_cell.dart'; import 'text_cell.dart';
GridCellWidget buildGridCell(GridCellDataContext cellDataContext, {GridCellStyle? style}) { GridCellWidget buildGridCell(GridCellContext cellContext, {GridCellStyle? style}) {
final key = ValueKey(cellDataContext.cellId); final key = ValueKey(cellContext.cellId);
final fieldType = cellDataContext.cellData.field.fieldType; final fieldType = cellContext.cellData.field.fieldType;
switch (fieldType) { switch (fieldType) {
case FieldType.Checkbox: case FieldType.Checkbox:
return CheckboxCell(cellDataContext: cellDataContext, key: key); return CheckboxCell(cellContext: cellContext, key: key);
case FieldType.DateTime: case FieldType.DateTime:
return DateCell(cellDataContext: cellDataContext, key: key); return DateCell(cellContext: cellContext, key: key);
case FieldType.MultiSelect: case FieldType.MultiSelect:
return MultiSelectCell(cellDataContext: cellDataContext, style: style, key: key); return MultiSelectCell(cellContext: cellContext, style: style, key: key);
case FieldType.Number: case FieldType.Number:
return NumberCell(cellDataContext: cellDataContext, key: key); return NumberCell(cellContext: cellContext, key: key);
case FieldType.RichText: case FieldType.RichText:
return GridTextCell(cellDataContext: cellDataContext, style: style, key: key); return GridTextCell(cellContext: cellContext, style: style, key: key);
case FieldType.SingleSelect: case FieldType.SingleSelect:
return SingleSelectCell(cellDataContext: cellDataContext, style: style, key: key); return SingleSelectCell(cellContext: cellContext, style: style, key: key);
default: default:
throw UnimplementedError; throw UnimplementedError;
} }

View File

@ -7,10 +7,10 @@ import 'package:flutter_bloc/flutter_bloc.dart';
import 'cell_builder.dart'; import 'cell_builder.dart';
class CheckboxCell extends GridCellWidget { class CheckboxCell extends GridCellWidget {
final GridCellDataContext cellDataContext; final GridCellContext cellContext;
CheckboxCell({ CheckboxCell({
required this.cellDataContext, required this.cellContext,
Key? key, Key? key,
}) : super(key: key); }) : super(key: key);
@ -23,7 +23,7 @@ class _CheckboxCellState extends State<CheckboxCell> {
@override @override
void initState() { void initState() {
_cellBloc = getIt<CheckboxCellBloc>(param1: widget.cellDataContext)..add(const CheckboxCellEvent.initial()); _cellBloc = getIt<CheckboxCellBloc>(param1: widget.cellContext)..add(const CheckboxCellEvent.initial());
super.initState(); super.initState();
} }

View File

@ -14,10 +14,10 @@ abstract class GridCellDelegate {
} }
class DateCell extends GridCellWidget { class DateCell extends GridCellWidget {
final GridCellDataContext cellDataContext; final GridCellContext cellContext;
DateCell({ DateCell({
required this.cellDataContext, required this.cellContext,
Key? key, Key? key,
}) : super(key: key); }) : super(key: key);
@ -30,7 +30,7 @@ class _DateCellState extends State<DateCell> {
@override @override
void initState() { void initState() {
_cellBloc = getIt<DateCellBloc>(param1: widget.cellDataContext)..add(const DateCellEvent.initial()); _cellBloc = getIt<DateCellBloc>(param1: widget.cellContext)..add(const DateCellEvent.initial());
super.initState(); super.initState();
} }

View File

@ -8,10 +8,10 @@ import 'package:flutter_bloc/flutter_bloc.dart';
import 'cell_builder.dart'; import 'cell_builder.dart';
class NumberCell extends GridCellWidget { class NumberCell extends GridCellWidget {
final GridCellDataContext cellDataContext; final GridCellContext cellContext;
NumberCell({ NumberCell({
required this.cellDataContext, required this.cellContext,
Key? key, Key? key,
}) : super(key: key); }) : super(key: key);
@ -27,7 +27,7 @@ class _NumberCellState extends State<NumberCell> {
@override @override
void initState() { void 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); _controller = TextEditingController(text: _cellBloc.state.content);
_focusNode = FocusNode(); _focusNode = FocusNode();
_focusNode.addListener(() { _focusNode.addListener(() {

View File

@ -18,11 +18,11 @@ class SelectOptionCellStyle extends GridCellStyle {
} }
class SingleSelectCell extends GridCellWidget { class SingleSelectCell extends GridCellWidget {
final GridCellDataContext cellDataContext; final GridCellContext cellContext;
late final SelectOptionCellStyle? cellStyle; late final SelectOptionCellStyle? cellStyle;
SingleSelectCell({ SingleSelectCell({
required this.cellDataContext, required this.cellContext,
GridCellStyle? style, GridCellStyle? style,
Key? key, Key? key,
}) : super(key: key) { }) : super(key: key) {
@ -42,7 +42,7 @@ class _SingleSelectCellState extends State<SingleSelectCell> {
@override @override
void initState() { void initState() {
_cellBloc = getIt<SelectionCellBloc>(param1: widget.cellDataContext)..add(const SelectionCellEvent.initial()); _cellBloc = getIt<SelectionCellBloc>(param1: widget.cellContext)..add(const SelectionCellEvent.initial());
super.initState(); super.initState();
} }
@ -89,11 +89,11 @@ class _SingleSelectCellState extends State<SingleSelectCell> {
//---------------------------------------------------------------- //----------------------------------------------------------------
class MultiSelectCell extends GridCellWidget { class MultiSelectCell extends GridCellWidget {
final GridCellDataContext cellDataContext; final GridCellContext cellContext;
late final SelectOptionCellStyle? cellStyle; late final SelectOptionCellStyle? cellStyle;
MultiSelectCell({ MultiSelectCell({
required this.cellDataContext, required this.cellContext,
GridCellStyle? style, GridCellStyle? style,
Key? key, Key? key,
}) : super(key: key) { }) : super(key: key) {
@ -113,7 +113,7 @@ class _MultiSelectCellState extends State<MultiSelectCell> {
@override @override
void initState() { void initState() {
_cellBloc = getIt<SelectionCellBloc>(param1: widget.cellDataContext)..add(const SelectionCellEvent.initial()); _cellBloc = getIt<SelectionCellBloc>(param1: widget.cellContext)..add(const SelectionCellEvent.initial());
super.initState(); super.initState();
} }

View File

@ -14,10 +14,10 @@ class GridTextCellStyle extends GridCellStyle {
} }
class GridTextCell extends GridCellWidget { class GridTextCell extends GridCellWidget {
final GridCellDataContext cellDataContext; final GridCellContext cellContext;
late final GridTextCellStyle? cellStyle; late final GridTextCellStyle? cellStyle;
GridTextCell({ GridTextCell({
required this.cellDataContext, required this.cellContext,
GridCellStyle? style, GridCellStyle? style,
Key? key, Key? key,
}) : super(key: key) { }) : super(key: key) {
@ -41,7 +41,7 @@ class _GridTextCellState extends State<GridTextCell> {
@override @override
void initState() { void initState() {
_cellBloc = getIt<TextCellBloc>(param1: widget.cellDataContext); _cellBloc = getIt<TextCellBloc>(param1: widget.cellContext);
_cellBloc.add(const TextCellEvent.initial()); _cellBloc.add(const TextCellEvent.initial());
_controller = TextEditingController(text: _cellBloc.state.content); _controller = TextEditingController(text: _cellBloc.state.content);
_focusNode = FocusNode(); _focusNode = FocusNode();

View File

@ -178,14 +178,14 @@ class _RowCells extends StatelessWidget {
expander = _CellExpander(onExpand: onExpand); expander = _CellExpander(onExpand: onExpand);
} }
final cellDataContext = GridCellDataContext( final cellContext = GridCellContext(
cellData: cellData, cellData: cellData,
cellCache: cellCache, cellCache: cellCache,
); );
return CellContainer( return CellContainer(
width: cellData.field.width.toDouble(), width: cellData.field.width.toDouble(),
child: buildGridCell(cellDataContext), child: buildGridCell(cellContext),
expander: expander, expander: expander,
); );
}, },

View File

@ -94,11 +94,11 @@ class _PropertyList extends StatelessWidget {
controller: _scrollController, controller: _scrollController,
itemCount: state.cellDatas.length, itemCount: state.cellDatas.length,
itemBuilder: (BuildContext context, int index) { itemBuilder: (BuildContext context, int index) {
final cellDataContext = GridCellDataContext( final cellContext = GridCellContext(
cellData: state.cellDatas[index], cellData: state.cellDatas[index],
cellCache: cellCache, cellCache: cellCache,
); );
return _RowDetailCell(cellDataContext: cellDataContext); return _RowDetailCell(cellContext: cellContext);
}, },
separatorBuilder: (BuildContext context, int index) { separatorBuilder: (BuildContext context, int index) {
return const VSpace(2); return const VSpace(2);
@ -111,16 +111,16 @@ class _PropertyList extends StatelessWidget {
} }
class _RowDetailCell extends StatelessWidget { class _RowDetailCell extends StatelessWidget {
final GridCellDataContext cellDataContext; final GridCellContext cellContext;
const _RowDetailCell({required this.cellDataContext, Key? key}) : super(key: key); const _RowDetailCell({required this.cellContext, Key? key}) : super(key: key);
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final theme = context.watch<AppTheme>(); final theme = context.watch<AppTheme>();
final cell = buildGridCell( final cell = buildGridCell(
cellDataContext, cellContext,
style: _buildCellStyle(theme, cellDataContext.fieldType), style: _buildCellStyle(theme, cellContext.fieldType),
); );
return SizedBox( return SizedBox(
height: 36, height: 36,
@ -130,7 +130,7 @@ class _RowDetailCell extends StatelessWidget {
children: [ children: [
SizedBox( SizedBox(
width: 150, width: 150,
child: FieldCellButton(field: cellDataContext.field, onTap: () => _showFieldEditor(context)), child: FieldCellButton(field: cellContext.field, onTap: () => _showFieldEditor(context)),
), ),
const HSpace(10), const HSpace(10),
Expanded( Expanded(
@ -146,10 +146,10 @@ class _RowDetailCell extends StatelessWidget {
void _showFieldEditor(BuildContext context) { void _showFieldEditor(BuildContext context) {
FieldEditor( FieldEditor(
gridId: cellDataContext.gridId, gridId: cellContext.gridId,
fieldContextLoader: FieldContextLoaderAdaptor( fieldContextLoader: FieldContextLoaderAdaptor(
gridId: cellDataContext.gridId, gridId: cellContext.gridId,
field: cellDataContext.field, field: cellContext.field,
), ),
).show(context); ).show(context);
} }