Skip to content

Commit 860c5d1

Browse files
authored
chore: rename class according to gitbook documentation (#1682)
1 parent fe4e28b commit 860c5d1

23 files changed

+82
-74
lines changed

frontend/app_flowy/lib/plugins/board/application/card/board_checkbox_cell_bloc.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ class BoardCheckboxCellState with _$BoardCheckboxCellState {
6464
required bool isSelected,
6565
}) = _CheckboxCellState;
6666

67-
factory BoardCheckboxCellState.initial(GridCellController context) {
67+
factory BoardCheckboxCellState.initial(GridTextCellController context) {
6868
return BoardCheckboxCellState(
6969
isSelected: _isSelected(context.getCellData()));
7070
}

frontend/app_flowy/lib/plugins/board/application/card/board_number_cell_bloc.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ class BoardNumberCellState with _$BoardNumberCellState {
6060
required String content,
6161
}) = _BoardNumberCellState;
6262

63-
factory BoardNumberCellState.initial(GridCellController context) =>
63+
factory BoardNumberCellState.initial(GridTextCellController context) =>
6464
BoardNumberCellState(
6565
content: context.getCellData() ?? "",
6666
);

frontend/app_flowy/lib/plugins/board/application/card/board_text_cell_bloc.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import 'dart:async';
66
part 'board_text_cell_bloc.freezed.dart';
77

