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.

chore: fix some bugs

appflowy9456fbd57388
diff --git a/frontend/app_flowy/lib/plugins/board/application/board_bloc.dart b/frontend/app_flowy/lib/plugins/board/application/board_bloc.dart
index ed15c9703c..c837e4346f 100644
--- a/frontend/app_flowy/lib/plugins/board/application/board_bloc.dart
+++ b/frontend/app_flowy/lib/plugins/board/application/board_bloc.dart
@@ -253,5 +253,7 @@ class GroupControllerDelegateImpl extends GroupControllerDelegate {
}
@override
- void updateRow(String groupId, RowPB row) {}
+ void updateRow(String groupId, RowPB row) {
+ //
+ }
}
diff --git a/frontend/app_flowy/lib/plugins/board/presentation/card/board_select_option_cell.dart b/frontend/app_flowy/lib/plugins/board/presentation/card/board_select_option_cell.dart
index d430f869c1..373bb3c850 100644
--- a/frontend/app_flowy/lib/plugins/board/presentation/card/board_select_option_cell.dart
+++ b/frontend/app_flowy/lib/plugins/board/presentation/card/board_select_option_cell.dart
@@ -42,7 +42,13 @@ class _BoardSelectOptionCellState extends State<BoardSelectOptionCell> {
.toList();
return Align(
alignment: Alignment.centerLeft,
- child: Wrap(children: children, spacing: 4, runSpacing: 2),
+ child: AbsorbPointer(
+ child: Wrap(
+ children: children,
+ spacing: 4,
+ runSpacing: 2,
+ ),
+ ),
);
},
),
diff --git a/frontend/app_flowy/lib/plugins/board/presentation/card/board_text_cell.dart b/frontend/app_flowy/lib/plugins/board/presentation/card/board_text_cell.dart
index 8cb5c4987e..2da156ded8 100644
--- a/frontend/app_flowy/lib/plugins/board/presentation/card/board_text_cell.dart
+++ b/frontend/app_flowy/lib/plugins/board/presentation/card/board_text_cell.dart
@@ -37,9 +37,14 @@ class _BoardTextCellState extends State<BoardTextCell> {
} else {
return Align(
alignment: Alignment.centerLeft,
- child: FlowyText.regular(
- state.content,
- fontSize: 14,
+ child: ConstrainedBox(
+ constraints: BoxConstraints.loose(
+ const Size(double.infinity, 100),
+ ),
+ child: FlowyText.regular(
+ state.content,
+ fontSize: 14,
+ ),
),
);
}
diff --git a/frontend/app_flowy/lib/plugins/board/presentation/card/board_url_cell.dart b/frontend/app_flowy/lib/plugins/board/presentation/card/board_url_cell.dart
index 5493b0d45b..31cca41e6a 100644
--- a/frontend/app_flowy/lib/plugins/board/presentation/card/board_url_cell.dart
+++ b/frontend/app_flowy/lib/plugins/board/presentation/card/board_url_cell.dart
@@ -35,22 +35,24 @@ class _BoardUrlCellState extends State<BoardUrlCell> {
value: _cellBloc,
child: BlocBuilder<BoardURLCellBloc, BoardURLCellState>(
builder: (context, state) {
- final richText = RichText(
- textAlign: TextAlign.left,
- text: TextSpan(
- text: state.content,
- style: TextStyle(
- color: theme.main2,
- fontSize: 14,
- decoration: TextDecoration.underline,
+ if (state.content.isEmpty) {
+ return const SizedBox();
+ } else {
+ return Align(
+ alignment: Alignment.centerLeft,
+ child: RichText(
+ textAlign: TextAlign.left,
+ text: TextSpan(
+ text: state.content,
+ style: TextStyle(
+ color: theme.main2,
+ fontSize: 14,
+ decoration: TextDecoration.underline,
+ ),
+ ),
),
- ),
- );
-
- return Align(
- alignment: Alignment.centerLeft,
- child: richText,
- );
+ );
+ }
},
),
);
diff --git a/frontend/app_flowy/lib/plugins/board/presentation/card/card.dart b/frontend/app_flowy/lib/plugins/board/presentation/card/card.dart
index 20640f5601..a5c7b7ba2c 100644
--- a/frontend/app_flowy/lib/plugins/board/presentation/card/card.dart
+++ b/frontend/app_flowy/lib/plugins/board/presentation/card/card.dart
@@ -73,7 +73,7 @@ class _BoardCardState extends State<BoardCard> {
(cellId) {
final child = widget.cellBuilder.buildCell(cellId);
return Padding(
- padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 4),
+ padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 5),
child: child,
);
},
diff --git a/frontend/app_flowy/lib/plugins/grid/application/cell/cell_service/context_builder.dart b/frontend/app_flowy/lib/plugins/grid/application/cell/cell_service/context_builder.dart
index c8e92809d7..1068cbf36b 100644
--- a/frontend/app_flowy/lib/plugins/grid/application/cell/cell_service/context_builder.dart
+++ b/frontend/app_flowy/lib/plugins/grid/application/cell/cell_service/context_builder.dart
@@ -242,7 +242,7 @@ class IGridCellController<T, D> extends Equatable {
.getFieldTypeOptionData(fieldType: fieldType)
.then((result) {
return result.fold(
- (data) => parser.fromBuffer(data.typeOptionData),
+ (data) => left(parser.fromBuffer(data.typeOptionData)),
(err) => right(err),
);
});
diff --git a/frontend/app_flowy/lib/plugins/grid/presentation/widgets/cell/date_cell/date_editor.dart b/frontend/app_flowy/lib/plugins/grid/presentation/widgets/cell/date_cell/date_editor.dart
index 4ab3ff352d..f6ddf42fba 100644
--- a/frontend/app_flowy/lib/plugins/grid/presentation/widgets/cell/date_cell/date_editor.dart
+++ b/frontend/app_flowy/lib/plugins/grid/presentation/widgets/cell/date_cell/date_editor.dart
@@ -15,7 +15,6 @@ import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:table_calendar/table_calendar.dart';
import 'package:app_flowy/plugins/grid/application/prelude.dart';
-
import '../../../layout/sizes.dart';
import '../../header/type_option/date.dart';
@@ -39,6 +38,7 @@ class DateCellEditor with FlowyOverlayDelegate {
final result =
await cellController.getFieldTypeOption(DateTypeOptionDataParser());
+
result.fold(
(dateTypeOptionPB) {
final calendar = _CellCalendarWidget(
diff --git a/frontend/app_flowy/lib/plugins/grid/presentation/widgets/cell/number_cell.dart b/frontend/app_flowy/lib/plugins/grid/presentation/widgets/cell/number_cell.dart
index 004c34b657..2926972f95 100644
--- a/frontend/app_flowy/lib/plugins/grid/presentation/widgets/cell/number_cell.dart
+++ b/frontend/app_flowy/lib/plugins/grid/presentation/widgets/cell/number_cell.dart
@@ -49,8 +49,10 @@ class _NumberCellState extends GridFocusNodeCellState<GridNumberCell> {
controller: _controller,
focusNode: focusNode,
onEditingComplete: () => focusNode.unfocus(),
- maxLines: null,
+ onSubmitted: (_) => focusNode.unfocus(),
+ maxLines: 1,
style: const TextStyle(fontSize: 14, fontWeight: FontWeight.w500),
+ textInputAction: TextInputAction.done,
decoration: const InputDecoration(
contentPadding: EdgeInsets.zero,
border: InputBorder.none,
@@ -63,8 +65,6 @@ class _NumberCellState extends GridFocusNodeCellState<GridNumberCell> {
@override
Future<void> dispose() async {
- _delayOperation?.cancel();
- _cellBloc.close();
super.dispose();
}
@@ -76,6 +76,11 @@ class _NumberCellState extends GridFocusNodeCellState<GridNumberCell> {
if (_cellBloc.isClosed == false &&
_controller.text != contentFromState(_cellBloc.state)) {
_cellBloc.add(NumberCellEvent.updateCell(_controller.text));
+
+ if (!mounted) {
+ _delayOperation = null;
+ _cellBloc.close();
+ }
}
});
}
diff --git a/frontend/rust-lib/flowy-grid/src/services/grid_editor.rs b/frontend/rust-lib/flowy-grid/src/services/grid_editor.rs
index c39bb9e929..215cd3c467 100644
--- a/frontend/rust-lib/flowy-grid/src/services/grid_editor.rs
+++ b/frontend/rust-lib/flowy-grid/src/services/grid_editor.rs
@@ -287,7 +287,7 @@ impl GridRevisionEditor {
pub async fn create_row(&self, params: CreateRowParams) -> FlowyResult<RowPB> {
let mut row_rev = self.create_row_rev().await?;
- self.view_manager.update_row(&mut row_rev, &params).await;
+ self.view_manager.fill_row(&mut row_rev, &params).await;
let row_pb = self.create_row_pb(row_rev, params.start_row_id.clone()).await?;
@@ -314,7 +314,10 @@ impl GridRevisionEditor {
}
pub async fn update_row(&self, changeset: RowMetaChangeset) -> FlowyResult<()> {
- self.block_manager.update_row(changeset, make_row_from_row_rev).await
+ let row_id = changeset.row_id.clone();
+ let _ = self.block_manager.update_row(changeset, make_row_from_row_rev).await?;
+ self.view_manager.did_update_row(&row_id).await;
+ Ok(())
}
pub async fn get_rows(&self, block_id: &str) -> FlowyResult<RepeatedRowPB> {
diff --git a/frontend/rust-lib/flowy-grid/src/services/grid_view_editor.rs b/frontend/rust-lib/flowy-grid/src/services/grid_view_editor.rs
index adb016ed41..6d1c231480 100644
--- a/frontend/rust-lib/flowy-grid/src/services/grid_view_editor.rs
+++ b/frontend/rust-lib/flowy-grid/src/services/grid_view_editor.rs
@@ -76,7 +76,7 @@ impl GridViewRevisionEditor {
})
}
- pub(crate) async fn update_row(&self, row_rev: &mut RowRevision, params: &CreateRowParams) {
+ pub(crate) async fn fill_row(&self, row_rev: &mut RowRevision, params: &CreateRowParams) {
match params.layout {
GridLayout::Table => {
// Table can be grouped too
diff --git a/frontend/rust-lib/flowy-grid/src/services/grid_view_manager.rs b/frontend/rust-lib/flowy-grid/src/services/grid_view_manager.rs
index edae70ba63..b5f8d41691 100644
--- a/frontend/rust-lib/flowy-grid/src/services/grid_view_manager.rs
+++ b/frontend/rust-lib/flowy-grid/src/services/grid_view_manager.rs
@@ -47,12 +47,16 @@ impl GridViewManager {
})
}
- pub(crate) async fn update_row(&self, row_rev: &mut RowRevision, params: &CreateRowParams) {
+ pub(crate) async fn fill_row(&self, row_rev: &mut RowRevision, params: &CreateRowParams) {
for view_editor in self.view_editors.iter() {
- view_editor.update_row(row_rev, params).await;
+ view_editor.fill_row(row_rev, params).await;
}
}
+ pub(crate) async fn did_update_row(&self, row_id: &str) {
+ let row = self.block_manager.get_row_rev(row_id).await;
+ }
+
pub(crate) async fn did_create_row(&self, row_pb: &RowPB, params: &CreateRowParams) {
for view_editor in self.view_editors.iter() {
view_editor.did_create_row(row_pb, params).await;