Skip to content

Commit 5275bb6

Browse files
committed
feat: enable select checkbox directly
1 parent f655581 commit 5275bb6

File tree

3 files changed

+8
-5
lines changed

3 files changed

+8
-5
lines changed

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@ class BoardCheckboxCellBloc
2121
didReceiveCellUpdate: (cellData) {
2222
emit(state.copyWith(isSelected: _isSelected(cellData)));
2323
},
24+
select: () async {
25+
cellController.saveCellData(!state.isSelected ? "Yes" : "No");
26+
},
2427
);
2528
},
2629
);
@@ -50,6 +53,7 @@ class BoardCheckboxCellBloc
5053
@freezed
5154
class BoardCheckboxCellEvent with _$BoardCheckboxCellEvent {
5255
const factory BoardCheckboxCellEvent.initial() = _InitialCell;
56+
const factory BoardCheckboxCellEvent.select() = _Selected;
5357
const factory BoardCheckboxCellEvent.didReceiveCellUpdate(
5458
String cellContent) = _DidReceiveCellUpdate;
5559
}

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,9 @@ class _BoardCheckboxCellState extends State<BoardCheckboxCell> {
4848
iconPadding: EdgeInsets.zero,
4949
icon: icon,
5050
width: 20,
51+
onPressed: () => context
52+
.read<BoardCheckboxCellBloc>()
53+
.add(const BoardCheckboxCellEvent.select()),
5154
),
5255
);
5356
},

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

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ class CheckboxCellBloc extends Bloc<CheckboxCellEvent, CheckboxCellState> {
2020
_startListening();
2121
},
2222
select: () async {
23-
_updateCellData();
23+
cellController.saveCellData(!state.isSelected ? "Yes" : "No");
2424
},
2525
didReceiveCellUpdate: (cellData) {
2626
emit(state.copyWith(isSelected: _isSelected(cellData)));
@@ -49,10 +49,6 @@ class CheckboxCellBloc extends Bloc<CheckboxCellEvent, CheckboxCellState> {
4949
}
5050
}));
5151
}
52-
53-
void _updateCellData() {
54-
cellController.saveCellData(!state.isSelected ? "Yes" : "No");
55-
}
5652
}
5753

5854
@freezed

0 commit comments

Comments
 (0)