Skip to content

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.

feat: enable select checkbox directly

appflowy56fdc99990ac
diff --git a/frontend/app_flowy/lib/plugins/board/application/card/board_checkbox_cell_bloc.dart b/frontend/app_flowy/lib/plugins/board/application/card/board_checkbox_cell_bloc.dart
index 3834db112c..c8a0d87f9c 100644
--- a/frontend/app_flowy/lib/plugins/board/application/card/board_checkbox_cell_bloc.dart
+++ b/frontend/app_flowy/lib/plugins/board/application/card/board_checkbox_cell_bloc.dart
@@ -21,6 +21,9 @@ class BoardCheckboxCellBloc
didReceiveCellUpdate: (cellData) {
emit(state.copyWith(isSelected: _isSelected(cellData)));
},
+ select: () async {
+ cellController.saveCellData(!state.isSelected ? "Yes" : "No");
+ },
);
},
);
@@ -50,6 +53,7 @@ class BoardCheckboxCellBloc
@freezed
class BoardCheckboxCellEvent with _$BoardCheckboxCellEvent {
const factory BoardCheckboxCellEvent.initial() = _InitialCell;
+ const factory BoardCheckboxCellEvent.select() = _Selected;
const factory BoardCheckboxCellEvent.didReceiveCellUpdate(
String cellContent) = _DidReceiveCellUpdate;
}
diff --git a/frontend/app_flowy/lib/plugins/board/presentation/card/board_checkbox_cell.dart b/frontend/app_flowy/lib/plugins/board/presentation/card/board_checkbox_cell.dart
index f832d3749d..6b94d3399b 100644
--- a/frontend/app_flowy/lib/plugins/board/presentation/card/board_checkbox_cell.dart
+++ b/frontend/app_flowy/lib/plugins/board/presentation/card/board_checkbox_cell.dart
@@ -48,6 +48,9 @@ class _BoardCheckboxCellState extends State<BoardCheckboxCell> {
iconPadding: EdgeInsets.zero,
icon: icon,
width: 20,
+ onPressed: () => context
+ .read<BoardCheckboxCellBloc>()
+ .add(const BoardCheckboxCellEvent.select()),
),
);
},
diff --git a/frontend/app_flowy/lib/plugins/grid/application/cell/checkbox_cell_bloc.dart b/frontend/app_flowy/lib/plugins/grid/application/cell/checkbox_cell_bloc.dart
index f5e7a451e2..5f7aee108e 100644
--- a/frontend/app_flowy/lib/plugins/grid/application/cell/checkbox_cell_bloc.dart
+++ b/frontend/app_flowy/lib/plugins/grid/application/cell/checkbox_cell_bloc.dart
@@ -20,7 +20,7 @@ class CheckboxCellBloc extends Bloc<CheckboxCellEvent, CheckboxCellState> {
_startListening();
},
select: () async {
- _updateCellData();
+ cellController.saveCellData(!state.isSelected ? "Yes" : "No");
},
didReceiveCellUpdate: (cellData) {
emit(state.copyWith(isSelected: _isSelected(cellData)));
@@ -49,10 +49,6 @@ class CheckboxCellBloc extends Bloc<CheckboxCellEvent, CheckboxCellState> {
}
}));
}
-
- void _updateCellData() {
- cellController.saveCellData(!state.isSelected ? "Yes" : "No");
- }
}
@freezed