mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2024-08-30 18:12:39 +00:00
chore: insert cell content when creating card
This commit is contained in:
@ -52,8 +52,8 @@ class BoardBloc extends Bloc<BoardEvent, BoardState> {
|
||||
_startListening();
|
||||
await _loadGrid(emit);
|
||||
},
|
||||
createRow: () async {
|
||||
final result = await _dataController.createRow();
|
||||
createRow: (groupId) async {
|
||||
final result = await _dataController.createBoardCard(groupId);
|
||||
result.fold(
|
||||
(rowPB) {
|
||||
emit(state.copyWith(editingRow: some(rowPB)));
|
||||
@ -153,7 +153,7 @@ class BoardBloc extends Bloc<BoardEvent, BoardState> {
|
||||
@freezed
|
||||
class BoardEvent with _$BoardEvent {
|
||||
const factory BoardEvent.initial() = InitialGrid;
|
||||
const factory BoardEvent.createRow() = _CreateRow;
|
||||
const factory BoardEvent.createRow(String groupId) = _CreateRow;
|
||||
const factory BoardEvent.endEditRow(String rowId) = _EndEditRow;
|
||||
const factory BoardEvent.didReceiveGroups(List<GroupPB> groups) =
|
||||
_DidReceiveGroup;
|
||||
|
@ -21,7 +21,7 @@ typedef OnError = void Function(FlowyError);
|
||||
|
||||
class BoardDataController {
|
||||
final String gridId;
|
||||
final GridService _gridFFIService;
|
||||
final GridFFIService _gridFFIService;
|
||||
final GridFieldCache fieldCache;
|
||||
|
||||
// key: the block id
|
||||
@ -45,7 +45,7 @@ class BoardDataController {
|
||||
BoardDataController({required ViewPB view})
|
||||
: gridId = view.id,
|
||||
_blocks = LinkedHashMap.new(),
|
||||
_gridFFIService = GridService(gridId: view.id),
|
||||
_gridFFIService = GridFFIService(gridId: view.id),
|
||||
fieldCache = GridFieldCache(gridId: view.id);
|
||||
|
||||
void addListener({
|
||||
@ -88,8 +88,8 @@ class BoardDataController {
|
||||
);
|
||||
}
|
||||
|
||||
Future<Either<RowPB, FlowyError>> createRow() {
|
||||
return _gridFFIService.createRow();
|
||||
Future<Either<RowPB, FlowyError>> createBoardCard(String groupId) {
|
||||
return _gridFFIService.createBoardCard(groupId);
|
||||
}
|
||||
|
||||
Future<void> dispose() async {
|
||||
|
@ -88,7 +88,7 @@ class BoardContent extends StatelessWidget {
|
||||
height: 50,
|
||||
margin: config.columnItemPadding,
|
||||
onAddButtonClick: () {
|
||||
context.read<BoardBloc>().add(const BoardEvent.createRow());
|
||||
context.read<BoardBloc>().add(BoardEvent.createRow(columnData.id));
|
||||
});
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user