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.

fix(flutter_desktop): row detail checklist cell "create new" text field doesn't clear after clicking on create button (#7055)

Richard Shiue956d2dfd07dc
diff --git a/frontend/appflowy_flutter/integration_test/desktop/database/database_row_page_test.dart b/frontend/appflowy_flutter/integration_test/desktop/database/database_row_page_test.dart
index 8874cefb1c..22f059d199 100644
--- a/frontend/appflowy_flutter/integration_test/desktop/database/database_row_page_test.dart
+++ b/frontend/appflowy_flutter/integration_test/desktop/database/database_row_page_test.dart
@@ -394,11 +394,16 @@ void main() {
isChecked: false,
);
tester.assertPhantomChecklistItemAtIndex(index: 1);
+ tester.assertPhantomChecklistItemContent("");
await tester.enterText(find.byType(PhantomChecklistItem), 'task 2');
await tester.pumpAndSettle();
- await tester.simulateKeyEvent(LogicalKeyboardKey.enter);
- await tester.pumpAndSettle(const Duration(milliseconds: 500));
+ await tester.hoverOnWidget(
+ find.byType(ChecklistRowDetailCell),
+ onHover: () async {
+ await tester.tapButton(find.byType(ChecklistItemControl));
+ },
+ );
tester.assertChecklistTaskInEditor(
index: 1,
@@ -406,6 +411,7 @@ void main() {
isChecked: false,
);
tester.assertPhantomChecklistItemAtIndex(index: 2);
+ tester.assertPhantomChecklistItemContent("");
await tester.simulateKeyEvent(LogicalKeyboardKey.escape);
await tester.pumpAndSettle();
diff --git a/frontend/appflowy_flutter/integration_test/shared/database_test_op.dart b/frontend/appflowy_flutter/integration_test/shared/database_test_op.dart
index ff7e33ebdf..676c96f042 100644
--- a/frontend/appflowy_flutter/integration_test/shared/database_test_op.dart
+++ b/frontend/appflowy_flutter/integration_test/shared/database_test_op.dart
@@ -567,6 +567,12 @@ extension AppFlowyDatabaseTest on WidgetTester {
expect(phantom is PhantomChecklistItem, true);
}
+ void assertPhantomChecklistItemContent(String content) {
+ final phantom = find.byType(PhantomChecklistItem);
+ final text = find.text(content);
+ expect(find.descendant(of: phantom, matching: text), findsOneWidget);
+ }
+
Future<void> openFirstRowDetailPage() async {
await hoverOnFirstRowOfGrid();
diff --git a/frontend/appflowy_flutter/lib/plugins/database/widgets/cell/desktop_row_detail/desktop_row_detail_checklist_cell.dart b/frontend/appflowy_flutter/lib/plugins/database/widgets/cell/desktop_row_detail/desktop_row_detail_checklist_cell.dart
index d100a56860..d7e1d64fc3 100644
--- a/frontend/appflowy_flutter/lib/plugins/database/widgets/cell/desktop_row_detail/desktop_row_detail_checklist_cell.dart
+++ b/frontend/appflowy_flutter/lib/plugins/database/widgets/cell/desktop_row_detail/desktop_row_detail_checklist_cell.dart
@@ -89,7 +89,6 @@ class _ChecklistRowDetailCellState extends State<ChecklistRowDetailCell> {
onTap: () {
final bloc = context.read<ChecklistCellBloc>();
if (bloc.state.phantomIndex == null) {
- phantomTextController.clear();
bloc.add(
ChecklistCellEvent.updatePhantomIndex(
bloc.state.showIncompleteOnly
@@ -107,6 +106,7 @@ class _ChecklistRowDetailCellState extends State<ChecklistRowDetailCell> {
),
);
}
+ phantomTextController.clear();
},
),
],