88
class BoardTextCellBloc extends Bloc<BoardTextCellEvent, BoardTextCellState> {
9-
final GridCellController cellController;
9+
final GridTextCellController cellController;
1010
void Function()? _onCellChangedFn;
1111
BoardTextCellBloc({
1212
required this.cellController,
@@ -71,7 +71,7 @@ class BoardTextCellState with _$BoardTextCellState {
7171
required bool enableEdit,
7272
}) = _BoardTextCellState;
7373

74-
factory BoardTextCellState.initial(GridCellController context) =>
74+
factory BoardTextCellState.initial(GridTextCellController context) =>
7575
BoardTextCellState(
7676
content: context.getCellData() ?? "",
7777
enableEdit: false,

frontend/app_flowy/lib/plugins/board/presentation/board_page.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,7 @@ class _BoardContentState extends State<BoardContent> {
288288
rowPB: rowPB,
289289
);
290290

291-
final dataController = GridRowDataController(
291+
final dataController = RowDataController(
292292
rowInfo: rowInfo,
293293
fieldController: fieldController,
294294
rowCache: rowCache,

frontend/app_flowy/lib/plugins/board/presentation/card/board_text_cell.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ class _BoardTextCellState extends State<BoardTextCell> {
3535
@override
3636
void initState() {
3737
final cellController =
38-
widget.cellControllerBuilder.build() as GridCellController;
38+
widget.cellControllerBuilder.build() as GridTextCellController;
3939
_cellBloc = BoardTextCellBloc(cellController: cellController)
4040
..add(const BoardTextCellEvent.initial());
4141
_controller = TextEditingController(text: _cellBloc.state.content);

frontend/app_flowy/lib/plugins/grid/application/cell/cell_service/cell_controller.dart

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
part of 'cell_service.dart';
22

3-
typedef GridCellController = IGridCellController<String, String>;
4-
typedef GridCheckboxCellController = IGridCellController<String, String>;
5-
typedef GridNumberCellController = IGridCellController<String, String>;
3+
typedef GridTextCellController = GridCellController<String, String>;
4+
typedef GridCheckboxCellController = GridCellController<String, String>;
5+
typedef GridNumberCellController = GridCellController<String, String>;
66
typedef GridSelectOptionCellController
7-
= IGridCellController<SelectOptionCellDataPB, String>;
7+
= GridCellController<SelectOptionCellDataPB, String>;
88
typedef GridChecklistCellController
9-
= IGridCellController<SelectOptionCellDataPB, String>;
9+
= GridCellController<SelectOptionCellDataPB, String>;
1010
typedef GridDateCellController
11-
= IGridCellController<DateCellDataPB, CalendarData>;
12-
typedef GridURLCellController = IGridCellController<URLCellDataPB, String>;
11+
= GridCellController<DateCellDataPB, CalendarData>;
12+
typedef GridURLCellController = GridCellController<URLCellDataPB, String>;
1313

1414
abstract class GridCellControllerBuilderDelegate {
1515
GridCellFieldNotifier buildFieldNotifier();
@@ -27,20 +27,20 @@ class GridCellControllerBuilder {
2727
}) : _cellCache = cellCache,
2828
_cellId = cellId;
2929

30-
IGridCellController build() {
30+
GridCellController build() {
3131
final cellFieldNotifier = delegate.buildFieldNotifier();
3232
switch (_cellId.fieldType) {
3333
case FieldType.Checkbox:
3434
final cellDataLoader = GridCellDataLoader(
3535
cellId: _cellId,
3636
parser: StringCellDataParser(),
3737
);
38-
return GridCellController(
38+
return GridTextCellController(
3939
cellId: _cellId,
4040
cellCache: _cellCache,
4141
cellDataLoader: cellDataLoader,
4242
fieldNotifier: cellFieldNotifier,
43-
cellDataPersistence: CellDataPersistence(cellId: _cellId),
43+
cellDataPersistence: TextCellDataPersistence(cellId: _cellId),
4444
);
4545
case FieldType.DateTime:
4646
final cellDataLoader = GridCellDataLoader(
@@ -67,19 +67,19 @@ class GridCellControllerBuilder {
6767
cellCache: _cellCache,
6868
cellDataLoader: cellDataLoader,
6969
fieldNotifier: cellFieldNotifier,
70-
cellDataPersistence: CellDataPersistence(cellId: _cellId),
70+
cellDataPersistence: TextCellDataPersistence(cellId: _cellId),
7171
);
7272
case FieldType.RichText:
7373
final cellDataLoader = GridCellDataLoader(
7474
cellId: _cellId,
7575
parser: StringCellDataParser(),
7676
);
77-
return GridCellController(
77+
return GridTextCellController(
7878
cellId: _cellId,
7979
cellCache: _cellCache,
8080
cellDataLoader: cellDataLoader,
8181
fieldNotifier: cellFieldNotifier,
82-
cellDataPersistence: CellDataPersistence(cellId: _cellId),
82+
cellDataPersistence: TextCellDataPersistence(cellId: _cellId),
8383
);
8484
case FieldType.MultiSelect:
8585
case FieldType.SingleSelect:
@@ -95,7 +95,7 @@ class GridCellControllerBuilder {
9595
cellCache: _cellCache,
9696
cellDataLoader: cellDataLoader,
9797
fieldNotifier: cellFieldNotifier,
98-
cellDataPersistence: CellDataPersistence(cellId: _cellId),
98+
cellDataPersistence: TextCellDataPersistence(cellId: _cellId),
9999
);
100100

101101
case FieldType.URL:
@@ -108,7 +108,7 @@ class GridCellControllerBuilder {
108108
cellCache: _cellCache,
109109
cellDataLoader: cellDataLoader,
110110
fieldNotifier: cellFieldNotifier,
111-
cellDataPersistence: CellDataPersistence(cellId: _cellId),
111+
cellDataPersistence: TextCellDataPersistence(cellId: _cellId),
112112
);
113113
}
114114
throw UnimplementedError;
@@ -123,14 +123,14 @@ class GridCellControllerBuilder {
123123
/// Generic D represents the type of data that will be saved to the disk
124124
///
125125
// ignore: must_be_immutable
126-
class IGridCellController<T, D> extends Equatable {
126+
class GridCellController<T, D> extends Equatable {
127127
final GridCellIdentifier cellId;
128128
final GridCellCache _cellsCache;
129129
final GridCellCacheKey _cacheKey;
130130
final FieldService _fieldService;
131131
final GridCellFieldNotifier _fieldNotifier;
132132
final GridCellDataLoader<T> _cellDataLoader;
133-
final IGridCellDataPersistence<D> _cellDataPersistence;
133+
final GridCellDataPersistence<D> _cellDataPersistence;
134134

135135
CellListener? _cellListener;
136136
CellDataNotifier<T?>? _cellDataNotifier;
@@ -141,12 +141,12 @@ class IGridCellController<T, D> extends Equatable {
141141
Timer? _saveDataOperation;
142142
bool _isDispose = false;
143143

144-
IGridCellController({
144+
GridCellController({
145145
required this.cellId,
146146
required GridCellCache cellCache,
147147
required GridCellFieldNotifier fieldNotifier,
148148
required GridCellDataLoader<T> cellDataLoader,
149-
required IGridCellDataPersistence<D> cellDataPersistence,
149+
required GridCellDataPersistence<D> cellDataPersistence,
150150
}) : _cellsCache = cellCache,
151151
_cellDataLoader = cellDataLoader,
152152
_cellDataPersistence = cellDataPersistence,

frontend/app_flowy/lib/plugins/grid/application/cell/cell_service/cell_data_loader.dart

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@ abstract class IGridCellDataConfig {
55
bool get reloadOnFieldChanged;
66
}
77

8-
abstract class IGridCellDataParser<T> {
8+
abstract class GridCellDataParser<T> {
99
T? parserData(List<int> data);
1010
}
1111

1212
class GridCellDataLoader<T> {
1313
final CellService service = CellService();
1414
final GridCellIdentifier cellId;
15-
final IGridCellDataParser<T> parser;
15+
final GridCellDataParser<T> parser;
1616
final bool reloadOnFieldChanged;
1717

1818
GridCellDataLoader({
@@ -43,15 +43,15 @@ class GridCellDataLoader<T> {
4343
}
4444
}
4545

46-
class StringCellDataParser implements IGridCellDataParser<String> {
46+
class StringCellDataParser implements GridCellDataParser<String> {
4747
@override
4848
String? parserData(List<int> data) {
4949
final s = utf8.decode(data);
5050
return s;
5151
}
5252
}
5353

54-
class DateCellDataParser implements IGridCellDataParser<DateCellDataPB> {
54+
class DateCellDataParser implements GridCellDataParser<DateCellDataPB> {
5555
@override
5656
DateCellDataPB? parserData(List<int> data) {
5757
if (data.isEmpty) {
@@ -62,7 +62,7 @@ class DateCellDataParser implements IGridCellDataParser<DateCellDataPB> {
6262
}
6363

6464
class SelectOptionCellDataParser
65-
implements IGridCellDataParser<SelectOptionCellDataPB> {
65+
implements GridCellDataParser<SelectOptionCellDataPB> {
6666
@override
6767
SelectOptionCellDataPB? parserData(List<int> data) {
6868
if (data.isEmpty) {
@@ -72,7 +72,7 @@ class SelectOptionCellDataParser
7272
}
7373
}
7474

75-
class URLCellDataParser implements IGridCellDataParser<URLCellDataPB> {
75+
class URLCellDataParser implements GridCellDataParser<URLCellDataPB> {
7676
@override
7777
URLCellDataPB? parserData(List<int> data) {
7878
if (data.isEmpty) {

frontend/app_flowy/lib/plugins/grid/application/cell/cell_service/cell_data_persistence.dart

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@ part of 'cell_service.dart';
22

33
/// Save the cell data to disk
44
/// You can extend this class to do custom operations. For example, the DateCellDataPersistence.
5-
abstract class IGridCellDataPersistence<D> {
5+
abstract class GridCellDataPersistence<D> {
66
Future<Option<FlowyError>> save(D data);
77
}
88

9-
class CellDataPersistence implements IGridCellDataPersistence<String> {
9+
class TextCellDataPersistence implements GridCellDataPersistence<String> {
1010
final GridCellIdentifier cellId;
1111

12-
CellDataPersistence({
12+
TextCellDataPersistence({
1313
required this.cellId,
1414
});
1515
final CellService _cellService = CellService();
@@ -33,8 +33,7 @@ class CalendarData with _$CalendarData {
3333
_CalendarData;
3434
}
3535

36-
class DateCellDataPersistence
37-
implements IGridCellDataPersistence<CalendarData> {
36+
class DateCellDataPersistence implements GridCellDataPersistence<CalendarData> {
3837
final GridCellIdentifier cellId;
3938
DateCellDataPersistence({
4039
required this.cellId,

frontend/app_flowy/lib/plugins/grid/application/cell/checkbox_cell_bloc.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ class CheckboxCellState with _$CheckboxCellState {
6565
required bool isSelected,
6666
}) = _CheckboxCellState;
6767

68-
factory CheckboxCellState.initial(GridCellController context) {
68+
factory CheckboxCellState.initial(GridTextCellController context) {
6969
return CheckboxCellState(isSelected: _isSelected(context.getCellData()));
7070
}
7171
}

frontend/app_flowy/lib/plugins/grid/application/cell/number_cell_bloc.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ class NumberCellState with _$NumberCellState {
8282
required String cellContent,
8383
}) = _NumberCellState;
8484

85-
factory NumberCellState.initial(GridCellController context) {
85+
factory NumberCellState.initial(GridTextCellController context) {
8686
return NumberCellState(
8787
cellContent: context.getCellData() ?? "",
8888
);

0 commit comments

Comments
 (0)