mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2024-08-30 18:12:39 +00:00
Merge pull request #861 from AppFlowy-IO/feat/delete_board_card
chore: delete board card
This commit is contained in:
commit
a0363e349d
@ -138,14 +138,6 @@ class BoardBloc extends Bloc<BoardEvent, BoardState> {
|
|||||||
|
|
||||||
List<AFColumnItem> _buildRows(List<RowPB> rows) {
|
List<AFColumnItem> _buildRows(List<RowPB> rows) {
|
||||||
final items = rows.map((row) {
|
final items = rows.map((row) {
|
||||||
// final rowInfo = RowInfo(
|
|
||||||
// gridId: _dataController.gridId,
|
|
||||||
// blockId: row.blockId,
|
|
||||||
// id: row.id,
|
|
||||||
// fields: _dataController.fieldCache.unmodifiableFields,
|
|
||||||
// height: row.height.toDouble(),
|
|
||||||
// rawRow: row,
|
|
||||||
// );
|
|
||||||
return BoardColumnItem(row: row);
|
return BoardColumnItem(row: row);
|
||||||
}).toList();
|
}).toList();
|
||||||
|
|
||||||
|
@ -58,6 +58,17 @@ class BoardCardBloc extends Bloc<BoardCardEvent, BoardCardState> {
|
|||||||
return super.close();
|
return super.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
RowInfo rowInfo() {
|
||||||
|
return RowInfo(
|
||||||
|
gridId: _rowService.gridId,
|
||||||
|
blockId: _rowService.blockId,
|
||||||
|
fields: UnmodifiableListView(
|
||||||
|
state.cells.map((cell) => cell._field).toList(),
|
||||||
|
),
|
||||||
|
rowPB: state.rowPB,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
Future<void> _startListening() async {
|
Future<void> _startListening() async {
|
||||||
_dataController.addListener(
|
_dataController.addListener(
|
||||||
onRowChanged: (cells, reason) {
|
onRowChanged: (cells, reason) {
|
||||||
|
@ -1,9 +1,10 @@
|
|||||||
import 'package:app_flowy/plugins/board/application/card/card_bloc.dart';
|
import 'package:app_flowy/plugins/board/application/card/card_bloc.dart';
|
||||||
import 'package:app_flowy/plugins/board/application/card/card_data_controller.dart';
|
import 'package:app_flowy/plugins/board/application/card/card_data_controller.dart';
|
||||||
import 'package:app_flowy/plugins/grid/application/cell/cell_service/cell_service.dart';
|
import 'package:app_flowy/plugins/grid/application/cell/cell_service/cell_service.dart';
|
||||||
|
import 'package:app_flowy/plugins/grid/presentation/widgets/row/row_action_sheet.dart';
|
||||||
import 'package:flowy_infra/image.dart';
|
import 'package:flowy_infra/image.dart';
|
||||||
import 'package:flowy_infra/theme.dart';
|
import 'package:flowy_infra/theme.dart';
|
||||||
import 'package:flowy_sdk/log.dart';
|
import 'package:flowy_infra_ui/flowy_infra_ui_web.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||||
import 'card_cell_builder.dart';
|
import 'card_cell_builder.dart';
|
||||||
@ -85,6 +86,8 @@ class _CardMoreOption extends StatelessWidget with CardAccessory {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
void onTap(BuildContext context) {
|
void onTap(BuildContext context) {
|
||||||
Log.debug('show options');
|
GridRowActionSheet(
|
||||||
|
rowData: context.read<BoardCardBloc>().rowInfo(),
|
||||||
|
).show(context, direction: AnchorDirection.bottomWithCenterAligned);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -53,7 +53,10 @@ class GridRowActionSheet extends StatelessWidget {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
void show(BuildContext overlayContext) {
|
void show(
|
||||||
|
BuildContext overlayContext, {
|
||||||
|
AnchorDirection direction = AnchorDirection.leftWithCenterAligned,
|
||||||
|
}) {
|
||||||
FlowyOverlay.of(overlayContext).insertWithAnchor(
|
FlowyOverlay.of(overlayContext).insertWithAnchor(
|
||||||
widget: OverlayContainer(
|
widget: OverlayContainer(
|
||||||
child: this,
|
child: this,
|
||||||
@ -61,7 +64,7 @@ class GridRowActionSheet extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
identifier: GridRowActionSheet.identifier(),
|
identifier: GridRowActionSheet.identifier(),
|
||||||
anchorContext: overlayContext,
|
anchorContext: overlayContext,
|
||||||
anchorDirection: AnchorDirection.leftWithCenterAligned,
|
anchorDirection: direction,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -51,8 +51,11 @@ class AFBoardColumnDataController extends ChangeNotifier with EquatableMixin {
|
|||||||
return item;
|
return item;
|
||||||
}
|
}
|
||||||
|
|
||||||
int removeWhere(bool Function(AFColumnItem) condition) {
|
void removeWhere(bool Function(AFColumnItem) condition) {
|
||||||
return items.indexWhere(condition);
|
final index = items.indexWhere(condition);
|
||||||
|
if (index != -1) {
|
||||||
|
removeAt(index);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Move the item from [fromIndex] to [toIndex]. It will do nothing if the
|
/// Move the item from [fromIndex] to [toIndex]. It will do nothing if the
|
||||||
|
@ -122,6 +122,7 @@ impl GridBlockManager {
|
|||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[tracing::instrument(level = "trace", skip_all, err)]
|
||||||
pub async fn delete_row(&self, row_id: &str) -> FlowyResult<()> {
|
pub async fn delete_row(&self, row_id: &str) -> FlowyResult<()> {
|
||||||
let row_id = row_id.to_owned();
|
let row_id = row_id.to_owned();
|
||||||
let block_id = self.persistence.get_block_id(&row_id)?;
|
let block_id = self.persistence.get_block_id(&row_id)?;
|
||||||
|
Loading…
Reference in New Issue
Block a user