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: code cleanup according to unintroduced lints (#4488)

Mathias Mogensenacc03b8cc481
diff --git a/frontend/appflowy_flutter/analysis_options.yaml b/frontend/appflowy_flutter/analysis_options.yaml
index 03997a9e3c..8b7136aae6 100644
--- a/frontend/appflowy_flutter/analysis_options.yaml
+++ b/frontend/appflowy_flutter/analysis_options.yaml
@@ -36,11 +36,19 @@ linter:
- prefer_final_locals
- sized_box_for_whitespace
+ - use_decorated_box
+
+ - unnecessary_parenthesis
+ - unnecessary_await_in_return
+ - unnecessary_raw_strings
+
- avoid_unnecessary_containers
+ - avoid_redundant_argument_values
+ - avoid_unused_constructor_parameters
- always_declare_return_types
- - unnecessary_raw_strings
- - use_decorated_box
+
+ - sort_constructors_first
# Additional information about this file can be found at
# https://dart.dev/guides/language/analysis-options
diff --git a/frontend/appflowy_flutter/integration_test/board_test.dart b/frontend/appflowy_flutter/integration_test/board_test.dart
index 3ac479bd70..a5d329515d 100644
--- a/frontend/appflowy_flutter/integration_test/board_test.dart
+++ b/frontend/appflowy_flutter/integration_test/board_test.dart
@@ -32,8 +32,8 @@ void main() {
const service = TestWorkspaceService(TestWorkspace.board);
group('board', () {
- setUpAll(() async => await service.setUpAll());
- setUp(() async => await service.setUp());
+ setUpAll(() async => service.setUpAll());
+ setUp(() async => service.setUp());
testWidgets('open the board with data structure in v0.2.0', (tester) async {
await tester.initializeAppFlowy();
diff --git a/frontend/appflowy_flutter/integration_test/cloud/document_sync_test.dart b/frontend/appflowy_flutter/integration_test/cloud/document_sync_test.dart
index 783e007009..5ad38e49e2 100644
--- a/frontend/appflowy_flutter/integration_test/cloud/document_sync_test.dart
+++ b/frontend/appflowy_flutter/integration_test/cloud/document_sync_test.dart
@@ -38,9 +38,7 @@ void main() {
await tester.expectToSeeHomePageWithGetStartedPage();
// create a new document called Sample
- await tester.createNewPage(
- layout: ViewLayoutPB.Document,
- );
+ await tester.createNewPage();
// focus on the editor
await tester.editor.tapLineOfEditorAt(0);
diff --git a/frontend/appflowy_flutter/integration_test/database/database_calendar_test.dart b/frontend/appflowy_flutter/integration_test/database/database_calendar_test.dart
index 9d1d9c780c..f882983712 100644
--- a/frontend/appflowy_flutter/integration_test/database/database_calendar_test.dart
+++ b/frontend/appflowy_flutter/integration_test/database/database_calendar_test.dart
@@ -80,7 +80,7 @@ void main() {
// Hover over today's calendar cell
await tester.hoverOnTodayCalendarCell(
// Tap on create new event button
- onHover: () async => await tester.tapAddCalendarEventButton(),
+ onHover: () async => tester.tapAddCalendarEventButton(),
);
// Make sure that the event editor popup is shown
@@ -158,7 +158,7 @@ void main() {
// Create a new event on the first of this month
final today = DateTime.now();
- final firstOfThisMonth = DateTime(today.year, today.month, 1);
+ final firstOfThisMonth = DateTime(today.year, today.month);
await tester.doubleClickCalendarCell(firstOfThisMonth);
await tester.dismissEventEditor();
diff --git a/frontend/appflowy_flutter/integration_test/database/database_cell_test.dart b/frontend/appflowy_flutter/integration_test/database/database_cell_test.dart
index fbb8274390..78a04ae013 100644
--- a/frontend/appflowy_flutter/integration_test/database/database_cell_test.dart
+++ b/frontend/appflowy_flutter/integration_test/database/database_cell_test.dart
@@ -60,7 +60,6 @@ void main() {
rowIndex: 0,
fieldType: FieldType.RichText,
content: 'hello',
- cellIndex: 0,
);
await tester.assertCellContent(
diff --git a/frontend/appflowy_flutter/integration_test/document/document_create_and_delete_test.dart b/frontend/appflowy_flutter/integration_test/document/document_create_and_delete_test.dart
index 6d3121528a..d0939d9557 100644
--- a/frontend/appflowy_flutter/integration_test/document/document_create_and_delete_test.dart
+++ b/frontend/appflowy_flutter/integration_test/document/document_create_and_delete_test.dart
@@ -35,7 +35,7 @@ void main() {
// delete the readme page
await tester.hoverOnPageName(
gettingStarted,
- onHover: () async => await tester.tapDeletePageButton(),
+ onHover: () async => tester.tapDeletePageButton(),
);
// the banner should show up and the readme page should be gone
@@ -59,7 +59,7 @@ void main() {
// delete the readme page
await tester.hoverOnPageName(
gettingStarted,
- onHover: () async => await tester.tapDeletePageButton(),
+ onHover: () async => tester.tapDeletePageButton(),
);
// the banner should show up and the readme page should be gone
diff --git a/frontend/appflowy_flutter/integration_test/document/document_inline_page_reference_test.dart b/frontend/appflowy_flutter/integration_test/document/document_inline_page_reference_test.dart
index 8794233cf7..7104e7e7bc 100644
--- a/frontend/appflowy_flutter/integration_test/document/document_inline_page_reference_test.dart
+++ b/frontend/appflowy_flutter/integration_test/document/document_inline_page_reference_test.dart
@@ -3,7 +3,6 @@ import 'package:flutter/services.dart';
import 'package:appflowy/plugins/document/presentation/editor_plugins/mention/mention_page_block.dart';
import 'package:appflowy/plugins/inline_actions/widgets/inline_actions_handler.dart';
import 'package:appflowy/workspace/presentation/home/menu/view/view_item.dart';
-import 'package:appflowy_backend/protobuf/flowy-folder/protobuf.dart';
import 'package:flowy_infra/uuid.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:integration_test/integration_test.dart';
@@ -89,7 +88,6 @@ Future<String> createDocumentToReference(WidgetTester tester) async {
await tester.createNewPageWithNameUnderParent(
name: name,
- layout: ViewLayoutPB.Document,
openAfterCreated: false,
);
diff --git a/frontend/appflowy_flutter/integration_test/document/document_with_database_test.dart b/frontend/appflowy_flutter/integration_test/document/document_with_database_test.dart
index d01ead126f..93dfde2bb5 100644
--- a/frontend/appflowy_flutter/integration_test/document/document_with_database_test.dart
+++ b/frontend/appflowy_flutter/integration_test/document/document_with_database_test.dart
@@ -144,8 +144,6 @@ Future<void> insertReferenceDatabase(
// create a new document
await tester.createNewPageWithNameUnderParent(
name: 'insert_a_reference_${layout.name}',
- layout: ViewLayoutPB.Document,
- openAfterCreated: true,
);
// tap the first line of the document
await tester.editor.tapLineOfEditorAt(0);
@@ -173,8 +171,6 @@ Future<void> createInlineDatabase(
final documentName = 'insert_a_inline_${layout.name}';
await tester.createNewPageWithNameUnderParent(
name: documentName,
- layout: ViewLayoutPB.Document,
- openAfterCreated: true,
);
// tap the first line of the document
await tester.editor.tapLineOfEditorAt(0);
diff --git a/frontend/appflowy_flutter/integration_test/document/document_with_image_block_test.dart b/frontend/appflowy_flutter/integration_test/document/document_with_image_block_test.dart
index 3b52759a92..d3515faecd 100644
--- a/frontend/appflowy_flutter/integration_test/document/document_with_image_block_test.dart
+++ b/frontend/appflowy_flutter/integration_test/document/document_with_image_block_test.dart
@@ -10,7 +10,6 @@ import 'package:appflowy/plugins/document/presentation/editor_plugins/image/resi
import 'package:appflowy/plugins/document/presentation/editor_plugins/image/unsplash_image_widget.dart';
import 'package:appflowy/plugins/document/presentation/editor_plugins/image/upload_image_menu.dart';
import 'package:appflowy/startup/startup.dart';
-import 'package:appflowy_backend/protobuf/flowy-folder/protobuf.dart';
import 'package:appflowy_editor/appflowy_editor.dart'
hide UploadImageMenu, ResizableImage;
import 'package:easy_localization/easy_localization.dart';
@@ -38,7 +37,6 @@ void main() {
// create a new document
await tester.createNewPageWithNameUnderParent(
name: LocaleKeys.document_plugins_image_addAnImage.tr(),
- layout: ViewLayoutPB.Document,
);
// tap the first line of the document
@@ -87,7 +85,6 @@ void main() {
// create a new document
await tester.createNewPageWithNameUnderParent(
name: LocaleKeys.document_plugins_image_addAnImage.tr(),
- layout: ViewLayoutPB.Document,
);
// tap the first line of the document
@@ -141,7 +138,6 @@ void main() {
// create a new document
await tester.createNewPageWithNameUnderParent(
name: LocaleKeys.document_plugins_image_addAnImage.tr(),
- layout: ViewLayoutPB.Document,
);
// tap the first line of the document
diff --git a/frontend/appflowy_flutter/integration_test/document/document_with_inline_math_equation_test.dart b/frontend/appflowy_flutter/integration_test/document/document_with_inline_math_equation_test.dart
index f8ad952459..c1a7fef063 100644
--- a/frontend/appflowy_flutter/integration_test/document/document_with_inline_math_equation_test.dart
+++ b/frontend/appflowy_flutter/integration_test/document/document_with_inline_math_equation_test.dart
@@ -1,6 +1,5 @@
import 'package:appflowy/generated/locale_keys.g.dart';
import 'package:appflowy/plugins/document/presentation/editor_plugins/plugins.dart';
-import 'package:appflowy_backend/protobuf/flowy-folder/protobuf.dart';
import 'package:appflowy_editor/appflowy_editor.dart';
import 'package:easy_localization/easy_localization.dart';
import 'package:flowy_infra_ui/style_widget/button.dart';
@@ -22,7 +21,6 @@ void main() {
// create a new document
await tester.createNewPageWithNameUnderParent(
name: 'math equation',
- layout: ViewLayoutPB.Document,
);
// tap the first line of the document
@@ -68,7 +66,6 @@ void main() {
// create a new document
await tester.createNewPageWithNameUnderParent(
name: 'math equation',
- layout: ViewLayoutPB.Document,
);
// tap the first line of the document
diff --git a/frontend/appflowy_flutter/integration_test/document/document_with_inline_page_test.dart b/frontend/appflowy_flutter/integration_test/document/document_with_inline_page_test.dart
index 84080d7c97..414ffa250d 100644
--- a/frontend/appflowy_flutter/integration_test/document/document_with_inline_page_test.dart
+++ b/frontend/appflowy_flutter/integration_test/document/document_with_inline_page_test.dart
@@ -65,7 +65,7 @@ void main() {
const newName = 'RenameToNewPageName';
await tester.hoverOnPageName(
pageName,
- onHover: () async => await tester.renamePage(newName),
+ onHover: () async => tester.renamePage(newName),
);
final finder = find.descendant(
of: find.byType(MentionPageBlock),
@@ -84,7 +84,7 @@ void main() {
await tester.hoverOnPageName(
pageName,
layout: ViewLayoutPB.Grid,
- onHover: () async => await tester.tapDeletePageButton(),
+ onHover: () async => tester.tapDeletePageButton(),
);
final finder = find.descendant(
of: find.byType(MentionPageBlock),
@@ -114,7 +114,6 @@ Future<String> insertInlinePage(
// create a new document
await tester.createNewPageWithNameUnderParent(
name: 'insert_a_inline_page_${layout.name}',
- layout: ViewLayoutPB.Document,
);
// tap the first line of the document
diff --git a/frontend/appflowy_flutter/integration_test/document/document_with_link_test.dart b/frontend/appflowy_flutter/integration_test/document/document_with_link_test.dart
index d2ce2368da..400d130666 100644
--- a/frontend/appflowy_flutter/integration_test/document/document_with_link_test.dart
+++ b/frontend/appflowy_flutter/integration_test/document/document_with_link_test.dart
@@ -1,4 +1,3 @@
-import 'package:appflowy_backend/protobuf/flowy-folder/protobuf.dart';
import 'package:appflowy_editor/appflowy_editor.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
@@ -24,9 +23,7 @@ void main() {
await tester.tapGoButton();
// create a new document
- await tester.createNewPageWithNameUnderParent(
- layout: ViewLayoutPB.Document,
- );
+ await tester.createNewPageWithNameUnderParent();
// tap the first line of the document
await tester.editor.tapLineOfEditorAt(0);
diff --git a/frontend/appflowy_flutter/integration_test/document/document_with_outline_block_test.dart b/frontend/appflowy_flutter/integration_test/document/document_with_outline_block_test.dart
index 5cc8aabfa4..6f8e027b62 100644
--- a/frontend/appflowy_flutter/integration_test/document/document_with_outline_block_test.dart
+++ b/frontend/appflowy_flutter/integration_test/document/document_with_outline_block_test.dart
@@ -1,6 +1,5 @@
import 'package:appflowy/generated/locale_keys.g.dart';
import 'package:appflowy/plugins/document/presentation/editor_plugins/outline/outline_block_component.dart';
-import 'package:appflowy_backend/protobuf/flowy-folder/protobuf.dart';
import 'package:easy_localization/easy_localization.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:integration_test/integration_test.dart';
@@ -17,7 +16,6 @@ void main() {
await tester.createNewPageWithNameUnderParent(
name: 'outline_test',
- layout: ViewLayoutPB.Document,
);
await tester.editor.tapLineOfEditorAt(0);
@@ -34,7 +32,6 @@ void main() {
await tester.createNewPageWithNameUnderParent(
name: 'outline_test',
- layout: ViewLayoutPB.Document,
);
await tester.editor.tapLineOfEditorAt(0);
diff --git a/frontend/appflowy_flutter/integration_test/document/document_with_toggle_list_test.dart b/frontend/appflowy_flutter/integration_test/document/document_with_toggle_list_test.dart
index b4a9784537..e6ce6baff1 100644
--- a/frontend/appflowy_flutter/integration_test/document/document_with_toggle_list_test.dart
+++ b/frontend/appflowy_flutter/integration_test/document/document_with_toggle_list_test.dart
@@ -1,7 +1,6 @@
import 'dart:io';
import 'package:appflowy/plugins/document/presentation/editor_plugins/plugins.dart';
-import 'package:appflowy_backend/protobuf/flowy-folder/protobuf.dart';
import 'package:appflowy_editor/appflowy_editor.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
@@ -40,9 +39,7 @@ void main() {
await tester.tapGoButton();
// create a new document
- await tester.createNewPageWithNameUnderParent(
- layout: ViewLayoutPB.Document,
- );
+ await tester.createNewPageWithNameUnderParent();
// tap the first line of the document
await tester.editor.tapLineOfEditorAt(0);
@@ -86,9 +83,7 @@ void main() {
await tester.tapGoButton();
// create a new document
- await tester.createNewPageWithNameUnderParent(
- layout: ViewLayoutPB.Document,
- );
+ await tester.createNewPageWithNameUnderParent();
// tap the first line of the document
await tester.editor.tapLineOfEditorAt(0);
@@ -125,9 +120,7 @@ void main() {
await tester.tapGoButton();
// create a new document
- await tester.createNewPageWithNameUnderParent(
- layout: ViewLayoutPB.Document,
- );
+ await tester.createNewPageWithNameUnderParent();
// tap the first line of the document
await tester.editor.tapLineOfEditorAt(0);
@@ -162,9 +155,7 @@ void main() {
await tester.tapGoButton();
// create a new document
- await tester.createNewPageWithNameUnderParent(
- layout: ViewLayoutPB.Document,
- );
+ await tester.createNewPageWithNameUnderParent();
// tap the first line of the document
await tester.editor.tapLineOfEditorAt(0);
@@ -176,11 +167,8 @@ void main() {
final toggleListIcon = find.byIcon(Icons.arrow_right);
await tester.tapButton(toggleListIcon);
- await tester.editor.updateSelection(
- Selection.collapsed(
- Position(path: [0], offset: 0),
- ),
- );
+ await tester.editor
+ .updateSelection(Selection.collapsed(Position(path: [0])));
await tester.ime.insertCharacter('\n');
final editorState = tester.editor.getCurrentEditorState();
@@ -196,9 +184,7 @@ void main() {
await tester.tapGoButton();
// create a new document
- await tester.createNewPageWithNameUnderParent(
- layout: ViewLayoutPB.Document,
- );
+ await tester.createNewPageWithNameUnderParent();
// tap the first line of the document
await tester.editor.tapLineOfEditorAt(0);
@@ -209,7 +195,7 @@ void main() {
await tester.editor.updateSelection(
Selection.collapsed(
- Position(path: [0], offset: 0),
+ Position(path: [0]),
),
);
await tester.simulateKeyEvent(
diff --git a/frontend/appflowy_flutter/integration_test/document/edit_document_test.dart b/frontend/appflowy_flutter/integration_test/document/edit_document_test.dart
index 8f1218e2f4..84579b1ea7 100644
--- a/frontend/appflowy_flutter/integration_test/document/edit_document_test.dart
+++ b/frontend/appflowy_flutter/integration_test/document/edit_document_test.dart
@@ -1,6 +1,5 @@
import 'dart:io';
-import 'package:appflowy_backend/protobuf/flowy-folder/view.pb.dart';
import 'package:appflowy_editor/appflowy_editor.dart';
import 'package:flutter/services.dart';
import 'package:flutter_test/flutter_test.dart';
@@ -18,10 +17,7 @@ void main() {
// create a new document called Sample
const pageName = 'Sample';
- await tester.createNewPageWithNameUnderParent(
- name: pageName,
- layout: ViewLayoutPB.Document,
- );
+ await tester.createNewPageWithNameUnderParent(name: pageName);
// focus on the editor
await tester.editor.tapLineOfEditorAt(0);
@@ -75,10 +71,7 @@ void main() {
// create a new document called Sample
const pageName = 'Sample';
- await tester.createNewPageWithNameUnderParent(
- name: pageName,
- layout: ViewLayoutPB.Document,
- );
+ await tester.createNewPageWithNameUnderParent(name: pageName);
// focus on the editor
await tester.editor.tapLineOfEditorAt(0);
diff --git a/frontend/appflowy_flutter/integration_test/empty_document_test.dart b/frontend/appflowy_flutter/integration_test/empty_document_test.dart
index 1483a576ac..273e7bb73a 100644
--- a/frontend/appflowy_flutter/integration_test/empty_document_test.dart
+++ b/frontend/appflowy_flutter/integration_test/empty_document_test.dart
@@ -28,8 +28,8 @@ void main() {
const service = TestWorkspaceService(TestWorkspace.emptyDocument);
group('Tests on a workspace with only an empty document', () {
- setUpAll(() async => await service.setUpAll());
- setUp(() async => await service.setUp());
+ setUpAll(() async => service.setUpAll());
+ setUp(() async => service.setUp());
testWidgets('/board shortcut creates a new board and view of the board',
(tester) async {
diff --git a/frontend/appflowy_flutter/integration_test/open_ai_smart_menu_test.dart b/frontend/appflowy_flutter/integration_test/open_ai_smart_menu_test.dart
index c8352d660f..969f9ec60b 100644
--- a/frontend/appflowy_flutter/integration_test/open_ai_smart_menu_test.dart
+++ b/frontend/appflowy_flutter/integration_test/open_ai_smart_menu_test.dart
@@ -15,8 +15,8 @@ void main() {
const service = TestWorkspaceService(TestWorkspace.aiWorkSpace);
group('integration tests for open-ai smart menu', () {
- setUpAll(() async => await service.setUpAll());
- setUp(() async => await service.setUp());
+ setUpAll(() async => service.setUpAll());
+ setUp(() async => service.setUp());
testWidgets('testing selection on open-ai smart menu replace',
(tester) async {
@@ -59,7 +59,7 @@ void main() {
editorState.service.selectionService.updateSelection(
Selection(
- start: Position(path: [1], offset: 0),
+ start: Position(path: [1]),
end: Position(path: [1], offset: 5),
),
);
@@ -80,8 +80,8 @@ void main() {
expect(
editorState.service.selectionService.currentSelection.value,
Selection(
- start: Position(path: [2], offset: 0),
- end: Position(path: [3], offset: 0),
+ start: Position(path: [2]),
+ end: Position(path: [3]),
),
);
});
@@ -99,7 +99,7 @@ Future<AppFlowyEditor> setUpOpenAITesting(WidgetTester tester) async {
final Finder editor = find.byType(AppFlowyEditor);
await tester.tap(editor);
await tester.pumpAndSettle();
- return (tester.state(editor).widget as AppFlowyEditor);
+ return tester.state(editor).widget as AppFlowyEditor;
}
Future<void> mockOpenAIRepository() async {
diff --git a/frontend/appflowy_flutter/integration_test/sidebar/sidebar_favorites_test.dart b/frontend/appflowy_flutter/integration_test/sidebar/sidebar_favorites_test.dart
index f7c676d1b1..81bee64689 100644
--- a/frontend/appflowy_flutter/integration_test/sidebar/sidebar_favorites_test.dart
+++ b/frontend/appflowy_flutter/integration_test/sidebar/sidebar_favorites_test.dart
@@ -1,7 +1,6 @@
import 'package:appflowy/workspace/application/sidebar/folder/folder_bloc.dart';
import 'package:appflowy/workspace/presentation/home/menu/sidebar/folder/favorite_folder.dart';
import 'package:appflowy/workspace/presentation/home/menu/view/view_item.dart';
-import 'package:appflowy_backend/protobuf/flowy-folder/view.pb.dart';
import 'package:appflowy_popover/appflowy_popover.dart';
import 'package:flowy_infra_ui/style_widget/hover.dart';
import 'package:flutter_test/flutter_test.dart';
@@ -34,14 +33,8 @@ void main() {
await tester.createNewPageWithNameUnderParent(
name: names[i],
parentName: parentName,
- layout: ViewLayoutPB.Document,
- );
- tester.expectToSeePageName(
- names[i],
- parentName: parentName,
- layout: ViewLayoutPB.Document,
- parentLayout: ViewLayoutPB.Document,
);
+ tester.expectToSeePageName(names[i], parentName: parentName);
}
await tester.favoriteViewByName(gettingStarted);
@@ -87,7 +80,6 @@ void main() {
await tester.favoriteViewByName(gettingStarted);
await tester.hoverOnPageName(
gettingStarted,
- layout: ViewLayoutPB.Document,
onHover: () async {
await tester.renamePage(name);
await tester.pumpAndSettle();
@@ -116,7 +108,6 @@ void main() {
await tester.createNewPageWithNameUnderParent(
name: names[i],
parentName: parentName,
- layout: ViewLayoutPB.Document,
);
tester.expectToSeePageName(names[i], parentName: parentName);
}
@@ -136,7 +127,6 @@ void main() {
await tester.hoverOnPageName(
names[1],
- layout: ViewLayoutPB.Document,
onHover: () async {
await tester.tapDeletePageButton();
await tester.pumpAndSettle();
@@ -150,7 +140,6 @@ void main() {
await tester.hoverOnPageName(
gettingStarted,
- layout: ViewLayoutPB.Document,
onHover: () async {
await tester.tapDeletePageButton();
await tester.pumpAndSettle();
@@ -194,7 +183,6 @@ void main() {
await tester.favoriteViewByName(gettingStarted);
await tester.hoverOnPageName(
gettingStarted,
- layout: ViewLayoutPB.Document,
useLast: false,
onHover: () async {
await tester.tapPageOptionButton();
diff --git a/frontend/appflowy_flutter/integration_test/sidebar/sidebar_test.dart b/frontend/appflowy_flutter/integration_test/sidebar/sidebar_test.dart
index d3d934f470..1da433559c 100644
--- a/frontend/appflowy_flutter/integration_test/sidebar/sidebar_test.dart
+++ b/frontend/appflowy_flutter/integration_test/sidebar/sidebar_test.dart
@@ -82,7 +82,6 @@ void main() {
await tester.createNewPageWithNameUnderParent(
name: names[i],
parentName: parentName,
- layout: ViewLayoutPB.Document,
);
tester.expectToSeePageName(names[i], parentName: parentName);
}
@@ -148,7 +147,7 @@ void main() {
name: document,
openAfterCreated: false,
);
- tester.expectToSeePageName(document, layout: ViewLayoutPB.Document);
+ tester.expectToSeePageName(document);
const grid = 'grid';
await tester.createNewPageWithNameUnderParent(
@@ -190,7 +189,6 @@ void main() {
await tester.createNewPageWithNameUnderParent(
name: grid,
layout: ViewLayoutPB.Grid,
- openAfterCreated: true,
);
tester.expectToSeePageName(grid, layout: ViewLayoutPB.Grid);
diff --git a/frontend/appflowy_flutter/integration_test/tabs_test.dart b/frontend/appflowy_flutter/integration_test/tabs_test.dart
index 5b0522412f..4c3d2fed16 100644
--- a/frontend/appflowy_flutter/integration_test/tabs_test.dart
+++ b/frontend/appflowy_flutter/integration_test/tabs_test.dart
@@ -32,15 +32,9 @@ void main() {
findsNothing,
);
- await tester.createNewPageWithNameUnderParent(
- name: _documentName,
- layout: ViewLayoutPB.Document,
- );
+ await tester.createNewPageWithNameUnderParent(name: _documentName);
- await tester.createNewPageWithNameUnderParent(
- name: _documentTwoName,
- layout: ViewLayoutPB.Document,
- );
+ await tester.createNewPageWithNameUnderParent(name: _documentTwoName);
/// Open second menu item in a new tab
await tester.openAppInNewTab(gettingStarted, ViewLayoutPB.Document);
diff --git a/frontend/appflowy_flutter/integration_test/util/base.dart b/frontend/appflowy_flutter/integration_test/util/base.dart
index e0d70533ff..b481059f17 100644
--- a/frontend/appflowy_flutter/integration_test/util/base.dart
+++ b/frontend/appflowy_flutter/integration_test/util/base.dart
@@ -129,7 +129,7 @@ extension AppFlowyTestBase on WidgetTester {
}
Future<void> waitForSeconds(int seconds) async {
- await Future.delayed((Duration(seconds: seconds)), () {});
+ await Future.delayed(Duration(seconds: seconds), () {});
}
Future<void> pumpUntilFound(
diff --git a/frontend/appflowy_flutter/integration_test/util/common_operations.dart b/frontend/appflowy_flutter/integration_test/util/common_operations.dart
index 1ae7b93aa5..c1bd100dd0 100644
--- a/frontend/appflowy_flutter/integration_test/util/common_operations.dart
+++ b/frontend/appflowy_flutter/integration_test/util/common_operations.dart
@@ -397,7 +397,6 @@ extension CommonOperations on WidgetTester {
await hoverOnPageName(
name,
layout: layout,
- useLast: true,
onHover: () async {
await tapFavoritePageButton();
await pumpAndSettle();
@@ -412,7 +411,6 @@ extension CommonOperations on WidgetTester {
await hoverOnPageName(
name,
layout: layout,
- useLast: true,
onHover: () async {
await tapUnfavoritePageButton();
await pumpAndSettle();
diff --git a/frontend/appflowy_flutter/integration_test/util/database_test_op.dart b/frontend/appflowy_flutter/integration_test/util/database_test_op.dart
index 1103bc2860..09a7769530 100644
--- a/frontend/appflowy_flutter/integration_test/util/database_test_op.dart
+++ b/frontend/appflowy_flutter/integration_test/util/database_test_op.dart
@@ -205,7 +205,7 @@ extension AppFlowyDatabaseTest on WidgetTester {
}) async {
final cell = cellFinder(rowIndex, fieldType);
expect(cell, findsOneWidget);
- await tapButton(cell, warnIfMissed: false);
+ await tapButton(cell);
}
/// The [fieldName] must be unique in the grid.
@@ -1110,7 +1110,7 @@ extension AppFlowyDatabaseTest on WidgetTester {
skipOffstage: false,
);
expect(findCell, findsOneWidget);
- await tapButton(findCell, warnIfMissed: false);
+ await tapButton(findCell);
}
Future<void> tapCheckedButtonOnCheckboxFilter() async {
diff --git a/frontend/appflowy_flutter/integration_test/util/ime.dart b/frontend/appflowy_flutter/integration_test/util/ime.dart
index 963caf9779..e2b0a754b5 100644
--- a/frontend/appflowy_flutter/integration_test/util/ime.dart
+++ b/frontend/appflowy_flutter/integration_test/util/ime.dart
@@ -34,7 +34,6 @@ class IMESimulator {
selection: TextSelection.collapsed(
offset: value.selection.baseOffset + 1,
),
- composing: TextRange.empty,
);
client.updateEditingValue(textEditingValue);
await tester.pumpAndSettle();
diff --git a/frontend/appflowy_flutter/lib/core/frameless_window.dart b/frontend/appflowy_flutter/lib/core/frameless_window.dart
index a9f103850a..82101de607 100644
--- a/frontend/appflowy_flutter/lib/core/frameless_window.dart
+++ b/frontend/appflowy_flutter/lib/core/frameless_window.dart
@@ -41,7 +41,7 @@ class MoveWindowDetectorState extends State<MoveWindowDetector> {
@override
Widget build(BuildContext context) {
if (!Platform.isMacOS) {
- return widget.child ?? Container();
+ return widget.child ?? const SizedBox.shrink();
}
return GestureDetector(
// https://stackoverflow.com/questions/52965799/flutter-gesturedetector-not-working-with-containers-in-stack
diff --git a/frontend/appflowy_flutter/lib/core/network_monitor.dart b/frontend/appflowy_flutter/lib/core/network_monitor.dart
index 33939a641a..a43682fccc 100644
--- a/frontend/appflowy_flutter/lib/core/network_monitor.dart
+++ b/frontend/appflowy_flutter/lib/core/network_monitor.dart
@@ -7,21 +7,21 @@ import 'package:appflowy_backend/dispatch/dispatch.dart';
import 'package:flutter/services.dart';
class NetworkListener {
- final Connectivity _connectivity = Connectivity();
- late StreamSubscription<ConnectivityResult> _connectivitySubscription;
-
NetworkListener() {
_connectivitySubscription =
_connectivity.onConnectivityChanged.listen(_updateConnectionStatus);
}
+ final Connectivity _connectivity = Connectivity();
+ late StreamSubscription<ConnectivityResult> _connectivitySubscription;
+
Future<void> start() async {
late ConnectivityResult result;
// Platform messages may fail, so we use a try/catch PlatformException.
try {
result = await _connectivity.checkConnectivity();
} on PlatformException catch (e) {
- Log.error('Couldn\'t check connectivity status. $e');
+ Log.error("Couldn't check connectivity status. $e");
return;
}
return _updateConnectionStatus(result);
diff --git a/frontend/appflowy_flutter/lib/core/notification/folder_notification.dart b/frontend/appflowy_flutter/lib/core/notification/folder_notification.dart
index 8ee7667394..66db7a966c 100644
--- a/frontend/appflowy_flutter/lib/core/notification/folder_notification.dart
+++ b/frontend/appflowy_flutter/lib/core/notification/folder_notification.dart
@@ -31,9 +31,6 @@ typedef FolderNotificationHandler = Function(
);
class FolderNotificationListener {
- StreamSubscription<SubscribeObject>? _subscription;
- FolderNotificationParser? _parser;
-
FolderNotificationListener({
required String objectId,
required FolderNotificationHandler handler,
@@ -45,6 +42,9 @@ class FolderNotificationListener {
RustStreamReceiver.listen((observable) => _parser?.parse(observable));
}
+ FolderNotificationParser? _parser;
+ StreamSubscription<SubscribeObject>? _subscription;
+
Future<void> stop() async {
_parser = null;
await _subscription?.cancel();
diff --git a/frontend/appflowy_flutter/lib/core/notification/grid_notification.dart b/frontend/appflowy_flutter/lib/core/notification/grid_notification.dart
index cf4c01ffa0..6a0f5d8bcd 100644
--- a/frontend/appflowy_flutter/lib/core/notification/grid_notification.dart
+++ b/frontend/appflowy_flutter/lib/core/notification/grid_notification.dart
@@ -31,9 +31,6 @@ typedef DatabaseNotificationHandler = Function(
);
class DatabaseNotificationListener {
- StreamSubscription<SubscribeObject>? _subscription;
- DatabaseNotificationParser? _parser;
-
DatabaseNotificationListener({
required String objectId,
required DatabaseNotificationHandler handler,
@@ -42,6 +39,9 @@ class DatabaseNotificationListener {
RustStreamReceiver.listen((observable) => _parser?.parse(observable));
}
+ DatabaseNotificationParser? _parser;
+ StreamSubscription<SubscribeObject>? _subscription;
+
Future<void> stop() async {
_parser = null;
await _subscription?.cancel();
diff --git a/frontend/appflowy_flutter/lib/core/notification/notification_helper.dart b/frontend/appflowy_flutter/lib/core/notification/notification_helper.dart
index 4869fb14d4..4bd988b015 100644
--- a/frontend/appflowy_flutter/lib/core/notification/notification_helper.dart
+++ b/frontend/appflowy_flutter/lib/core/notification/notification_helper.dart
@@ -3,18 +3,18 @@ import 'package:appflowy_backend/protobuf/flowy-notification/protobuf.dart';
import 'package:dartz/dartz.dart';
class NotificationParser<T, E> {
- String? id;
- void Function(T, Either<Uint8List, E>) callback;
-
- T? Function(int) tyParser;
- E Function(Uint8List) errorParser;
-
NotificationParser({
this.id,
required this.callback,
required this.errorParser,
required this.tyParser,
});
+
+ String? id;
+ void Function(T, Either<Uint8List, E>) callback;
+ E Function(Uint8List) errorParser;
+ T? Function(int) tyParser;
+
void parse(SubscribeObject subject) {
if (id != null) {
if (subject.id != id) {
diff --git a/frontend/appflowy_flutter/lib/core/notification/user_notification.dart b/frontend/appflowy_flutter/lib/core/notification/user_notification.dart
index 35d7b3220b..eca76f0eeb 100644
--- a/frontend/appflowy_flutter/lib/core/notification/user_notification.dart
+++ b/frontend/appflowy_flutter/lib/core/notification/user_notification.dart
@@ -31,9 +31,6 @@ typedef UserNotificationHandler = Function(
);
class UserNotificationListener {
- StreamSubscription<SubscribeObject>? _subscription;
- UserNotificationParser? _parser;
-
UserNotificationListener({
required String objectId,
required UserNotificationHandler handler,
@@ -42,6 +39,9 @@ class UserNotificationListener {
RustStreamReceiver.listen((observable) => _parser?.parse(observable));
}
+ UserNotificationParser? _parser;
+ StreamSubscription<SubscribeObject>? _subscription;
+
Future<void> stop() async {
_parser = null;
await _subscription?.cancel();
diff --git a/frontend/appflowy_flutter/lib/env/backend_env.dart b/frontend/appflowy_flutter/lib/env/backend_env.dart
index 7aa6b91c46..a4df1816f0 100644
--- a/frontend/appflowy_flutter/lib/env/backend_env.dart
+++ b/frontend/appflowy_flutter/lib/env/backend_env.dart
@@ -5,15 +5,6 @@ part 'backend_env.g.dart';
@JsonSerializable()
class AppFlowyConfiguration {
- final String root;
- final String custom_app_path;
- final String origin_app_path;
- final String device_id;
- final int authenticator_type;
- final SupabaseConfiguration supabase_config;
- final AppFlowyCloudConfiguration appflowy_cloud_config;
- final Map<String, String> envs;
-
AppFlowyConfiguration({
required this.root,
required this.custom_app_path,
@@ -28,15 +19,20 @@ class AppFlowyConfiguration {
factory AppFlowyConfiguration.fromJson(Map<String, dynamic> json) =>
_$AppFlowyConfigurationFromJson(json);
+ final String root;
+ final String custom_app_path;
+ final String origin_app_path;
+ final String device_id;
+ final int authenticator_type;
+ final SupabaseConfiguration supabase_config;
+ final AppFlowyCloudConfiguration appflowy_cloud_config;
+ final Map<String, String> envs;
+
Map<String, dynamic> toJson() => _$AppFlowyConfigurationToJson(this);
}
@JsonSerializable()
class SupabaseConfiguration {
- /// Indicates whether the sync feature is enabled.
- final String url;
- final String anon_key;
-
SupabaseConfiguration({
required this.url,
required this.anon_key,
@@ -45,6 +41,10 @@ class SupabaseConfiguration {
factory SupabaseConfiguration.fromJson(Map<String, dynamic> json) =>
_$SupabaseConfigurationFromJson(json);
+ /// Indicates whether the sync feature is enabled.
+ final String url;
+ final String anon_key;
+
Map<String, dynamic> toJson() => _$SupabaseConfigurationToJson(this);
static SupabaseConfiguration defaultConfig() {
@@ -61,10 +61,6 @@ class SupabaseConfiguration {
@JsonSerializable()
class AppFlowyCloudConfiguration {
- final String base_url;
- final String ws_base_url;
- final String gotrue_url;
-
AppFlowyCloudConfiguration({
required this.base_url,
required this.ws_base_url,
@@ -74,6 +70,10 @@ class AppFlowyCloudConfiguration {
factory AppFlowyCloudConfiguration.fromJson(Map<String, dynamic> json) =>
_$AppFlowyCloudConfigurationFromJson(json);
+ final String base_url;
+ final String ws_base_url;
+ final String gotrue_url;
+
Map<String, dynamic> toJson() => _$AppFlowyCloudConfigurationToJson(this);
static AppFlowyCloudConfiguration defaultConfig() {
diff --git a/frontend/appflowy_flutter/lib/env/cloud_env.dart b/frontend/appflowy_flutter/lib/env/cloud_env.dart
index b62e898c57..67aecbfd08 100644
--- a/frontend/appflowy_flutter/lib/env/cloud_env.dart
+++ b/frontend/appflowy_flutter/lib/env/cloud_env.dart
@@ -180,16 +180,16 @@ Future<void> setAppFlowyCloudUrl(Option<String> url) async {
/// Use getIt<AppFlowyCloudSharedEnv>() to get the shared environment.
class AppFlowyCloudSharedEnv {
- final AuthenticatorType _authenticatorType;
- final AppFlowyCloudConfiguration appflowyCloudConfig;
- final SupabaseConfiguration supabaseConfig;
-
AppFlowyCloudSharedEnv({
required AuthenticatorType authenticatorType,
required this.appflowyCloudConfig,
required this.supabaseConfig,
}) : _authenticatorType = authenticatorType;
+ final AuthenticatorType _authenticatorType;
+ final AppFlowyCloudConfiguration appflowyCloudConfig;
+ final SupabaseConfiguration supabaseConfig;
+
AuthenticatorType get authenticatorType => _authenticatorType;
static Future<AppFlowyCloudSharedEnv> fromEnv() async {
diff --git a/frontend/appflowy_flutter/lib/mobile/presentation/base/app_bar_actions.dart b/frontend/appflowy_flutter/lib/mobile/presentation/base/app_bar_actions.dart
index cb2daf609b..7bdaa85878 100644
--- a/frontend/appflowy_flutter/lib/mobile/presentation/base/app_bar_actions.dart
+++ b/frontend/appflowy_flutter/lib/mobile/presentation/base/app_bar_actions.dart
@@ -102,7 +102,6 @@ class AppBarButton extends StatelessWidget {
@override
Widget build(BuildContext context) {
return InkWell(
- enableFeedback: true,
borderRadius: BorderRadius.circular(28),
splashColor: Colors.transparent,
focusColor: Colors.transparent,
diff --git a/frontend/appflowy_flutter/lib/mobile/presentation/bottom_sheet/bottom_sheet_header.dart b/frontend/appflowy_flutter/lib/mobile/presentation/bottom_sheet/bottom_sheet_header.dart
index e5bb5d507c..d670ccf7af 100644
--- a/frontend/appflowy_flutter/lib/mobile/presentation/bottom_sheet/bottom_sheet_header.dart
+++ b/frontend/appflowy_flutter/lib/mobile/presentation/bottom_sheet/bottom_sheet_header.dart
@@ -34,7 +34,6 @@ class BottomSheetHeader extends StatelessWidget {
),
if (title != null)
Align(
- alignment: Alignment.center,
child: FlowyText.medium(
title!,
fontSize: 16,
diff --git a/frontend/appflowy_flutter/lib/mobile/presentation/bottom_sheet/bottom_sheet_view_item_body.dart b/frontend/appflowy_flutter/lib/mobile/presentation/bottom_sheet/bottom_sheet_view_item_body.dart
index 5a4806796c..7f5fda6127 100644
--- a/frontend/appflowy_flutter/lib/mobile/presentation/bottom_sheet/bottom_sheet_view_item_body.dart
+++ b/frontend/appflowy_flutter/lib/mobile/presentation/bottom_sheet/bottom_sheet_view_item_body.dart
@@ -31,7 +31,6 @@ class MobileViewItemBottomSheetBody extends StatelessWidget {
children: [
// rename, duplicate
Row(
- mainAxisSize: MainAxisSize.max,
children: [
Expanded(
child: BottomSheetActionWidget(
@@ -58,7 +57,6 @@ class MobileViewItemBottomSheetBody extends StatelessWidget {
// share, delete
Row(
- mainAxisSize: MainAxisSize.max,
children: [
Expanded(
child: BottomSheetActionWidget(
diff --git a/frontend/appflowy_flutter/lib/mobile/presentation/bottom_sheet/bottom_sheet_view_page.dart b/frontend/appflowy_flutter/lib/mobile/presentation/bottom_sheet/bottom_sheet_view_page.dart
index a5995e1e52..67a123e9d0 100644
--- a/frontend/appflowy_flutter/lib/mobile/presentation/bottom_sheet/bottom_sheet_view_page.dart
+++ b/frontend/appflowy_flutter/lib/mobile/presentation/bottom_sheet/bottom_sheet_view_page.dart
@@ -119,7 +119,6 @@ class MobileViewBottomSheetBody extends StatelessWidget {
children: [
// rename, duplicate
Row(
- mainAxisSize: MainAxisSize.max,
children: [
Expanded(
child: BottomSheetActionWidget(
@@ -146,7 +145,6 @@ class MobileViewBottomSheetBody extends StatelessWidget {
// share, delete
Row(
- mainAxisSize: MainAxisSize.max,
children: [
Expanded(
child: BottomSheetActionWidget(
diff --git a/frontend/appflowy_flutter/lib/mobile/presentation/database/board/mobile_board_screen.dart b/frontend/appflowy_flutter/lib/mobile/presentation/database/board/mobile_board_screen.dart
index 45633296ba..492a8cb347 100644
--- a/frontend/appflowy_flutter/lib/mobile/presentation/database/board/mobile_board_screen.dart
+++ b/frontend/appflowy_flutter/lib/mobile/presentation/database/board/mobile_board_screen.dart
@@ -3,10 +3,6 @@ import 'package:appflowy_backend/protobuf/flowy-folder/view.pb.dart';
import 'package:flutter/material.dart';
class MobileBoardScreen extends StatelessWidget {
- static const routeName = '/board';
- static const viewId = 'id';
- static const viewTitle = 'title';
-
const MobileBoardScreen({
super.key,
required this.id,
@@ -17,6 +13,10 @@ class MobileBoardScreen extends StatelessWidget {
final String id;
final String? title;
+ static const routeName = '/board';
+ static const viewId = 'id';
+ static const viewTitle = 'title';
+
@override
Widget build(BuildContext context) {
return MobileViewPage(
diff --git a/frontend/appflowy_flutter/lib/mobile/presentation/database/board/widgets/group_card_header.dart b/frontend/appflowy_flutter/lib/mobile/presentation/database/board/widgets/group_card_header.dart
index 5cbe7fbcc2..77d8c194ca 100644
--- a/frontend/appflowy_flutter/lib/mobile/presentation/database/board/widgets/group_card_header.dart
+++ b/frontend/appflowy_flutter/lib/mobile/presentation/database/board/widgets/group_card_header.dart
@@ -82,7 +82,6 @@ class _GroupCardHeaderState extends State<GroupCardHeader> {
_controller.text,
),
),
- maxLines: 1,
style: titleTextStyle,
onTapOutside: (_) => context.read<BoardBloc>().add(
// group header switch from TextField to Text
diff --git a/frontend/appflowy_flutter/lib/mobile/presentation/database/card/card_detail/mobile_card_detail_screen.dart b/frontend/appflowy_flutter/lib/mobile/presentation/database/card/card_detail/mobile_card_detail_screen.dart
index 7c7adda619..672e8e31f6 100644
--- a/frontend/appflowy_flutter/lib/mobile/presentation/database/card/card_detail/mobile_card_detail_screen.dart
+++ b/frontend/appflowy_flutter/lib/mobile/presentation/database/card/card_detail/mobile_card_detail_screen.dart
@@ -233,7 +233,6 @@ class RowDetailFab extends StatelessWidget {
BoxShadow(
offset: Offset(0, 8),
blurRadius: 20,
- spreadRadius: 0,
color: Color(0x191F2329),
),
],
diff --git a/frontend/appflowy_flutter/lib/mobile/presentation/database/card/card_detail/widgets/mobile_create_field_button.dart b/frontend/appflowy_flutter/lib/mobile/presentation/database/card/card_detail/widgets/mobile_create_field_button.dart
index 26bb01777b..c2892e97de 100644
--- a/frontend/appflowy_flutter/lib/mobile/presentation/database/card/card_detail/widgets/mobile_create_field_button.dart
+++ b/frontend/appflowy_flutter/lib/mobile/presentation/database/card/card_detail/widgets/mobile_create_field_button.dart
@@ -25,7 +25,6 @@ class MobileRowDetailCreateFieldButton extends StatelessWidget {
shape: MaterialStateProperty.all<RoundedRectangleBorder>(
RoundedRectangleBorder(
borderRadius: BorderRadius.circular(12.0),
- side: BorderSide.none,
),
),
overlayColor: MaterialStateProperty.all<Color>(
diff --git a/frontend/appflowy_flutter/lib/mobile/presentation/database/date_picker/mobile_date_picker_screen.dart b/frontend/appflowy_flutter/lib/mobile/presentation/database/date_picker/mobile_date_picker_screen.dart
index bf5193d8f4..879c731952 100644
--- a/frontend/appflowy_flutter/lib/mobile/presentation/database/date_picker/mobile_date_picker_screen.dart
+++ b/frontend/appflowy_flutter/lib/mobile/presentation/database/date_picker/mobile_date_picker_screen.dart
@@ -14,14 +14,6 @@ import 'package:flowy_infra_ui/flowy_infra_ui.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
class MobileDateCellEditScreen extends StatefulWidget {
- static const routeName = '/edit_date_cell';
-
- // the type is DateCellController
- static const dateCellController = 'date_cell_controller';
-
- // bool value, default is true
- static const fullScreen = 'full_screen';
-
const MobileDateCellEditScreen({
super.key,
required this.controller,
@@ -31,6 +23,14 @@ class MobileDateCellEditScreen extends StatefulWidget {
final DateCellController controller;
final bool showAsFullScreen;
+ static const routeName = '/edit_date_cell';
+
+ // the type is DateCellController
+ static const dateCellController = 'date_cell_controller';
+
+ // bool value, default is true
+ static const fullScreen = 'full_screen';
+
@override
State<MobileDateCellEditScreen> createState() =>
_MobileDateCellEditScreenState();
diff --git a/frontend/appflowy_flutter/lib/mobile/presentation/database/field/mobile_create_field_screen.dart b/frontend/appflowy_flutter/lib/mobile/presentation/database/field/mobile_create_field_screen.dart
index 44bdf1f509..770ff052e5 100644
--- a/frontend/appflowy_flutter/lib/mobile/presentation/database/field/mobile_create_field_screen.dart
+++ b/frontend/appflowy_flutter/lib/mobile/presentation/database/field/mobile_create_field_screen.dart
@@ -9,10 +9,6 @@ import 'package:flutter/material.dart';
import 'package:go_router/go_router.dart';
class MobileNewPropertyScreen extends StatefulWidget {
- static const routeName = '/new_property';
- static const argViewId = 'view_id';
- static const argFieldTypeId = 'field_type_id';
-
const MobileNewPropertyScreen({
super.key,
required this.viewId,
@@ -22,6 +18,10 @@ class MobileNewPropertyScreen extends StatefulWidget {
final String viewId;
final FieldType? fieldType;
+ static const routeName = '/new_property';
+ static const argViewId = 'view_id';
+ static const argFieldTypeId = 'field_type_id';
+
@override
State<MobileNewPropertyScreen> createState() =>
_MobileNewPropertyScreenState();
@@ -92,7 +92,6 @@ class _SaveButton extends StatelessWidget {
return Padding(
padding: const EdgeInsets.only(right: 16.0),
child: Align(
- alignment: Alignment.center,
child: GestureDetector(
onTap: onSave,
child: FlowyText.medium(
diff --git a/frontend/appflowy_flutter/lib/mobile/presentation/database/field/mobile_edit_field_screen.dart b/frontend/appflowy_flutter/lib/mobile/presentation/database/field/mobile_edit_field_screen.dart
index cf7dde0439..781fa65bca 100644
--- a/frontend/appflowy_flutter/lib/mobile/presentation/database/field/mobile_edit_field_screen.dart
+++ b/frontend/appflowy_flutter/lib/mobile/presentation/database/field/mobile_edit_field_screen.dart
@@ -12,10 +12,6 @@ import 'package:flowy_infra_ui/flowy_infra_ui.dart';
import 'package:go_router/go_router.dart';
class MobileEditPropertyScreen extends StatefulWidget {
- static const routeName = '/edit_property';
- static const argViewId = 'view_id';
- static const argField = 'field';
-
const MobileEditPropertyScreen({
super.key,
required this.viewId,
@@ -25,6 +21,10 @@ class MobileEditPropertyScreen extends StatefulWidget {
final String viewId;
final FieldInfo field;
+ static const routeName = '/edit_property';
+ static const argViewId = 'view_id';
+ static const argField = 'field';
+
@override
State<MobileEditPropertyScreen> createState() =>
_MobileEditPropertyScreenState();
diff --git a/frontend/appflowy_flutter/lib/mobile/presentation/database/field/mobile_field_type_grid.dart b/frontend/appflowy_flutter/lib/mobile/presentation/database/field/mobile_field_type_grid.dart
index a95030cdd1..ad9fe21302 100644
--- a/frontend/appflowy_flutter/lib/mobile/presentation/database/field/mobile_field_type_grid.dart
+++ b/frontend/appflowy_flutter/lib/mobile/presentation/database/field/mobile_field_type_grid.dart
@@ -72,7 +72,6 @@ class _FieldHeader extends StatelessWidget {
return SizedBox(
height: 56,
child: Row(
- crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
SizedBox(
diff --git a/frontend/appflowy_flutter/lib/mobile/presentation/database/field/mobile_field_type_option_editor.dart b/frontend/appflowy_flutter/lib/mobile/presentation/database/field/mobile_field_type_option_editor.dart
index 47ba1d8a9d..079f972afa 100644
--- a/frontend/appflowy_flutter/lib/mobile/presentation/database/field/mobile_field_type_option_editor.dart
+++ b/frontend/appflowy_flutter/lib/mobile/presentation/database/field/mobile_field_type_option_editor.dart
@@ -39,6 +39,31 @@ class FieldOptionValues {
this.selectOption = const [],
});
+ factory FieldOptionValues.fromField({required FieldPB field}) {
+ final fieldType = field.fieldType;
+ final buffer = field.typeOptionData;
+ return FieldOptionValues(
+ type: fieldType,
+ name: field.name,
+ numberFormat: fieldType == FieldType.Number
+ ? NumberTypeOptionPB.fromBuffer(buffer).format
+ : null,
+ dateFormate: fieldType == FieldType.DateTime
+ ? DateTypeOptionPB.fromBuffer(buffer).dateFormat
+ : null,
+ timeFormat: fieldType == FieldType.DateTime
+ ? DateTypeOptionPB.fromBuffer(buffer).timeFormat
+ : null,
+ selectOption: switch (fieldType) {
+ FieldType.SingleSelect =>
+ SingleSelectTypeOptionPB.fromBuffer(buffer).options,
+ FieldType.MultiSelect =>
+ MultiSelectTypeOptionPB.fromBuffer(buffer).options,
+ _ => [],
+ },
+ );
+ }
+
FieldType type;
String name;
@@ -95,33 +120,6 @@ class FieldOptionValues {
throw UnimplementedError();
}
}
-
- factory FieldOptionValues.fromField({
- required FieldPB field,
- }) {
- final fieldType = field.fieldType;
- final buffer = field.typeOptionData;
- return FieldOptionValues(
- type: fieldType,
- name: field.name,
- numberFormat: fieldType == FieldType.Number
- ? NumberTypeOptionPB.fromBuffer(buffer).format
- : null,
- dateFormate: fieldType == FieldType.DateTime
- ? DateTypeOptionPB.fromBuffer(buffer).dateFormat
- : null,
- timeFormat: fieldType == FieldType.DateTime
- ? DateTypeOptionPB.fromBuffer(buffer).timeFormat
- : null,
- selectOption: switch (fieldType) {
- FieldType.SingleSelect =>
- SingleSelectTypeOptionPB.fromBuffer(buffer).options,
- FieldType.MultiSelect =>
- MultiSelectTypeOptionPB.fromBuffer(buffer).options,
- _ => [],
- },
- );
- }
}
enum FieldOptionAction {
@@ -365,7 +363,6 @@ class _PropertyType extends StatelessWidget {
return FlowyOptionTile.text(
text: LocaleKeys.grid_field_propertyType.tr(),
trailing: Row(
- crossAxisAlignment: CrossAxisAlignment.center,
children: [
FlowySvg(
type.smallSvgData,
@@ -542,7 +539,6 @@ class _NumberOption extends StatelessWidget {
return FlowyOptionTile.text(
text: LocaleKeys.grid_field_numberFormat.tr(),
trailing: Row(
- crossAxisAlignment: CrossAxisAlignment.center,
children: [
FlowyText(
selectedFormat.title(),
@@ -773,10 +769,6 @@ class __SelectOptionTileState extends State<_SelectOptionTile> {
textFieldHintText: LocaleKeys.grid_field_typeANewOption.tr(),
showTopBorder: widget.showTopBorder,
showBottomBorder: widget.showBottomBorder,
- textFieldPadding: const EdgeInsets.symmetric(
- horizontal: 0.0,
- vertical: 16.0,
- ),
trailing: _SelectOptionColor(
color: option.color,
onChanged: (color) {
diff --git a/frontend/appflowy_flutter/lib/mobile/presentation/database/mobile_calendar_events_screen.dart b/frontend/appflowy_flutter/lib/mobile/presentation/database/mobile_calendar_events_screen.dart
index 565a6b2719..345fda5991 100644
--- a/frontend/appflowy_flutter/lib/mobile/presentation/database/mobile_calendar_events_screen.dart
+++ b/frontend/appflowy_flutter/lib/mobile/presentation/database/mobile_calendar_events_screen.dart
@@ -11,15 +11,6 @@ import 'package:flowy_infra_ui/widget/spacing.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
class MobileCalendarEventsScreen extends StatefulWidget {
- static const routeName = '/calendar_events';
-
- // GoRouter Arguments
- static const calendarBlocKey = 'calendar_bloc';
- static const calendarDateKey = 'date';
- static const calendarEventsKey = 'events';
- static const calendarRowCacheKey = 'row_cache';
- static const calendarViewIdKey = 'view_id';
-
const MobileCalendarEventsScreen({
super.key,
required this.calendarBloc,
@@ -35,6 +26,15 @@ class MobileCalendarEventsScreen extends StatefulWidget {
final RowCache rowCache;
final String viewId;
+ static const routeName = '/calendar_events';
+
+ // GoRouter Arguments
+ static const calendarBlocKey = 'calendar_bloc';
+ static const calendarDateKey = 'date';
+ static const calendarEventsKey = 'events';
+ static const calendarRowCacheKey = 'row_cache';
+ static const calendarViewIdKey = 'view_id';
+
@override
State<MobileCalendarEventsScreen> createState() =>
_MobileCalendarEventsScreenState();
diff --git a/frontend/appflowy_flutter/lib/mobile/presentation/database/mobile_calendar_screen.dart b/frontend/appflowy_flutter/lib/mobile/presentation/database/mobile_calendar_screen.dart
index bf0718e153..ec87b5c9bd 100644
--- a/frontend/appflowy_flutter/lib/mobile/presentation/database/mobile_calendar_screen.dart
+++ b/frontend/appflowy_flutter/lib/mobile/presentation/database/mobile_calendar_screen.dart
@@ -3,10 +3,6 @@ import 'package:appflowy_backend/protobuf/flowy-folder/view.pb.dart';
import 'package:flutter/material.dart';
class MobileCalendarScreen extends StatelessWidget {
- static const routeName = '/calendar';
- static const viewId = 'id';
- static const viewTitle = 'title';
-
const MobileCalendarScreen({
super.key,
required this.id,
@@ -17,6 +13,10 @@ class MobileCalendarScreen extends StatelessWidget {
final String id;
final String? title;
+ static const routeName = '/calendar';
+ static const viewId = 'id';
+ static const viewTitle = 'title';
+
@override
Widget build(BuildContext context) {
return MobileViewPage(
diff --git a/frontend/appflowy_flutter/lib/mobile/presentation/database/mobile_grid_screen.dart b/frontend/appflowy_flutter/lib/mobile/presentation/database/mobile_grid_screen.dart
index b8f29ed134..18c1f8f4d9 100644
--- a/frontend/appflowy_flutter/lib/mobile/presentation/database/mobile_grid_screen.dart
+++ b/frontend/appflowy_flutter/lib/mobile/presentation/database/mobile_grid_screen.dart
@@ -4,11 +4,6 @@ import 'package:appflowy/mobile/presentation/base/mobile_view_page.dart';
import 'package:appflowy_backend/protobuf/flowy-folder/view.pb.dart';
class MobileGridScreen extends StatelessWidget {
- static const routeName = '/grid';
- static const viewId = 'id';
- static const viewTitle = 'title';
- static const viewArgs = 'arguments';
-
const MobileGridScreen({
super.key,
required this.id,
@@ -21,6 +16,11 @@ class MobileGridScreen extends StatelessWidget {
final String? title;
final Map<String, dynamic>? arguments;
+ static const routeName = '/grid';
+ static const viewId = 'id';
+ static const viewTitle = 'title';
+ static const viewArgs = 'arguments';
+
@override
Widget build(BuildContext context) {
return MobileViewPage(
diff --git a/frontend/appflowy_flutter/lib/mobile/presentation/database/view/database_field_list.dart b/frontend/appflowy_flutter/lib/mobile/presentation/database/view/database_field_list.dart
index 4b26475e8e..6451b72951 100644
--- a/frontend/appflowy_flutter/lib/mobile/presentation/database/view/database_field_list.dart
+++ b/frontend/appflowy_flutter/lib/mobile/presentation/database/view/database_field_list.dart
@@ -74,13 +74,10 @@ class _MobileDatabaseFieldListHeader extends StatelessWidget {
FlowySvgs.arrow_left_m,
size: Size.square(iconWidth),
),
- width: iconWidth,
- iconPadding: EdgeInsets.zero,
onPressed: () => Navigator.of(context).maybePop(),
),
),
Align(
- alignment: Alignment.center,
child: FlowyText.medium(
LocaleKeys.grid_settings_properties.tr(),
fontSize: 16,
@@ -160,7 +157,6 @@ class _MobileDatabaseFieldListBody extends StatelessWidget {
},
);
},
- buildDefaultDragHandles: true,
shrinkWrap: true,
onReorder: (from, to) {
from++;
diff --git a/frontend/appflowy_flutter/lib/mobile/presentation/database/view/database_view_list.dart b/frontend/appflowy_flutter/lib/mobile/presentation/database/view/database_view_list.dart
index cefdcd3a8d..278a521261 100644
--- a/frontend/appflowy_flutter/lib/mobile/presentation/database/view/database_view_list.dart
+++ b/frontend/appflowy_flutter/lib/mobile/presentation/database/view/database_view_list.dart
@@ -67,13 +67,10 @@ class _Header extends StatelessWidget {
FlowySvgs.close_s,
size: Size.square(iconWidth),
),
- width: iconWidth,
- iconPadding: EdgeInsets.zero,
onPressed: () => context.pop(),
),
),
Align(
- alignment: Alignment.center,
child: FlowyText.medium(
LocaleKeys.grid_settings_viewList.tr(),
fontSize: 16,
diff --git a/frontend/appflowy_flutter/lib/mobile/presentation/database/view/edit_database_view_screen.dart b/frontend/appflowy_flutter/lib/mobile/presentation/database/view/edit_database_view_screen.dart
index f83164f3bd..2e5a944289 100644
--- a/frontend/appflowy_flutter/lib/mobile/presentation/database/view/edit_database_view_screen.dart
+++ b/frontend/appflowy_flutter/lib/mobile/presentation/database/view/edit_database_view_screen.dart
@@ -127,13 +127,10 @@ class _EditDatabaseViewHeader extends StatelessWidget {
FlowySvgs.close_s,
size: Size.square(iconWidth),
),
- width: iconWidth,
- iconPadding: EdgeInsets.zero,
onPressed: () => context.pop(),
),
),
Align(
- alignment: Alignment.center,
child: FlowyText.medium(
LocaleKeys.grid_settings_editView.tr(),
fontSize: 16,
diff --git a/frontend/appflowy_flutter/lib/mobile/presentation/editor/mobile_editor_screen.dart b/frontend/appflowy_flutter/lib/mobile/presentation/editor/mobile_editor_screen.dart
index 715d3e7256..fe482f57c4 100644
--- a/frontend/appflowy_flutter/lib/mobile/presentation/editor/mobile_editor_screen.dart
+++ b/frontend/appflowy_flutter/lib/mobile/presentation/editor/mobile_editor_screen.dart
@@ -3,10 +3,6 @@ import 'package:appflowy_backend/protobuf/flowy-folder/view.pb.dart';
import 'package:flutter/material.dart';
class MobileEditorScreen extends StatelessWidget {
- static const routeName = '/docs';
- static const viewId = 'id';
- static const viewTitle = 'title';
-
const MobileEditorScreen({
super.key,
required this.id,
@@ -17,6 +13,10 @@ class MobileEditorScreen extends StatelessWidget {
final String id;
final String? title;
+ static const routeName = '/docs';
+ static const viewId = 'id';
+ static const viewTitle = 'title';
+
@override
Widget build(BuildContext context) {
return MobileViewPage(
diff --git a/frontend/appflowy_flutter/lib/mobile/presentation/home/favorite_folder/mobile_home_favorite_folder_header.dart b/frontend/appflowy_flutter/lib/mobile/presentation/home/favorite_folder/mobile_home_favorite_folder_header.dart
index 997f6043ac..b5ae0ad1bd 100644
--- a/frontend/appflowy_flutter/lib/mobile/presentation/home/favorite_folder/mobile_home_favorite_folder_header.dart
+++ b/frontend/appflowy_flutter/lib/mobile/presentation/home/favorite_folder/mobile_home_favorite_folder_header.dart
@@ -27,7 +27,6 @@ class _MobileFavoriteFolderHeaderState
@override
Widget build(BuildContext context) {
return Row(
- crossAxisAlignment: CrossAxisAlignment.center,
children: [
Expanded(
child: FlowyButton(
diff --git a/frontend/appflowy_flutter/lib/mobile/presentation/home/mobile_home_page_header.dart b/frontend/appflowy_flutter/lib/mobile/presentation/home/mobile_home_page_header.dart
index 0bbae4e4eb..fcb5749b2c 100644
--- a/frontend/appflowy_flutter/lib/mobile/presentation/home/mobile_home_page_header.dart
+++ b/frontend/appflowy_flutter/lib/mobile/presentation/home/mobile_home_page_header.dart
@@ -34,7 +34,6 @@ class MobileHomePageHeader extends StatelessWidget {
const HSpace(12),
Expanded(
child: Column(
- mainAxisSize: MainAxisSize.max,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
const FlowyText.medium('AppFlowy', fontSize: 18),
diff --git a/frontend/appflowy_flutter/lib/mobile/presentation/home/mobile_home_setting_page.dart b/frontend/appflowy_flutter/lib/mobile/presentation/home/mobile_home_setting_page.dart
index c9fad0e7af..45d7ec8a23 100644
--- a/frontend/appflowy_flutter/lib/mobile/presentation/home/mobile_home_setting_page.dart
+++ b/frontend/appflowy_flutter/lib/mobile/presentation/home/mobile_home_setting_page.dart
@@ -28,7 +28,7 @@ class _MobileHomeSettingPageState extends State<MobileHomeSettingPage> {
Widget build(BuildContext context) {
return FutureBuilder(
future: getIt<AuthService>().getUser(),
- builder: ((context, snapshot) {
+ builder: (context, snapshot) {
String? errorMsg;
if (!snapshot.hasData) {
return const Center(child: CircularProgressIndicator.adaptive());
@@ -49,7 +49,7 @@ class _MobileHomeSettingPageState extends State<MobileHomeSettingPage> {
? _buildErrorWidget(errorMsg)
: _buildSettingsWidget(userProfile),
);
- }),
+ },
);
}
diff --git a/frontend/appflowy_flutter/lib/mobile/presentation/home/mobile_home_trash_page.dart b/frontend/appflowy_flutter/lib/mobile/presentation/home/mobile_home_trash_page.dart
index 946b6094b1..03f93db7c6 100644
--- a/frontend/appflowy_flutter/lib/mobile/presentation/home/mobile_home_trash_page.dart
+++ b/frontend/appflowy_flutter/lib/mobile/presentation/home/mobile_home_trash_page.dart
@@ -44,7 +44,6 @@ class MobileHomeTrashPage extends StatelessWidget {
Expanded(
child: _TrashActionAllButton(
trashBloc: trashBloc,
- type: _TrashActionType.deleteAll,
),
),
const SizedBox(
diff --git a/frontend/appflowy_flutter/lib/mobile/presentation/home/personal_folder/mobile_home_personal_folder.dart b/frontend/appflowy_flutter/lib/mobile/presentation/home/personal_folder/mobile_home_personal_folder.dart
index 2f4a8e0735..a5b04a7093 100644
--- a/frontend/appflowy_flutter/lib/mobile/presentation/home/personal_folder/mobile_home_personal_folder.dart
+++ b/frontend/appflowy_flutter/lib/mobile/presentation/home/personal_folder/mobile_home_personal_folder.dart
@@ -47,7 +47,6 @@ class MobilePersonalFolder extends StatelessWidget {
key: ValueKey(
'${FolderCategoryType.personal.name} ${view.id}',
),
- isDraggable: true,
categoryType: FolderCategoryType.personal,
isFirstChild: view.id == views.first.id,
view: view,
diff --git a/frontend/appflowy_flutter/lib/mobile/presentation/home/personal_folder/mobile_home_personal_folder_header.dart b/frontend/appflowy_flutter/lib/mobile/presentation/home/personal_folder/mobile_home_personal_folder_header.dart
index c8d4448fd3..91baaf4f68 100644
--- a/frontend/appflowy_flutter/lib/mobile/presentation/home/personal_folder/mobile_home_personal_folder_header.dart
+++ b/frontend/appflowy_flutter/lib/mobile/presentation/home/personal_folder/mobile_home_personal_folder_header.dart
@@ -31,7 +31,6 @@ class _MobilePersonalFolderHeaderState
Widget build(BuildContext context) {
const iconSize = 32.0;
return Row(
- crossAxisAlignment: CrossAxisAlignment.center,
children: [
Expanded(
child: FlowyButton(
diff --git a/frontend/appflowy_flutter/lib/mobile/presentation/home/recent_folder/mobile_recent_view.dart b/frontend/appflowy_flutter/lib/mobile/presentation/home/recent_folder/mobile_recent_view.dart
index e3bd929ead..b315cb5e52 100644
--- a/frontend/appflowy_flutter/lib/mobile/presentation/home/recent_folder/mobile_recent_view.dart
+++ b/frontend/appflowy_flutter/lib/mobile/presentation/home/recent_folder/mobile_recent_view.dart
@@ -142,7 +142,7 @@ class _MobileRecentViewState extends State<MobileRecentView> {
Widget _buildCoverWidget() {
return FutureBuilder<Node?>(
future: _getPageNode(),
- builder: ((context, snapshot) {
+ builder: (context, snapshot) {
final node = snapshot.data;
final placeholder = Container(
// random color, update it once we have a better placeholder
@@ -189,7 +189,7 @@ class _MobileRecentViewState extends State<MobileRecentView> {
case CoverType.none:
return placeholder;
}
- }),
+ },
);
}
diff --git a/frontend/appflowy_flutter/lib/mobile/presentation/page_item/mobile_view_item.dart b/frontend/appflowy_flutter/lib/mobile/presentation/page_item/mobile_view_item.dart
index 9f3b0fc324..9ef41ad0b7 100644
--- a/frontend/appflowy_flutter/lib/mobile/presentation/page_item/mobile_view_item.dart
+++ b/frontend/appflowy_flutter/lib/mobile/presentation/page_item/mobile_view_item.dart
@@ -323,7 +323,6 @@ class _SingleMobileInnerViewItemState extends State<SingleMobileInnerViewItem> {
Widget child = InkWell(
borderRadius: BorderRadius.circular(4.0),
- enableFeedback: true,
onTap: () => widget.onSelected(widget.view),
child: SizedBox(
height: _itemHeight,
diff --git a/frontend/appflowy_flutter/lib/mobile/presentation/setting/about/about_setting_group.dart b/frontend/appflowy_flutter/lib/mobile/presentation/setting/about/about_setting_group.dart
index de04e05c34..2c5c3fad3e 100644
--- a/frontend/appflowy_flutter/lib/mobile/presentation/setting/about/about_setting_group.dart
+++ b/frontend/appflowy_flutter/lib/mobile/presentation/setting/about/about_setting_group.dart
@@ -39,7 +39,6 @@ class AboutSettingGroup extends StatelessWidget {
),
),
],
- showDivider: true,
);
}
}
diff --git a/frontend/appflowy_flutter/lib/mobile/presentation/setting/font/font_picker_screen.dart b/frontend/appflowy_flutter/lib/mobile/presentation/setting/font/font_picker_screen.dart
index ae872bcde9..3b336034c4 100644
--- a/frontend/appflowy_flutter/lib/mobile/presentation/setting/font/font_picker_screen.dart
+++ b/frontend/appflowy_flutter/lib/mobile/presentation/setting/font/font_picker_screen.dart
@@ -12,11 +12,9 @@ import 'package:google_fonts/google_fonts.dart';
final List<String> _availableFonts = GoogleFonts.asMap().keys.toList();
class FontPickerScreen extends StatelessWidget {
- static const routeName = '/font_picker';
+ const FontPickerScreen({super.key});
- const FontPickerScreen({
- super.key,
- });
+ static const routeName = '/font_picker';
@override
Widget build(BuildContext context) {
diff --git a/frontend/appflowy_flutter/lib/mobile/presentation/setting/language/language_picker_screen.dart b/frontend/appflowy_flutter/lib/mobile/presentation/setting/language/language_picker_screen.dart
index 24ae103574..8dbd055727 100644
--- a/frontend/appflowy_flutter/lib/mobile/presentation/setting/language/language_picker_screen.dart
+++ b/frontend/appflowy_flutter/lib/mobile/presentation/setting/language/language_picker_screen.dart
@@ -7,16 +7,12 @@ import 'package:flutter/material.dart';
import 'package:go_router/go_router.dart';
class LanguagePickerScreen extends StatelessWidget {
- static const routeName = '/language_picker';
+ const LanguagePickerScreen({super.key});
- const LanguagePickerScreen({
- super.key,
- });
+ static const routeName = '/language_picker';
@override
- Widget build(BuildContext context) {
- return const LanguagePickerPage();
- }
+ Widget build(BuildContext context) => const LanguagePickerPage();
}
class LanguagePickerPage extends StatefulWidget {
diff --git a/frontend/appflowy_flutter/lib/mobile/presentation/setting/user_session_setting_group.dart b/frontend/appflowy_flutter/lib/mobile/presentation/setting/user_session_setting_group.dart
index 155971709b..ef165923ea 100644
--- a/frontend/appflowy_flutter/lib/mobile/presentation/setting/user_session_setting_group.dart
+++ b/frontend/appflowy_flutter/lib/mobile/presentation/setting/user_session_setting_group.dart
@@ -30,7 +30,7 @@ class UserSessionSettingGroup extends StatelessWidget {
() => null,
(result) => result.fold(
(l) {},
- (r) async => await runAppFlowy(),
+ (r) async => runAppFlowy(),
),
);
},
diff --git a/frontend/appflowy_flutter/lib/mobile/presentation/widgets/flowy_mobile_state_container.dart b/frontend/appflowy_flutter/lib/mobile/presentation/widgets/flowy_mobile_state_container.dart
index 7065811640..9497d779dd 100644
--- a/frontend/appflowy_flutter/lib/mobile/presentation/widgets/flowy_mobile_state_container.dart
+++ b/frontend/appflowy_flutter/lib/mobile/presentation/widgets/flowy_mobile_state_container.dart
@@ -45,7 +45,6 @@ class FlowyMobileStateContainer extends StatelessWidget {
padding: const EdgeInsets.symmetric(vertical: 8, horizontal: 32),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
- crossAxisAlignment: CrossAxisAlignment.center,
children: [
Text(
emoji ??
diff --git a/frontend/appflowy_flutter/lib/mobile/presentation/widgets/flowy_option_tile.dart b/frontend/appflowy_flutter/lib/mobile/presentation/widgets/flowy_option_tile.dart
index 85b7cd8e4f..da08179148 100644
--- a/frontend/appflowy_flutter/lib/mobile/presentation/widgets/flowy_option_tile.dart
+++ b/frontend/appflowy_flutter/lib/mobile/presentation/widgets/flowy_option_tile.dart
@@ -47,7 +47,6 @@ class FlowyOptionTile extends StatelessWidget {
type: FlowyOptionTileType.text,
text: text,
textColor: textColor,
- controller: null,
onTap: onTap,
showTopBorder: showTopBorder,
showBottomBorder: showBottomBorder,
@@ -61,7 +60,6 @@ class FlowyOptionTile extends StatelessWidget {
void Function(String value)? onTextChanged,
void Function(String value)? onTextSubmitted,
EdgeInsets textFieldPadding = const EdgeInsets.symmetric(
- horizontal: 0.0,
vertical: 16.0,
),
bool showTopBorder = true,
@@ -75,8 +73,6 @@ class FlowyOptionTile extends StatelessWidget {
type: FlowyOptionTileType.textField,
controller: controller,
textFieldPadding: textFieldPadding,
- text: null,
- onTap: null,
showTopBorder: showTopBorder,
showBottomBorder: showBottomBorder,
leading: leftIcon,
@@ -126,7 +122,6 @@ class FlowyOptionTile extends StatelessWidget {
return FlowyOptionTile._(
type: FlowyOptionTileType.toggle,
text: text,
- controller: null,
onTap: onTap ?? () => onValueChanged(!isSelected),
onValueChanged: onValueChanged,
showTopBorder: showTopBorder,
@@ -172,7 +167,6 @@ class FlowyOptionTile extends StatelessWidget {
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 16.0),
child: Row(
- crossAxisAlignment: CrossAxisAlignment.center,
children: [
if (leadingWidget != null) leadingWidget,
_buildText(),
diff --git a/frontend/appflowy_flutter/lib/plugins/base/color/color_picker.dart b/frontend/appflowy_flutter/lib/plugins/base/color/color_picker.dart
index e48f926cf4..635979debe 100644
--- a/frontend/appflowy_flutter/lib/plugins/base/color/color_picker.dart
+++ b/frontend/appflowy_flutter/lib/plugins/base/color/color_picker.dart
@@ -44,7 +44,6 @@ class FlowyMobileColorPicker extends StatelessWidget {
),
leftIcon: _ColorIcon(
color: color.color,
- size: 24.0,
),
leftIconSize: const Size.square(36.0),
iconPadding: 12.0,
@@ -65,18 +64,14 @@ class FlowyMobileColorPicker extends StatelessWidget {
}
class _ColorIcon extends StatelessWidget {
- const _ColorIcon({
- this.size = 24.0,
- required this.color,
- });
+ const _ColorIcon({required this.color});
- final double size;
final Color color;
@override
Widget build(BuildContext context) {
return SizedBox.square(
- dimension: size,
+ dimension: 24,
child: DecoratedBox(
decoration: BoxDecoration(
color: color,
diff --git a/frontend/appflowy_flutter/lib/plugins/base/color/color_picker_screen.dart b/frontend/appflowy_flutter/lib/plugins/base/color/color_picker_screen.dart
index 9e1b55ef77..db5119eb56 100644
--- a/frontend/appflowy_flutter/lib/plugins/base/color/color_picker_screen.dart
+++ b/frontend/appflowy_flutter/lib/plugins/base/color/color_picker_screen.dart
@@ -7,16 +7,13 @@ import 'package:flutter/material.dart';
import 'package:go_router/go_router.dart';
class MobileColorPickerScreen extends StatelessWidget {
- static const routeName = '/color_picker';
- static const pageTitle = 'title';
-
- const MobileColorPickerScreen({
- super.key,
- this.title,
- });
+ const MobileColorPickerScreen({super.key, this.title});
final String? title;
+ static const routeName = '/color_picker';
+ static const pageTitle = 'title';
+
@override
Widget build(BuildContext context) {
return Scaffold(
diff --git a/frontend/appflowy_flutter/lib/plugins/base/emoji/emoji_picker.dart b/frontend/appflowy_flutter/lib/plugins/base/emoji/emoji_picker.dart
index b4c3abfd8e..8c9c3d2049 100644
--- a/frontend/appflowy_flutter/lib/plugins/base/emoji/emoji_picker.dart
+++ b/frontend/appflowy_flutter/lib/plugins/base/emoji/emoji_picker.dart
@@ -71,7 +71,6 @@ class _FlowyEmojiPickerState extends State<FlowyEmojiPicker> {
return EmojiPicker(
emojiData: emojiData!,
configuration: EmojiPickerConfiguration(
- showSectionHeader: true,
showTabs: false,
defaultSkinTone: lastSelectedEmojiSkinTone ?? EmojiSkinTone.none,
perLine: widget.emojiPerLine,
diff --git a/frontend/appflowy_flutter/lib/plugins/base/emoji/emoji_picker_screen.dart b/frontend/appflowy_flutter/lib/plugins/base/emoji/emoji_picker_screen.dart
index fffe500bf6..85e2197cb7 100644
--- a/frontend/appflowy_flutter/lib/plugins/base/emoji/emoji_picker_screen.dart
+++ b/frontend/appflowy_flutter/lib/plugins/base/emoji/emoji_picker_screen.dart
@@ -4,16 +4,13 @@ import 'package:flutter/material.dart';
import 'package:go_router/go_router.dart';
class MobileEmojiPickerScreen extends StatelessWidget {
- static const routeName = '/emoji_picker';
- static const pageTitle = 'title';
-
- const MobileEmojiPickerScreen({
- super.key,
- this.title,
- });
+ const MobileEmojiPickerScreen({super.key, this.title});
final String? title;
+ static const routeName = '/emoji_picker';
+ static const pageTitle = 'title';
+
@override
Widget build(BuildContext context) {
return IconPickerPage(
diff --git a/frontend/appflowy_flutter/lib/plugins/blank/blank.dart b/frontend/appflowy_flutter/lib/plugins/blank/blank.dart
index e04c0d47ae..9e4a6ba373 100644
--- a/frontend/appflowy_flutter/lib/plugins/blank/blank.dart
+++ b/frontend/appflowy_flutter/lib/plugins/blank/blank.dart
@@ -67,9 +67,9 @@ class _BlankPageState extends State<BlankPage> {
return SizedBox.expand(
child: Container(
color: Theme.of(context).colorScheme.surface,
- child: Padding(
- padding: const EdgeInsets.all(10),
- child: Container(),
+ child: const Padding(
+ padding: EdgeInsets.all(10),
+ child: SizedBox.shrink(),
),
),
);
diff --git a/frontend/appflowy_flutter/lib/plugins/database/application/cell/cell_cache.dart b/frontend/appflowy_flutter/lib/plugins/database/application/cell/cell_cache.dart
index 16ce5b29fe..0c4c5c0697 100644
--- a/frontend/appflowy_flutter/lib/plugins/database/application/cell/cell_cache.dart
+++ b/frontend/appflowy_flutter/lib/plugins/database/application/cell/cell_cache.dart
@@ -7,11 +7,11 @@ import 'cell_controller.dart';
/// Read https://appflowy.gitbook.io/docs/essential-documentation/contribute-to-appflowy/architecture/frontend/grid
/// for more information
class CellMemCache {
+ CellMemCache();
+
/// fieldId: {rowId: cellData}
final Map<String, Map<RowId, dynamic>> _cellByFieldId = {};
- CellMemCache();
-
void removeCellWithFieldId(String fieldId) {
_cellByFieldId.remove(fieldId);
}
diff --git a/frontend/appflowy_flutter/lib/plugins/database/application/cell/cell_controller.dart b/frontend/appflowy_flutter/lib/plugins/database/application/cell/cell_controller.dart
index bbccbfd4c6..718c581b6e 100644
--- a/frontend/appflowy_flutter/lib/plugins/database/application/cell/cell_controller.dart
+++ b/frontend/appflowy_flutter/lib/plugins/database/application/cell/cell_controller.dart
@@ -38,9 +38,27 @@ class CellContext with _$CellContext {
/// T represents the type of the cell data.
/// D represents the type of data that will be saved to the disk.
class CellController<T, D> {
+ CellController({
+ required this.viewId,
+ required FieldController fieldController,
+ required CellContext cellContext,
+ required RowCache rowCache,
+ required CellDataLoader<T> cellDataLoader,
+ required CellDataPersistence<D> cellDataPersistence,
+ }) : _fieldController = fieldController,
+ _cellContext = cellContext,
+ _rowCache = rowCache,
+ _cellDataLoader = cellDataLoader,
+ _cellDataPersistence = cellDataPersistence,
+ _fieldListener = SingleFieldListener(fieldId: cellContext.fieldId),
+ _cellDataNotifier =
+ CellDataNotifier(value: rowCache.cellCache.get(cellContext)) {
+ _startListening();
+ }
+
final String viewId;
- final CellContext _cellContext;
final FieldController _fieldController;
+ final CellContext _cellContext;
final RowCache _rowCache;
final CellDataLoader<T> _cellDataLoader;
final CellDataPersistence<D> _cellDataPersistence;
@@ -64,24 +82,6 @@ class CellController<T, D> {
String? get icon => rowMeta?.icon;
CellMemCache get _cellCache => _rowCache.cellCache;
- CellController({
- required this.viewId,
- required FieldController fieldController,
- required CellContext cellContext,
- required RowCache rowCache,
- required CellDataLoader<T> cellDataLoader,
- required CellDataPersistence<D> cellDataPersistence,
- }) : _fieldController = fieldController,
- _cellContext = cellContext,
- _rowCache = rowCache,
- _cellDataLoader = cellDataLoader,
- _cellDataPersistence = cellDataPersistence,
- _fieldListener = SingleFieldListener(fieldId: cellContext.fieldId),
- _cellDataNotifier =
- CellDataNotifier(value: rowCache.cellCache.get(cellContext)) {
- _startListening();
- }
-
/// casting method for painless type coersion
CellController<A, B> as<A, B>() => this as CellController<A, B>;
@@ -233,9 +233,10 @@ class CellController<T, D> {
}
class CellDataNotifier<T> extends ChangeNotifier {
+ CellDataNotifier({required T value, this.listenWhen}) : _value = value;
+
T _value;
bool Function(T? oldValue, T? newValue)? listenWhen;
- CellDataNotifier({required T value, this.listenWhen}) : _value = value;
set value(T newValue) {
if (listenWhen?.call(_value, newValue) ?? false) {
diff --git a/frontend/appflowy_flutter/lib/plugins/database/application/cell/cell_data_loader.dart b/frontend/appflowy_flutter/lib/plugins/database/application/cell/cell_data_loader.dart
index a2b892a8e9..e74347066b 100644
--- a/frontend/appflowy_flutter/lib/plugins/database/application/cell/cell_data_loader.dart
+++ b/frontend/appflowy_flutter/lib/plugins/database/application/cell/cell_data_loader.dart
@@ -16,16 +16,16 @@ abstract class CellDataParser<T> {
}
class CellDataLoader<T> {
- final CellDataParser<T> parser;
-
- /// Reload the cell data if the field is changed.
- final bool reloadOnFieldChange;
-
CellDataLoader({
required this.parser,
this.reloadOnFieldChange = false,
});
+ final CellDataParser<T> parser;
+
+ /// Reload the cell data if the field is changed.
+ final bool reloadOnFieldChange;
+
Future<T?> loadData({
required String viewId,
required CellContext cellContext,
diff --git a/frontend/appflowy_flutter/lib/plugins/database/application/cell/cell_listener.dart b/frontend/appflowy_flutter/lib/plugins/database/application/cell/cell_listener.dart
index 0399e61200..111b611816 100644
--- a/frontend/appflowy_flutter/lib/plugins/database/application/cell/cell_listener.dart
+++ b/frontend/appflowy_flutter/lib/plugins/database/application/cell/cell_listener.dart
@@ -12,12 +12,14 @@ import '../row/row_service.dart';
typedef UpdateFieldNotifiedValue = Either<Unit, FlowyError>;
class CellListener {
+ CellListener({required this.rowId, required this.fieldId});
+
final RowId rowId;
final String fieldId;
+
PublishNotifier<UpdateFieldNotifiedValue>? _updateCellNotifier =
PublishNotifier();
DatabaseNotificationListener? _listener;
- CellListener({required this.rowId, required this.fieldId});
void start({required void Function(UpdateFieldNotifiedValue) onCellChanged}) {
_updateCellNotifier?.addPublishListener(onCellChanged);
diff --git a/frontend/appflowy_flutter/lib/plugins/database/application/cell/checklist_cell_service.dart b/frontend/appflowy_flutter/lib/plugins/database/application/cell/checklist_cell_service.dart
index 9e21fab72c..17a8fa0a55 100644
--- a/frontend/appflowy_flutter/lib/plugins/database/application/cell/checklist_cell_service.dart
+++ b/frontend/appflowy_flutter/lib/plugins/database/application/cell/checklist_cell_service.dart
@@ -6,16 +6,16 @@ import 'package:dartz/dartz.dart';
import 'package:protobuf/protobuf.dart';
class ChecklistCellBackendService {
- final String viewId;
- final String fieldId;
- final String rowId;
-
ChecklistCellBackendService({
required this.viewId,
required this.fieldId,
required this.rowId,
});
+ final String viewId;
+ final String fieldId;
+ final String rowId;
+
Future<Either<Unit, FlowyError>> create({
required String name,
}) {
diff --git a/frontend/appflowy_flutter/lib/plugins/database/application/cell/date_cell_service.dart b/frontend/appflowy_flutter/lib/plugins/database/application/cell/date_cell_service.dart
index b1da135aa6..3830e5fd00 100644
--- a/frontend/appflowy_flutter/lib/plugins/database/application/cell/date_cell_service.dart
+++ b/frontend/appflowy_flutter/lib/plugins/database/application/cell/date_cell_service.dart
@@ -6,8 +6,6 @@ import 'package:dartz/dartz.dart';
import 'package:fixnum/fixnum.dart';
final class DateCellBackendService {
- final CellIdPB cellId;
-
DateCellBackendService({
required String viewId,
required String fieldId,
@@ -17,6 +15,8 @@ final class DateCellBackendService {
..fieldId = fieldId
..rowId = rowId;
+ final CellIdPB cellId;
+
Future<Either<Unit, FlowyError>> update({
required bool includeTime,
required bool isRange,
diff --git a/frontend/appflowy_flutter/lib/plugins/database/application/cell/select_option_cell_service.dart b/frontend/appflowy_flutter/lib/plugins/database/application/cell/select_option_cell_service.dart
index 347e9bb744..906496c18a 100644
--- a/frontend/appflowy_flutter/lib/plugins/database/application/cell/select_option_cell_service.dart
+++ b/frontend/appflowy_flutter/lib/plugins/database/application/cell/select_option_cell_service.dart
@@ -6,16 +6,16 @@ import 'package:appflowy_backend/protobuf/flowy-error/errors.pb.dart';
import 'package:appflowy_backend/protobuf/flowy-database2/cell_entities.pb.dart';
class SelectOptionCellBackendService {
- final String viewId;
- final String fieldId;
- final String rowId;
-
SelectOptionCellBackendService({
required this.viewId,
required this.fieldId,
required this.rowId,
});
+ final String viewId;
+ final String fieldId;
+ final String rowId;
+
Future<Either<Unit, FlowyError>> create({
required String name,
bool isSelected = true,
diff --git a/frontend/appflowy_flutter/lib/plugins/database/application/database_controller.dart b/frontend/appflowy_flutter/lib/plugins/database/application/database_controller.dart
index 3133866add..47cf23d5de 100644
--- a/frontend/appflowy_flutter/lib/plugins/database/application/database_controller.dart
+++ b/frontend/appflowy_flutter/lib/plugins/database/application/database_controller.dart
@@ -29,12 +29,6 @@ typedef OnDeleteGroup = void Function(List<String>);
typedef OnInsertGroup = void Function(InsertedGroupPB);
class GroupCallbacks {
- final OnGroupConfigurationChanged? onGroupConfigurationChanged;
- final OnGroupByField? onGroupByField;
- final OnUpdateGroup? onUpdateGroup;
- final OnDeleteGroup? onDeleteGroup;
- final OnInsertGroup? onInsertGroup;
-
GroupCallbacks({
this.onGroupConfigurationChanged,
this.onGroupByField,
@@ -42,26 +36,21 @@ class GroupCallbacks {
this.onDeleteGroup,
this.onInsertGroup,
});
+
+ final OnGroupConfigurationChanged? onGroupConfigurationChanged;
+ final OnGroupByField? onGroupByField;
+ final OnUpdateGroup? onUpdateGroup;
+ final OnDeleteGroup? onDeleteGroup;
+ final OnInsertGroup? onInsertGroup;
}
class DatabaseLayoutSettingCallbacks {
- final void Function(DatabaseLayoutSettingPB) onLayoutSettingsChanged;
+ DatabaseLayoutSettingCallbacks({required this.onLayoutSettingsChanged});
- DatabaseLayoutSettingCallbacks({
- required this.onLayoutSettingsChanged,
- });
+ final void Function(DatabaseLayoutSettingPB) onLayoutSettingsChanged;
}
class DatabaseCallbacks {
- OnDatabaseChanged? onDatabaseChanged;
- OnFieldsChanged? onFieldsChanged;
- OnFiltersChanged? onFiltersChanged;
- OnSortsChanged? onSortsChanged;
- OnNumOfRowsChanged? onNumOfRowsChanged;
- OnRowsDeleted? onRowsDeleted;
- OnRowsUpdated? onRowsUpdated;
- OnRowsCreated? onRowsCreated;
-
DatabaseCallbacks({
this.onDatabaseChanged,
this.onNumOfRowsChanged,
@@ -72,9 +61,36 @@ class DatabaseCallbacks {
this.onRowsDeleted,
this.onRowsCreated,
});
+
+ OnDatabaseChanged? onDatabaseChanged;
+ OnFieldsChanged? onFieldsChanged;
+ OnFiltersChanged? onFiltersChanged;
+ OnSortsChanged? onSortsChanged;
+ OnNumOfRowsChanged? onNumOfRowsChanged;
+ OnRowsDeleted? onRowsDeleted;
+ OnRowsUpdated? onRowsUpdated;
+ OnRowsCreated? onRowsCreated;
}
class DatabaseController {
+ DatabaseController({required ViewPB view})
+ : viewId = view.id,
+ _databaseViewBackendSvc = DatabaseViewBackendService(viewId: view.id),
+ fieldController = FieldController(viewId: view.id),
+ _groupListener = DatabaseGroupListener(view.id),
+ databaseLayout = databaseLayoutFromViewLayout(view.layout),
+ _layoutListener = DatabaseLayoutSettingListener(view.id) {
+ _viewCache = DatabaseViewCache(
+ viewId: viewId,
+ fieldController: fieldController,
+ );
+
+ _listenOnRowsChanged();
+ _listenOnFieldsChanged();
+ _listenOnGroupChanged();
+ _listenOnLayoutChanged();
+ }
+
final String viewId;
final DatabaseViewBackendService _databaseViewBackendSvc;
final FieldController fieldController;
@@ -96,23 +112,6 @@ class DatabaseController {
final ValueNotifier<bool> _isLoading = ValueNotifier(true);
- DatabaseController({required ViewPB view})
- : viewId = view.id,
- _databaseViewBackendSvc = DatabaseViewBackendService(viewId: view.id),
- fieldController = FieldController(viewId: view.id),
- _groupListener = DatabaseGroupListener(view.id),
- databaseLayout = databaseLayoutFromViewLayout(view.layout),
- _layoutListener = DatabaseLayoutSettingListener(view.id) {
- _viewCache = DatabaseViewCache(
- viewId: viewId,
- fieldController: fieldController,
- );
- _listenOnRowsChanged();
- _listenOnFieldsChanged();
- _listenOnGroupChanged();
- _listenOnLayoutChanged();
- }
-
void setIsLoading(bool isLoading) {
_isLoading.value = isLoading;
}
diff --git a/frontend/appflowy_flutter/lib/plugins/database/application/database_view_service.dart b/frontend/appflowy_flutter/lib/plugins/database/application/database_view_service.dart
index 1ac720dac0..e4c36a3c54 100644
--- a/frontend/appflowy_flutter/lib/plugins/database/application/database_view_service.dart
+++ b/frontend/appflowy_flutter/lib/plugins/database/application/database_view_service.dart
@@ -8,10 +8,9 @@ import 'package:dartz/dartz.dart';
import 'layout/layout_service.dart';
class DatabaseViewBackendService {
+ DatabaseViewBackendService({required this.viewId});
+
final String viewId;
- DatabaseViewBackendService({
- required this.viewId,
- });
/// Returns the datbaase id associated with the view.
Future<Either<String, FlowyError>> getDatabaseId() async {
diff --git a/frontend/appflowy_flutter/lib/plugins/database/application/field/field_cell_bloc.dart b/frontend/appflowy_flutter/lib/plugins/database/application/field/field_cell_bloc.dart
index b21d03d6b8..1e6d953d1f 100644
--- a/frontend/appflowy_flutter/lib/plugins/database/application/field/field_cell_bloc.dart
+++ b/frontend/appflowy_flutter/lib/plugins/database/application/field/field_cell_bloc.dart
@@ -9,32 +9,31 @@ import 'field_info.dart';
part 'field_cell_bloc.freezed.dart';
class FieldCellBloc extends Bloc<FieldCellEvent, FieldCellState> {
- FieldInfo fieldInfo;
+ FieldCellBloc({required String viewId, required FieldInfo fieldInfo})
+ : _fieldSettingsService = FieldSettingsBackendService(viewId: viewId),
+ super(FieldCellState.initial(fieldInfo)) {
+ _dispatch();
+ }
+
final FieldSettingsBackendService _fieldSettingsService;
- FieldCellBloc({required String viewId, required this.fieldInfo})
- : _fieldSettingsService = FieldSettingsBackendService(
- viewId: viewId,
- ),
- super(FieldCellState.initial(fieldInfo)) {
+ void _dispatch() {
on<FieldCellEvent>(
(event, emit) async {
event.when(
- onFieldChanged: (newFieldInfo) {
- fieldInfo = newFieldInfo;
- emit(FieldCellState.initial(newFieldInfo));
- },
- onResizeStart: () {
- emit(state.copyWith(isResizing: true, resizeStart: state.width));
- },
+ onFieldChanged: (newFieldInfo) =>
+ emit(FieldCellState.initial(newFieldInfo)),
+ onResizeStart: () =>
+ emit(state.copyWith(isResizing: true, resizeStart: state.width)),
startUpdateWidth: (offset) {
final width = max(offset + state.resizeStart, 50).toDouble();
emit(state.copyWith(width: width));
},
endUpdateWidth: () {
- if (state.width != fieldInfo.fieldSettings?.width.toDouble()) {
+ if (state.width !=
+ state.fieldInfo.fieldSettings?.width.toDouble()) {
_fieldSettingsService.updateFieldSettings(
- fieldId: fieldInfo.id,
+ fieldId: state.fieldInfo.id,
width: state.width,
);
}
@@ -58,17 +57,17 @@ class FieldCellEvent with _$FieldCellEvent {
@freezed
class FieldCellState with _$FieldCellState {
- const factory FieldCellState({
- required FieldInfo fieldInfo,
- required double width,
- required bool isResizing,
- required double resizeStart,
- }) = _FieldCellState;
-
factory FieldCellState.initial(FieldInfo fieldInfo) => FieldCellState(
fieldInfo: fieldInfo,
isResizing: false,
width: fieldInfo.fieldSettings!.width.toDouble(),
resizeStart: 0,
);
+
+ const factory FieldCellState({
+ required FieldInfo fieldInfo,
+ required double width,
+ required bool isResizing,
+ required double resizeStart,
+ }) = _FieldCellState;
}
diff --git a/frontend/appflowy_flutter/lib/plugins/database/application/field/field_controller.dart b/frontend/appflowy_flutter/lib/plugins/database/application/field/field_controller.dart
index 5cfbdb0a19..3be14cec47 100644
--- a/frontend/appflowy_flutter/lib/plugins/database/application/field/field_controller.dart
+++ b/frontend/appflowy_flutter/lib/plugins/database/application/field/field_controller.dart
@@ -79,6 +79,24 @@ typedef OnReceiveSorts = void Function(List<SortInfo>);
typedef OnReceiveFieldSettings = void Function(List<FieldInfo>);
class FieldController {
+ FieldController({required this.viewId})
+ : _fieldListener = FieldsListener(viewId: viewId),
+ _settingListener = DatabaseSettingListener(viewId: viewId),
+ _filterBackendSvc = FilterBackendService(viewId: viewId),
+ _filtersListener = FiltersListener(viewId: viewId),
+ _databaseViewBackendSvc = DatabaseViewBackendService(viewId: viewId),
+ _sortBackendSvc = SortBackendService(viewId: viewId),
+ _sortsListener = SortsListener(viewId: viewId),
+ _fieldSettingsListener = FieldSettingsListener(viewId: viewId),
+ _fieldSettingsBackendSvc = FieldSettingsBackendService(viewId: viewId) {
+ // Start listeners
+ _listenOnFieldChanges();
+ _listenOnSettingChanges();
+ _listenOnFilterChanges();
+ _listenOnSortChanged();
+ _listenOnFieldSettingsChanged();
+ }
+
final String viewId;
// Listeners
@@ -146,24 +164,6 @@ class FieldController {
.firstWhereOrNull((element) => element.fieldId == fieldId);
}
- FieldController({required this.viewId})
- : _fieldListener = FieldsListener(viewId: viewId),
- _settingListener = DatabaseSettingListener(viewId: viewId),
- _filterBackendSvc = FilterBackendService(viewId: viewId),
- _filtersListener = FiltersListener(viewId: viewId),
- _databaseViewBackendSvc = DatabaseViewBackendService(viewId: viewId),
- _sortBackendSvc = SortBackendService(viewId: viewId),
- _sortsListener = SortsListener(viewId: viewId),
- _fieldSettingsListener = FieldSettingsListener(viewId: viewId),
- _fieldSettingsBackendSvc = FieldSettingsBackendService(viewId: viewId) {
- // Start listeners
- _listenOnFieldChanges();
- _listenOnSettingChanges();
- _listenOnFilterChanges();
- _listenOnSortChanged();
- _listenOnFieldSettingsChanged();
- }
-
/// Listen for filter changes in the backend.
void _listenOnFilterChanges() {
void deleteFilterFromChangeset(
@@ -402,7 +402,7 @@ class FieldController {
for (final fieldOrder in deletedFields) fieldOrder.fieldId: fieldOrder,
};
- newFields.retainWhere((field) => (deletedFieldMap[field.id] == null));
+ newFields.retainWhere((field) => deletedFieldMap[field.id] == null);
return newFields;
}
@@ -784,9 +784,10 @@ class FieldController {
}
class RowCacheDependenciesImpl extends RowFieldsDelegate with RowLifeCycle {
+ RowCacheDependenciesImpl(FieldController cache) : _fieldController = cache;
+
final FieldController _fieldController;
OnReceiveFields? _onFieldFn;
- RowCacheDependenciesImpl(FieldController cache) : _fieldController = cache;
@override
UnmodifiableListView<FieldInfo> get fieldInfos =>
diff --git a/frontend/appflowy_flutter/lib/plugins/database/application/field/field_editor_bloc.dart b/frontend/appflowy_flutter/lib/plugins/database/application/field/field_editor_bloc.dart
index 3a66f66570..5c6c774108 100644
--- a/frontend/appflowy_flutter/lib/plugins/database/application/field/field_editor_bloc.dart
+++ b/frontend/appflowy_flutter/lib/plugins/database/application/field/field_editor_bloc.dart
@@ -16,14 +16,6 @@ import 'field_service.dart';
part 'field_editor_bloc.freezed.dart';
class FieldEditorBloc extends Bloc<FieldEditorEvent, FieldEditorState> {
- final String viewId;
- final String fieldId;
- final FieldController fieldController;
- final SingleFieldListener _singleFieldListener;
- final FieldBackendService fieldService;
- final FieldSettingsBackendService fieldSettingsService;
- final void Function(String newFieldId)? onFieldInserted;
-
FieldEditorBloc({
required this.viewId,
required this.fieldController,
@@ -37,6 +29,24 @@ class FieldEditorBloc extends Bloc<FieldEditorEvent, FieldEditorState> {
),
fieldSettingsService = FieldSettingsBackendService(viewId: viewId),
super(FieldEditorState(field: FieldInfo.initial(field))) {
+ _dispatch();
+ }
+
+ final String viewId;
+ final String fieldId;
+ final FieldController fieldController;
+ final SingleFieldListener _singleFieldListener;
+ final FieldBackendService fieldService;
+ final FieldSettingsBackendService fieldSettingsService;
+ final void Function(String newFieldId)? onFieldInserted;
+
+ @override
+ Future<void> close() {
+ _singleFieldListener.stop();
+ return super.close();
+ }
+
+ void _dispatch() {
on<FieldEditorEvent>(
(event, emit) async {
await event.when(
@@ -107,13 +117,6 @@ class FieldEditorBloc extends Bloc<FieldEditorEvent, FieldEditorState> {
(err) => Log.error(err),
);
}
-
- @override
- Future<void> close() {
- _singleFieldListener.stop();
-
- return super.close();
- }
}
@freezed
diff --git a/frontend/appflowy_flutter/lib/plugins/database/application/field/field_info.dart b/frontend/appflowy_flutter/lib/plugins/database/application/field/field_info.dart
index 41f1908dd3..81592e09c6 100644
--- a/frontend/appflowy_flutter/lib/plugins/database/application/field/field_info.dart
+++ b/frontend/appflowy_flutter/lib/plugins/database/application/field/field_info.dart
@@ -7,6 +7,14 @@ part 'field_info.freezed.dart';
class FieldInfo with _$FieldInfo {
const FieldInfo._();
+ factory FieldInfo.initial(FieldPB field) => FieldInfo(
+ field: field,
+ fieldSettings: null,
+ hasFilter: false,
+ hasSort: false,
+ isGroupField: false,
+ );
+
const factory FieldInfo({
required FieldPB field,
required FieldSettingsPB? fieldSettings,
@@ -25,14 +33,6 @@ class FieldInfo with _$FieldInfo {
FieldVisibility? get visibility => fieldSettings?.visibility;
- factory FieldInfo.initial(FieldPB field) => FieldInfo(
- field: field,
- fieldSettings: null,
- hasFilter: false,
- hasSort: false,
- isGroupField: false,
- );
-
bool get canBeGroup {
switch (field.fieldType) {
case FieldType.URL:
diff --git a/frontend/appflowy_flutter/lib/plugins/database/application/field/field_listener.dart b/frontend/appflowy_flutter/lib/plugins/database/application/field/field_listener.dart
index 9b8314e6fb..19c2f447e9 100644
--- a/frontend/appflowy_flutter/lib/plugins/database/application/field/field_listener.dart
+++ b/frontend/appflowy_flutter/lib/plugins/database/application/field/field_listener.dart
@@ -11,12 +11,13 @@ import 'package:flowy_infra/notifier.dart';
typedef UpdateFieldNotifiedValue = FieldPB;
class SingleFieldListener {
+ SingleFieldListener({required this.fieldId});
+
final String fieldId;
+
void Function(UpdateFieldNotifiedValue)? _updateFieldNotifier;
DatabaseNotificationListener? _listener;
- SingleFieldListener({required this.fieldId});
-
void start({
required void Function(UpdateFieldNotifiedValue) onFieldChanged,
}) {
@@ -53,11 +54,13 @@ typedef UpdateFieldsNotifiedValue
= Either<DatabaseFieldChangesetPB, FlowyError>;
class FieldsListener {
+ FieldsListener({required this.viewId});
+
final String viewId;
+
PublishNotifier<UpdateFieldsNotifiedValue>? updateFieldsNotifier =
PublishNotifier();
DatabaseNotificationListener? _listener;
- FieldsListener({required this.viewId});
void start({
required void Function(UpdateFieldsNotifiedValue) onFieldsChanged,
diff --git a/frontend/appflowy_flutter/lib/plugins/database/application/field/field_service.dart b/frontend/appflowy_flutter/lib/plugins/database/application/field/field_service.dart
index ebf5a20b8f..a416ddc2d5 100644
--- a/frontend/appflowy_flutter/lib/plugins/database/application/field/field_service.dart
+++ b/frontend/appflowy_flutter/lib/plugins/database/application/field/field_service.dart
@@ -9,11 +9,11 @@ import 'package:dartz/dartz.dart';
/// `rust-lib/flowy-database/event_map.rs` for a list of events and their
/// implementations.
class FieldBackendService {
+ FieldBackendService({required this.viewId, required this.fieldId});
+
final String viewId;
final String fieldId;
- FieldBackendService({required this.viewId, required this.fieldId});
-
/// Create a field in a database view. The position will only be applicable
/// in this view; for other views it will be appended to the end
static Future<Either<FieldPB, FlowyError>> createField({
@@ -167,19 +167,16 @@ class FieldBackendService {
Future<Either<Unit, FlowyError>> updateType({
required FieldType fieldType,
- }) {
- return updateFieldType(
- viewId: viewId,
- fieldId: fieldId,
- fieldType: fieldType,
- );
- }
-
- Future<Either<Unit, FlowyError>> delete() {
- return deleteField(viewId: viewId, fieldId: fieldId);
- }
-
- Future<Either<Unit, FlowyError>> duplicate() {
- return duplicateField(viewId: viewId, fieldId: fieldId);
- }
+ }) =>
+ updateFieldType(
+ viewId: viewId,
+ fieldId: fieldId,
+ fieldType: fieldType,
+ );
+
+ Future<Either<Unit, FlowyError>> delete() =>
+ deleteField(viewId: viewId, fieldId: fieldId);
+
+ Future<Either<Unit, FlowyError>> duplicate() =>
+ duplicateField(viewId: viewId, fieldId: fieldId);
}
diff --git a/frontend/appflowy_flutter/lib/plugins/database/application/field/type_option/edit_select_option_bloc.dart b/frontend/appflowy_flutter/lib/plugins/database/application/field/type_option/edit_select_option_bloc.dart
index 1525b90564..3e4ba6e2c9 100644
--- a/frontend/appflowy_flutter/lib/plugins/database/application/field/type_option/edit_select_option_bloc.dart
+++ b/frontend/appflowy_flutter/lib/plugins/database/application/field/type_option/edit_select_option_bloc.dart
@@ -1,8 +1,8 @@
import 'package:appflowy_backend/protobuf/flowy-database2/select_option_entities.pb.dart';
+import 'package:dartz/dartz.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:freezed_annotation/freezed_annotation.dart';
import 'package:protobuf/protobuf.dart';
-import 'package:dartz/dartz.dart';
part 'edit_select_option_bloc.freezed.dart';
class EditSelectOptionBloc
diff --git a/frontend/appflowy_flutter/lib/plugins/database/application/field/type_option/multi_select_type_option.dart b/frontend/appflowy_flutter/lib/plugins/database/application/field/type_option/multi_select_type_option.dart
index 07b8be131b..4d3cbbe837 100644
--- a/frontend/appflowy_flutter/lib/plugins/database/application/field/type_option/multi_select_type_option.dart
+++ b/frontend/appflowy_flutter/lib/plugins/database/application/field/type_option/multi_select_type_option.dart
@@ -8,15 +8,15 @@ import 'select_option_type_option_bloc.dart';
import 'type_option_service.dart';
class MultiSelectAction implements ISelectOptionAction {
- final TypeOptionBackendService service;
- final TypeOptionDataCallback onTypeOptionUpdated;
-
MultiSelectAction({
required this.onTypeOptionUpdated,
required String viewId,
required String fieldId,
}) : service = TypeOptionBackendService(viewId: viewId, fieldId: fieldId);
+ final TypeOptionBackendService service;
+ final TypeOptionDataCallback onTypeOptionUpdated;
+
@override
Future<List<SelectOptionPB>> insertOption(
List<SelectOptionPB> options,
diff --git a/frontend/appflowy_flutter/lib/plugins/database/application/field/type_option/number_format_bloc.dart b/frontend/appflowy_flutter/lib/plugins/database/application/field/type_option/number_format_bloc.dart
index 176a638afc..5c8a9ebf37 100644
--- a/frontend/appflowy_flutter/lib/plugins/database/application/field/type_option/number_format_bloc.dart
+++ b/frontend/appflowy_flutter/lib/plugins/database/application/field/type_option/number_format_bloc.dart
@@ -1,6 +1,7 @@
import 'package:appflowy_backend/protobuf/flowy-database2/number_entities.pbenum.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:freezed_annotation/freezed_annotation.dart';
+
part 'number_format_bloc.freezed.dart';
class NumberFormatBloc extends Bloc<NumberFormatEvent, NumberFormatState> {
diff --git a/frontend/appflowy_flutter/lib/plugins/database/application/field/type_option/select_option_type_option_bloc.dart b/frontend/appflowy_flutter/lib/plugins/database/application/field/type_option/select_option_type_option_bloc.dart
index 20fe09bc85..c8b7dce7d4 100644
--- a/frontend/appflowy_flutter/lib/plugins/database/application/field/type_option/select_option_type_option_bloc.dart
+++ b/frontend/appflowy_flutter/lib/plugins/database/application/field/type_option/select_option_type_option_bloc.dart
@@ -1,8 +1,9 @@
+import 'dart:async';
+
import 'package:appflowy_backend/protobuf/flowy-database2/select_option_entities.pb.dart';
+import 'package:dartz/dartz.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:freezed_annotation/freezed_annotation.dart';
-import 'dart:async';
-import 'package:dartz/dartz.dart';
part 'select_option_type_option_bloc.freezed.dart';
abstract class ISelectOptionAction {
@@ -24,12 +25,16 @@ abstract class ISelectOptionAction {
class SelectOptionTypeOptionBloc
extends Bloc<SelectOptionTypeOptionEvent, SelectOptionTypeOptionState> {
- final ISelectOptionAction typeOptionAction;
-
SelectOptionTypeOptionBloc({
required List<SelectOptionPB> options,
required this.typeOptionAction,
}) : super(SelectOptionTypeOptionState.initial(options)) {
+ _dispatch();
+ }
+
+ final ISelectOptionAction typeOptionAction;
+
+ void _dispatch() {
on<SelectOptionTypeOptionEvent>(
(event, emit) async {
await event.when(
diff --git a/frontend/appflowy_flutter/lib/plugins/database/application/field/type_option/single_select_type_option.dart b/frontend/appflowy_flutter/lib/plugins/database/application/field/type_option/single_select_type_option.dart
index 517ed6feb6..313ced2d1c 100644
--- a/frontend/appflowy_flutter/lib/plugins/database/application/field/type_option/single_select_type_option.dart
+++ b/frontend/appflowy_flutter/lib/plugins/database/application/field/type_option/single_select_type_option.dart
@@ -8,15 +8,15 @@ import 'select_option_type_option_bloc.dart';
import 'type_option_service.dart';
class SingleSelectAction implements ISelectOptionAction {
- final TypeOptionBackendService service;
- final TypeOptionDataCallback onTypeOptionUpdated;
-
SingleSelectAction({
required this.onTypeOptionUpdated,
required String viewId,
required String fieldId,
}) : service = TypeOptionBackendService(viewId: viewId, fieldId: fieldId);
+ final TypeOptionBackendService service;
+ final TypeOptionDataCallback onTypeOptionUpdated;
+
@override
Future<List<SelectOptionPB>> insertOption(
List<SelectOptionPB> options,
diff --git a/frontend/appflowy_flutter/lib/plugins/database/application/field/type_option/type_option_service.dart b/frontend/appflowy_flutter/lib/plugins/database/application/field/type_option/type_option_service.dart
index 0ef6b670b9..15c9683f05 100644
--- a/frontend/appflowy_flutter/lib/plugins/database/application/field/type_option/type_option_service.dart
+++ b/frontend/appflowy_flutter/lib/plugins/database/application/field/type_option/type_option_service.dart
@@ -4,14 +4,14 @@ import 'package:appflowy_backend/protobuf/flowy-error/errors.pb.dart';
import 'package:dartz/dartz.dart';
class TypeOptionBackendService {
- final String viewId;
- final String fieldId;
-
TypeOptionBackendService({
required this.viewId,
required this.fieldId,
});
+ final String viewId;
+ final String fieldId;
+
Future<Either<SelectOptionPB, FlowyError>> newOption({
required String name,
}) {
diff --git a/frontend/appflowy_flutter/lib/plugins/database/application/field_settings/field_settings_listener.dart b/frontend/appflowy_flutter/lib/plugins/database/application/field_settings/field_settings_listener.dart
index 53ec29d990..6262e16f3b 100644
--- a/frontend/appflowy_flutter/lib/plugins/database/application/field_settings/field_settings_listener.dart
+++ b/frontend/appflowy_flutter/lib/plugins/database/application/field_settings/field_settings_listener.dart
@@ -9,13 +9,14 @@ import 'package:flowy_infra/notifier.dart';
typedef FieldSettingsValue = Either<FieldSettingsPB, FlowyError>;
class FieldSettingsListener {
+ FieldSettingsListener({required this.viewId});
+
final String viewId;
+
PublishNotifier<FieldSettingsValue>? _fieldSettingsNotifier =
PublishNotifier();
DatabaseNotificationListener? _listener;
- FieldSettingsListener({required this.viewId});
-
void start({
required void Function(FieldSettingsValue) onFieldSettingsChanged,
}) {
diff --git a/frontend/appflowy_flutter/lib/plugins/database/application/filter/filter_listener.dart b/frontend/appflowy_flutter/lib/plugins/database/application/filter/filter_listener.dart
index 0170f97772..ed6294f676 100644
--- a/frontend/appflowy_flutter/lib/plugins/database/application/filter/filter_listener.dart
+++ b/frontend/appflowy_flutter/lib/plugins/database/application/filter/filter_listener.dart
@@ -12,12 +12,13 @@ typedef UpdateFilterNotifiedValue
= Either<FilterChangesetNotificationPB, FlowyError>;
class FiltersListener {
+ FiltersListener({required this.viewId});
+
final String viewId;
PublishNotifier<UpdateFilterNotifiedValue>? _filterNotifier =
PublishNotifier();
DatabaseNotificationListener? _listener;
- FiltersListener({required this.viewId});
void start({
required void Function(UpdateFilterNotifiedValue) onFilterChanged,
@@ -54,6 +55,8 @@ class FiltersListener {
}
class FilterListener {
+ FilterListener({required this.viewId, required this.filterId});
+
final String viewId;
final String filterId;
@@ -61,7 +64,6 @@ class FilterListener {
PublishNotifier<FilterPB>? _onUpdateNotifier = PublishNotifier();
DatabaseNotificationListener? _listener;
- FilterListener({required this.viewId, required this.filterId});
void start({
void Function()? onDeleted,
diff --git a/frontend/appflowy_flutter/lib/plugins/database/application/filter/filter_service.dart b/frontend/appflowy_flutter/lib/plugins/database/application/filter/filter_service.dart
index c600b1ec2e..03056a980c 100644
--- a/frontend/appflowy_flutter/lib/plugins/database/application/filter/filter_service.dart
+++ b/frontend/appflowy_flutter/lib/plugins/database/application/filter/filter_service.dart
@@ -15,9 +15,10 @@ import 'package:appflowy_backend/protobuf/flowy-database2/util.pb.dart';
import 'package:fixnum/fixnum.dart' as $fixnum;
class FilterBackendService {
- final String viewId;
const FilterBackendService({required this.viewId});
+ final String viewId;
+
Future<Either<List<FilterPB>, FlowyError>> getAllFilters() {
final payload = DatabaseViewIdPB()..value = viewId;
diff --git a/frontend/appflowy_flutter/lib/plugins/database/application/group/group_listener.dart b/frontend/appflowy_flutter/lib/plugins/database/application/group/group_listener.dart
index a07b287f43..b22371737c 100644
--- a/frontend/appflowy_flutter/lib/plugins/database/application/group/group_listener.dart
+++ b/frontend/appflowy_flutter/lib/plugins/database/application/group/group_listener.dart
@@ -14,12 +14,14 @@ typedef GroupUpdateValue = Either<GroupChangesPB, FlowyError>;
typedef GroupByNewFieldValue = Either<List<GroupPB>, FlowyError>;
class DatabaseGroupListener {
+ DatabaseGroupListener(this.viewId);
+
final String viewId;
+
PublishNotifier<GroupUpdateValue>? _numOfGroupsNotifier = PublishNotifier();
PublishNotifier<GroupByNewFieldValue>? _groupByFieldNotifier =
PublishNotifier();
DatabaseNotificationListener? _listener;
- DatabaseGroupListener(this.viewId);
void start({
required void Function(GroupUpdateValue) onNumOfGroupsChanged,
diff --git a/frontend/appflowy_flutter/lib/plugins/database/application/group/group_service.dart b/frontend/appflowy_flutter/lib/plugins/database/application/group/group_service.dart
index a153a49ae6..c7fe72d95d 100644
--- a/frontend/appflowy_flutter/lib/plugins/database/application/group/group_service.dart
+++ b/frontend/appflowy_flutter/lib/plugins/database/application/group/group_service.dart
@@ -4,10 +4,10 @@ import 'package:appflowy_backend/protobuf/flowy-error/errors.pb.dart';
import 'package:dartz/dartz.dart';
class GroupBackendService {
- final String viewId;
-
GroupBackendService(this.viewId);
+ final String viewId;
+
Future<Either<Unit, FlowyError>> groupByField({
required String fieldId,
}) {
diff --git a/frontend/appflowy_flutter/lib/plugins/database/application/layout/layout_listener.dart b/frontend/appflowy_flutter/lib/plugins/database/application/layout/layout_listener.dart
index c3683d921e..1f3301f5b8 100644
--- a/frontend/appflowy_flutter/lib/plugins/database/application/layout/layout_listener.dart
+++ b/frontend/appflowy_flutter/lib/plugins/database/application/layout/layout_listener.dart
@@ -8,11 +8,13 @@ import 'package:dartz/dartz.dart';
/// Listener for database layout changes.
class DatabaseLayoutListener {
+ DatabaseLayoutListener(this.viewId);
+
final String viewId;
+
PublishNotifier<Either<DatabaseLayoutPB, FlowyError>>? _layoutNotifier =
PublishNotifier();
DatabaseNotificationListener? _listener;
- DatabaseLayoutListener(this.viewId);
void start({
required void Function(Either<DatabaseLayoutPB, FlowyError>)
diff --git a/frontend/appflowy_flutter/lib/plugins/database/application/layout/layout_setting_listener.dart b/frontend/appflowy_flutter/lib/plugins/database/application/layout/layout_setting_listener.dart
index fc1553a573..0d016e148f 100644
--- a/frontend/appflowy_flutter/lib/plugins/database/application/layout/layout_setting_listener.dart
+++ b/frontend/appflowy_flutter/lib/plugins/database/application/layout/layout_setting_listener.dart
@@ -9,11 +9,13 @@ import 'package:dartz/dartz.dart';
typedef LayoutSettingsValue<T> = Either<T, FlowyError>;
class DatabaseLayoutSettingListener {
+ DatabaseLayoutSettingListener(this.viewId);
+
final String viewId;
+
PublishNotifier<LayoutSettingsValue<DatabaseLayoutSettingPB>>?
_settingNotifier = PublishNotifier();
DatabaseNotificationListener? _listener;
- DatabaseLayoutSettingListener(this.viewId);
void start({
required void Function(LayoutSettingsValue<DatabaseLayoutSettingPB>)
diff --git a/frontend/appflowy_flutter/lib/plugins/database/application/row/row_banner_bloc.dart b/frontend/appflowy_flutter/lib/plugins/database/application/row/row_banner_bloc.dart
index afb18d718a..a78d70d307 100644
--- a/frontend/appflowy_flutter/lib/plugins/database/application/row/row_banner_bloc.dart
+++ b/frontend/appflowy_flutter/lib/plugins/database/application/row/row_banner_bloc.dart
@@ -11,17 +11,30 @@ import 'row_meta_listener.dart';
part 'row_banner_bloc.freezed.dart';
class RowBannerBloc extends Bloc<RowBannerEvent, RowBannerState> {
- final String viewId;
- final RowBackendService _rowBackendSvc;
- final RowMetaListener _metaListener;
- SingleFieldListener? _fieldListener;
-
RowBannerBloc({
required this.viewId,
required RowMetaPB rowMeta,
}) : _rowBackendSvc = RowBackendService(viewId: viewId),
_metaListener = RowMetaListener(rowMeta.id),
super(RowBannerState.initial(rowMeta)) {
+ _dispatch();
+ }
+
+ final String viewId;
+ final RowBackendService _rowBackendSvc;
+ final RowMetaListener _metaListener;
+ SingleFieldListener? _fieldListener;
+
+ @override
+ Future<void> close() async {
+ await _metaListener.stop();
+ await _fieldListener?.stop();
+ _fieldListener = null;
+
+ return super.close();
+ }
+
+ void _dispatch() {
on<RowBannerEvent>(
(event, emit) {
event.when(
@@ -32,12 +45,8 @@ class RowBannerBloc extends Bloc<RowBannerEvent, RowBannerState> {
didReceiveRowMeta: (RowMetaPB rowMeta) {
emit(state.copyWith(rowMeta: rowMeta));
},
- setCover: (String coverURL) {
- _updateMeta(coverURL: coverURL);
- },
- setIcon: (String iconURL) {
- _updateMeta(iconURL: iconURL);
- },
+ setCover: (String coverURL) => _updateMeta(coverURL: coverURL),
+ setIcon: (String iconURL) => _updateMeta(iconURL: iconURL),
didReceiveFieldUpdate: (updatedField) {
emit(
state.copyWith(
@@ -51,15 +60,6 @@ class RowBannerBloc extends Bloc<RowBannerEvent, RowBannerState> {
);
}
- @override
- Future<void> close() async {
- await _metaListener.stop();
- await _fieldListener?.stop();
- _fieldListener = null;
-
- return super.close();
- }
-
Future<void> _loadPrimaryField() async {
final fieldOrError =
await FieldBackendService.getPrimaryField(viewId: viewId);
diff --git a/frontend/appflowy_flutter/lib/plugins/database/application/row/row_cache.dart b/frontend/appflowy_flutter/lib/plugins/database/application/row/row_cache.dart
index 6e1d1b5cde..9482c4add0 100644
--- a/frontend/appflowy_flutter/lib/plugins/database/application/row/row_cache.dart
+++ b/frontend/appflowy_flutter/lib/plugins/database/application/row/row_cache.dart
@@ -28,6 +28,24 @@ abstract mixin class RowLifeCycle {
/// Read https://appflowy.gitbook.io/docs/essential-documentation/contribute-to-appflowy/architecture/frontend/grid for more information.
class RowCache {
+ RowCache({
+ required this.viewId,
+ required RowFieldsDelegate fieldsDelegate,
+ required RowLifeCycle rowLifeCycle,
+ }) : _cellMemCache = CellMemCache(),
+ _changedNotifier = RowChangesetNotifier(),
+ _rowLifeCycle = rowLifeCycle,
+ _fieldDelegate = fieldsDelegate {
+ // Listen to field changes. If a field is deleted, we can safely remove the
+ // cells corresponding to that field from our cache.
+ fieldsDelegate.onFieldsChanged((fieldInfos) {
+ for (final fieldInfo in fieldInfos) {
+ _cellMemCache.removeCellWithFieldId(fieldInfo.id);
+ }
+ _changedNotifier.receive(const ChangedReason.fieldDidChange());
+ });
+ }
+
final String viewId;
final RowList _rowList = RowList();
final CellMemCache _cellMemCache;
@@ -49,24 +67,6 @@ class RowCache {
CellMemCache get cellCache => _cellMemCache;
ChangedReason get changeReason => _changedNotifier.reason;
- RowCache({
- required this.viewId,
- required RowFieldsDelegate fieldsDelegate,
- required RowLifeCycle rowLifeCycle,
- }) : _cellMemCache = CellMemCache(),
- _changedNotifier = RowChangesetNotifier(),
- _rowLifeCycle = rowLifeCycle,
- _fieldDelegate = fieldsDelegate {
- // Listen to field changes. If a field is deleted, we can safely remove the
- // cells corresponding to that field from our cache.
- fieldsDelegate.onFieldsChanged((fieldInfos) {
- for (final fieldInfo in fieldInfos) {
- _cellMemCache.removeCellWithFieldId(fieldInfo.id);
- }
- _changedNotifier.receive(const ChangedReason.fieldDidChange());
- });
- }
-
RowInfo? getRow(RowId rowId) {
return _rowList.get(rowId);
}
@@ -262,10 +262,10 @@ class RowCache {
}
class RowChangesetNotifier extends ChangeNotifier {
- ChangedReason reason = const InitialListState();
-
RowChangesetNotifier();
+ ChangedReason reason = const InitialListState();
+
void receive(ChangedReason newReason) {
reason = newReason;
reason.map(
@@ -313,28 +313,31 @@ class ChangedReason with _$ChangedReason {
}
class InsertedIndex {
- final int index;
- final RowId rowId;
InsertedIndex({
required this.index,
required this.rowId,
});
+
+ final int index;
+ final RowId rowId;
}
class DeletedIndex {
- final int index;
- final RowInfo rowInfo;
DeletedIndex({
required this.index,
required this.rowInfo,
});
+
+ final int index;
+ final RowInfo rowInfo;
}
class UpdatedIndex {
- final int index;
- final RowId rowId;
UpdatedIndex({
required this.index,
required this.rowId,
});
+
+ final int index;
+ final RowId rowId;
}
diff --git a/frontend/appflowy_flutter/lib/plugins/database/application/row/row_controller.dart b/frontend/appflowy_flutter/lib/plugins/database/application/row/row_controller.dart
index 0212c28f51..b34beba275 100644
--- a/frontend/appflowy_flutter/lib/plugins/database/application/row/row_controller.dart
+++ b/frontend/appflowy_flutter/lib/plugins/database/application/row/row_controller.dart
@@ -8,6 +8,13 @@ import 'row_cache.dart';
typedef OnRowChanged = void Function(List<CellContext>, ChangedReason);
class RowController {
+ RowController({
+ required this.rowMeta,
+ required this.viewId,
+ required RowCache rowCache,
+ this.groupId,
+ }) : _rowCache = rowCache;
+
final RowMetaPB rowMeta;
final String? groupId;
final String viewId;
@@ -18,16 +25,7 @@ class RowController {
String get rowId => rowMeta.id;
- RowController({
- required this.rowMeta,
- required this.viewId,
- required RowCache rowCache,
- this.groupId,
- }) : _rowCache = rowCache;
-
- List<CellContext> loadData() {
- return _rowCache.loadCells(rowMeta);
- }
+ List<CellContext> loadData() => _rowCache.loadCells(rowMeta);
void addListener({OnRowChanged? onRowChanged}) {
final fn = _rowCache.addListener(
diff --git a/frontend/appflowy_flutter/lib/plugins/database/application/row/row_listener.dart b/frontend/appflowy_flutter/lib/plugins/database/application/row/row_listener.dart
index 3854fff56b..2e1b78d3b3 100644
--- a/frontend/appflowy_flutter/lib/plugins/database/application/row/row_listener.dart
+++ b/frontend/appflowy_flutter/lib/plugins/database/application/row/row_listener.dart
@@ -10,11 +10,13 @@ typedef DidFetchRowCallback = void Function(DidFetchRowPB);
typedef RowMetaCallback = void Function(RowMetaPB);
class RowListener {
+ RowListener(this.rowId);
+
final String rowId;
+
DidFetchRowCallback? _onRowFetchedCallback;
RowMetaCallback? _onMetaChangedCallback;
DatabaseNotificationListener? _listener;
- RowListener(this.rowId);
/// OnMetaChanged will be called when the row meta is changed.
/// OnRowFetched will be called when the row is fetched from remote storage
diff --git a/frontend/appflowy_flutter/lib/plugins/database/application/row/row_meta_listener.dart b/frontend/appflowy_flutter/lib/plugins/database/application/row/row_meta_listener.dart
index d696240e84..4836ec7a12 100644
--- a/frontend/appflowy_flutter/lib/plugins/database/application/row/row_meta_listener.dart
+++ b/frontend/appflowy_flutter/lib/plugins/database/application/row/row_meta_listener.dart
@@ -9,10 +9,12 @@ import 'package:dartz/dartz.dart';
typedef RowMetaCallback = void Function(RowMetaPB);
class RowMetaListener {
+ RowMetaListener(this.rowId);
+
final String rowId;
+
RowMetaCallback? _callback;
DatabaseNotificationListener? _listener;
- RowMetaListener(this.rowId);
void start({required RowMetaCallback callback}) {
_callback = callback;
diff --git a/frontend/appflowy_flutter/lib/plugins/database/application/row/row_service.dart b/frontend/appflowy_flutter/lib/plugins/database/application/row/row_service.dart
index 0160a78989..18ece0708d 100644
--- a/frontend/appflowy_flutter/lib/plugins/database/application/row/row_service.dart
+++ b/frontend/appflowy_flutter/lib/plugins/database/application/row/row_service.dart
@@ -8,11 +8,9 @@ import '../field/field_info.dart';
typedef RowId = String;
class RowBackendService {
- final String viewId;
+ RowBackendService({required this.viewId});
- RowBackendService({
- required this.viewId,
- });
+ final String viewId;
static Future<Either<RowMetaPB, FlowyError>> createRow({
required String viewId,
diff --git a/frontend/appflowy_flutter/lib/plugins/database/application/setting/group_bloc.dart b/frontend/appflowy_flutter/lib/plugins/database/application/setting/group_bloc.dart
index a5c60fd868..41b89dca5c 100644
--- a/frontend/appflowy_flutter/lib/plugins/database/application/setting/group_bloc.dart
+++ b/frontend/appflowy_flutter/lib/plugins/database/application/setting/group_bloc.dart
@@ -1,3 +1,5 @@
+import 'dart:async';
+
import 'package:appflowy/plugins/database/application/database_controller.dart';
import 'package:appflowy/plugins/database/application/field/field_info.dart';
import 'package:appflowy_backend/log.dart';
@@ -5,18 +7,12 @@ import 'package:appflowy_backend/protobuf/flowy-database2/board_entities.pb.dart
import 'package:appflowy_backend/protobuf/flowy-database2/field_entities.pb.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:freezed_annotation/freezed_annotation.dart';
-import 'dart:async';
import '../group/group_service.dart';
part 'group_bloc.freezed.dart';
class DatabaseGroupBloc extends Bloc<DatabaseGroupEvent, DatabaseGroupState> {
- final DatabaseController _databaseController;
- final GroupBackendService _groupBackendSvc;
- Function(List<FieldInfo>)? _onFieldsFn;
- DatabaseLayoutSettingCallbacks? _layoutSettingCallbacks;
-
DatabaseGroupBloc({
required String viewId,
required DatabaseController databaseController,
@@ -29,6 +25,26 @@ class DatabaseGroupBloc extends Bloc<DatabaseGroupEvent, DatabaseGroupState> {
databaseController.databaseLayoutSetting!.board,
),
) {
+ _dispatch();
+ }
+
+ final DatabaseController _databaseController;
+ final GroupBackendService _groupBackendSvc;
+ Function(List<FieldInfo>)? _onFieldsFn;
+ DatabaseLayoutSettingCallbacks? _layoutSettingCallbacks;
+
+ @override
+ Future<void> close() async {
+ if (_onFieldsFn != null) {
+ _databaseController.fieldController
+ .removeListener(onFieldsListener: _onFieldsFn!);
+ _onFieldsFn = null;
+ }
+ _layoutSettingCallbacks = null;
+ return super.close();
+ }
+
+ void _dispatch() {
on<DatabaseGroupEvent>(
(event, emit) async {
event.when(
@@ -52,17 +68,6 @@ class DatabaseGroupBloc extends Bloc<DatabaseGroupEvent, DatabaseGroupState> {
);
}
- @override
- Future<void> close() async {
- if (_onFieldsFn != null) {
- _databaseController.fieldController
- .removeListener(onFieldsListener: _onFieldsFn!);
- _onFieldsFn = null;
- }
- _layoutSettingCallbacks = null;
- return super.close();
- }
-
void _startListening() {
_onFieldsFn = (fieldInfos) =>
add(DatabaseGroupEvent.didReceiveFieldUpdate(fieldInfos));
diff --git a/frontend/appflowy_flutter/lib/plugins/database/application/setting/property_bloc.dart b/frontend/appflowy_flutter/lib/plugins/database/application/setting/property_bloc.dart
index 6765fef964..9bcd66355f 100644
--- a/frontend/appflowy_flutter/lib/plugins/database/application/setting/property_bloc.dart
+++ b/frontend/appflowy_flutter/lib/plugins/database/application/setting/property_bloc.dart
@@ -14,16 +14,32 @@ part 'property_bloc.freezed.dart';
class DatabasePropertyBloc
extends Bloc<DatabasePropertyEvent, DatabasePropertyState> {
- final FieldController _fieldController;
- Function(List<FieldInfo>)? _onFieldsFn;
-
DatabasePropertyBloc({
required String viewId,
required FieldController fieldController,
}) : _fieldController = fieldController,
super(
- DatabasePropertyState.initial(viewId, fieldController.fieldInfos),
+ DatabasePropertyState.initial(
+ viewId,
+ fieldController.fieldInfos,
+ ),
) {
+ _dispatch();
+ }
+
+ final FieldController _fieldController;
+ Function(List<FieldInfo>)? _onFieldsFn;
+
+ @override
+ Future<void> close() async {
+ if (_onFieldsFn != null) {
+ _fieldController.removeListener(onFieldsListener: _onFieldsFn!);
+ _onFieldsFn = null;
+ }
+ return super.close();
+ }
+
+ void _dispatch() {
on<DatabasePropertyEvent>(
(event, emit) async {
await event.when(
@@ -31,9 +47,8 @@ class DatabasePropertyBloc
_startListening();
},
setFieldVisibility: (fieldId, visibility) async {
- final fieldSettingsSvc = FieldSettingsBackendService(
- viewId: viewId,
- );
+ final fieldSettingsSvc =
+ FieldSettingsBackendService(viewId: state.viewId);
final result = await fieldSettingsSvc.updateFieldSettings(
fieldId: fieldId,
@@ -57,7 +72,7 @@ class DatabasePropertyBloc
emit(state.copyWith(fieldContexts: fieldContexts));
final result = await FieldBackendService.moveField(
- viewId: viewId,
+ viewId: state.viewId,
fromFieldId: fromId,
toFieldId: toId,
);
@@ -69,15 +84,6 @@ class DatabasePropertyBloc
);
}
- @override
- Future<void> close() async {
- if (_onFieldsFn != null) {
- _fieldController.removeListener(onFieldsListener: _onFieldsFn!);
- _onFieldsFn = null;
- }
- return super.close();
- }
-
void _startListening() {
_onFieldsFn =
(fields) => add(DatabasePropertyEvent.didReceiveFieldUpdate(fields));
diff --git a/frontend/appflowy_flutter/lib/plugins/database/application/setting/setting_controller.dart b/frontend/appflowy_flutter/lib/plugins/database/application/setting/setting_controller.dart
index f1b827df92..2147b4d1de 100644
--- a/frontend/appflowy_flutter/lib/plugins/database/application/setting/setting_controller.dart
+++ b/frontend/appflowy_flutter/lib/plugins/database/application/setting/setting_controller.dart
@@ -7,14 +7,6 @@ typedef OnError = void Function(FlowyError);
typedef OnSettingUpdated = void Function(DatabaseViewSettingPB);
class SettingController {
- final String viewId;
- final SettingBackendService _settingBackendSvc;
- final DatabaseSettingListener _listener;
- OnSettingUpdated? _onSettingUpdated;
- OnError? _onError;
- DatabaseViewSettingPB? _setting;
- DatabaseViewSettingPB? get setting => _setting;
-
SettingController({
required this.viewId,
}) : _settingBackendSvc = SettingBackendService(viewId: viewId),
@@ -38,6 +30,15 @@ class SettingController {
);
}
+ final String viewId;
+ final SettingBackendService _settingBackendSvc;
+ final DatabaseSettingListener _listener;
+
+ OnSettingUpdated? _onSettingUpdated;
+ OnError? _onError;
+ DatabaseViewSettingPB? _setting;
+ DatabaseViewSettingPB? get setting => _setting;
+
void startListening({
required OnSettingUpdated onSettingUpdated,
required OnError onError,
diff --git a/frontend/appflowy_flutter/lib/plugins/database/application/setting/setting_listener.dart b/frontend/appflowy_flutter/lib/plugins/database/application/setting/setting_listener.dart
index b9be9becf3..2778e841ab 100644
--- a/frontend/appflowy_flutter/lib/plugins/database/application/setting/setting_listener.dart
+++ b/frontend/appflowy_flutter/lib/plugins/database/application/setting/setting_listener.dart
@@ -10,13 +10,14 @@ import 'package:appflowy_backend/protobuf/flowy-database2/setting_entities.pb.da
typedef UpdateSettingNotifiedValue = Either<DatabaseViewSettingPB, FlowyError>;
class DatabaseSettingListener {
+ DatabaseSettingListener({required this.viewId});
+
final String viewId;
+
DatabaseNotificationListener? _listener;
PublishNotifier<UpdateSettingNotifiedValue>? _updateSettingNotifier =
PublishNotifier();
- DatabaseSettingListener({required this.viewId});
-
void start({
required void Function(UpdateSettingNotifiedValue) onSettingUpdated,
}) {
diff --git a/frontend/appflowy_flutter/lib/plugins/database/application/setting/setting_service.dart b/frontend/appflowy_flutter/lib/plugins/database/application/setting/setting_service.dart
index 436acad0b2..d0a1c8a312 100644
--- a/frontend/appflowy_flutter/lib/plugins/database/application/setting/setting_service.dart
+++ b/frontend/appflowy_flutter/lib/plugins/database/application/setting/setting_service.dart
@@ -5,10 +5,10 @@ import 'package:appflowy_backend/protobuf/flowy-error/errors.pb.dart';
import 'package:appflowy_backend/protobuf/flowy-database2/setting_entities.pb.dart';
class SettingBackendService {
- final String viewId;
-
const SettingBackendService({required this.viewId});
+ final String viewId;
+
Future<Either<DatabaseViewSettingPB, FlowyError>> getSetting() {
final payload = DatabaseViewIdPB.create()..value = viewId;
return DatabaseEventGetDatabaseSetting(payload).send();
diff --git a/frontend/appflowy_flutter/lib/plugins/database/application/sort/sort_listener.dart b/frontend/appflowy_flutter/lib/plugins/database/application/sort/sort_listener.dart
index 64ae13787f..64960d087c 100644
--- a/frontend/appflowy_flutter/lib/plugins/database/application/sort/sort_listener.dart
+++ b/frontend/appflowy_flutter/lib/plugins/database/application/sort/sort_listener.dart
@@ -10,12 +10,13 @@ import 'package:appflowy_backend/protobuf/flowy-database2/sort_entities.pb.dart'
typedef SortNotifiedValue = Either<SortChangesetNotificationPB, FlowyError>;
class SortsListener {
+ SortsListener({required this.viewId});
+
final String viewId;
+
PublishNotifier<SortNotifiedValue>? _notifier = PublishNotifier();
DatabaseNotificationListener? _listener;
- SortsListener({required this.viewId});
-
void start({
required void Function(SortNotifiedValue) onSortChanged,
}) {
diff --git a/frontend/appflowy_flutter/lib/plugins/database/application/sort/sort_service.dart b/frontend/appflowy_flutter/lib/plugins/database/application/sort/sort_service.dart
index 79be9083a8..871bb9d86f 100644
--- a/frontend/appflowy_flutter/lib/plugins/database/application/sort/sort_service.dart
+++ b/frontend/appflowy_flutter/lib/plugins/database/application/sort/sort_service.dart
@@ -8,10 +8,10 @@ import 'package:appflowy_backend/protobuf/flowy-database2/setting_entities.pb.da
import 'package:appflowy_backend/protobuf/flowy-database2/sort_entities.pb.dart';
class SortBackendService {
- final String viewId;
-
SortBackendService({required this.viewId});
+ final String viewId;
+
Future<Either<List<SortPB>, FlowyError>> getAllSorts() {
final payload = DatabaseViewIdPB()..value = viewId;
diff --git a/frontend/appflowy_flutter/lib/plugins/database/application/tab_bar_bloc.dart b/frontend/appflowy_flutter/lib/plugins/database/application/tab_bar_bloc.dart
index 19528c7d7f..b04ea0eb2a 100644
--- a/frontend/appflowy_flutter/lib/plugins/database/application/tab_bar_bloc.dart
+++ b/frontend/appflowy_flutter/lib/plugins/database/application/tab_bar_bloc.dart
@@ -17,10 +17,8 @@ part 'tab_bar_bloc.freezed.dart';
class DatabaseTabBarBloc
extends Bloc<DatabaseTabBarEvent, DatabaseTabBarState> {
- DatabaseTabBarBloc({
- bool isInlineView = false,
- required ViewPB view,
- }) : super(DatabaseTabBarState.initial(view)) {
+ DatabaseTabBarBloc({required ViewPB view})
+ : super(DatabaseTabBarState.initial(view)) {
on<DatabaseTabBarEvent>(
(event, emit) async {
event.when(
@@ -247,6 +245,12 @@ class DatabaseTabBarState with _$DatabaseTabBarState {
}
class DatabaseTabBar extends Equatable {
+ DatabaseTabBar({
+ required this.view,
+ }) : _builder = PlatformExtension.isMobile
+ ? view.mobileTabBarItem()
+ : view.tabBarItem();
+
final ViewPB view;
final DatabaseTabBarItemBuilder _builder;
@@ -254,12 +258,6 @@ class DatabaseTabBar extends Equatable {
DatabaseTabBarItemBuilder get builder => _builder;
ViewLayoutPB get layout => view.layout;
- DatabaseTabBar({
- required this.view,
- }) : _builder = PlatformExtension.isMobile
- ? view.mobileTabBarItem()
- : view.tabBarItem();
-
@override
List<Object?> get props => [view.hashCode];
}
@@ -270,20 +268,11 @@ typedef OnViewChildViewChanged = void Function(
);
class DatabaseTabBarController {
- ViewPB view;
- final DatabaseController controller;
- final ViewListener viewListener;
- OnViewUpdated? onViewUpdated;
- OnViewChildViewChanged? onViewChildViewChanged;
-
- DatabaseTabBarController({
- required this.view,
- }) : controller = DatabaseController(view: view),
+ DatabaseTabBarController({required this.view})
+ : controller = DatabaseController(view: view),
viewListener = ViewListener(viewId: view.id) {
viewListener.start(
- onViewChildViewsUpdated: (update) {
- onViewChildViewChanged?.call(update);
- },
+ onViewChildViewsUpdated: (update) => onViewChildViewChanged?.call(update),
onViewUpdated: (newView) {
view = newView;
onViewUpdated?.call(newView);
@@ -291,6 +280,12 @@ class DatabaseTabBarController {
);
}
+ ViewPB view;
+ final DatabaseController controller;
+ final ViewListener viewListener;
+ OnViewUpdated? onViewUpdated;
+ OnViewChildViewChanged? onViewChildViewChanged;
+
Future<void> dispose() async {
await viewListener.stop();
await controller.dispose();
diff --git a/frontend/appflowy_flutter/lib/plugins/database/application/view/view_cache.dart b/frontend/appflowy_flutter/lib/plugins/database/application/view/view_cache.dart
index 663e52b43c..2c1a92783a 100644
--- a/frontend/appflowy_flutter/lib/plugins/database/application/view/view_cache.dart
+++ b/frontend/appflowy_flutter/lib/plugins/database/application/view/view_cache.dart
@@ -8,6 +8,13 @@ import '../row/row_cache.dart';
import 'view_listener.dart';
class DatabaseViewCallbacks {
+ const DatabaseViewCallbacks({
+ this.onNumOfRowsChanged,
+ this.onRowsCreated,
+ this.onRowsUpdated,
+ this.onRowsDeleted,
+ });
+
/// Will get called when number of rows were changed that includes
/// update/delete/insert rows. The [onNumOfRowsChanged] will return all
/// the rows of the current database
@@ -21,27 +28,10 @@ class DatabaseViewCallbacks {
/// Will get called when number of rows were deleted
final OnRowsDeleted? onRowsDeleted;
-
- const DatabaseViewCallbacks({
- this.onNumOfRowsChanged,
- this.onRowsCreated,
- this.onRowsUpdated,
- this.onRowsDeleted,
- });
}
/// Read https://appflowy.gitbook.io/docs/essential-documentation/contribute-to-appflowy/architecture/frontend/grid for more information
class DatabaseViewCache {
- final String viewId;
- late RowCache _rowCache;
- final DatabaseViewListener _databaseViewListener;
- final List<DatabaseViewCallbacks> _callbacks = [];
-
- UnmodifiableListView<RowInfo> get rowInfos => _rowCache.rowInfos;
- RowCache get rowCache => _rowCache;
-
- RowInfo? getRow(RowId rowId) => _rowCache.getRow(rowId);
-
DatabaseViewCache({
required this.viewId,
required FieldController fieldController,
@@ -54,73 +44,72 @@ class DatabaseViewCache {
);
_databaseViewListener.start(
- onRowsChanged: (result) {
- result.fold(
- (changeset) {
- // Update the cache
- _rowCache.applyRowsChanged(changeset);
-
- if (changeset.deletedRows.isNotEmpty) {
- for (final callback in _callbacks) {
- callback.onRowsDeleted?.call(changeset.deletedRows);
- }
+ onRowsChanged: (result) => result.fold(
+ (changeset) {
+ // Update the cache
+ _rowCache.applyRowsChanged(changeset);
+
+ if (changeset.deletedRows.isNotEmpty) {
+ for (final callback in _callbacks) {
+ callback.onRowsDeleted?.call(changeset.deletedRows);
}
-
- if (changeset.updatedRows.isNotEmpty) {
- for (final callback in _callbacks) {
- callback.onRowsUpdated?.call(
- changeset.updatedRows.map((e) => e.rowId).toList(),
- _rowCache.changeReason,
- );
- }
+ }
+
+ if (changeset.updatedRows.isNotEmpty) {
+ for (final callback in _callbacks) {
+ callback.onRowsUpdated?.call(
+ changeset.updatedRows.map((e) => e.rowId).toList(),
+ _rowCache.changeReason,
+ );
}
-
- if (changeset.insertedRows.isNotEmpty) {
- for (final callback in _callbacks) {
- callback.onRowsCreated?.call(
- changeset.insertedRows
- .map((insertedRow) => insertedRow.rowMeta.id)
- .toList(),
- );
- }
+ }
+
+ if (changeset.insertedRows.isNotEmpty) {
+ for (final callback in _callbacks) {
+ callback.onRowsCreated?.call(
+ changeset.insertedRows
+ .map((insertedRow) => insertedRow.rowMeta.id)
+ .toList(),
+ );
}
- },
- (err) => Log.error(err),
- );
- },
- onRowsVisibilityChanged: (result) {
- result.fold(
- (changeset) => _rowCache.applyRowsVisibility(changeset),
- (err) => Log.error(err),
- );
- },
- onReorderAllRows: (result) {
- result.fold(
- (rowIds) => _rowCache.reorderAllRows(rowIds),
- (err) => Log.error(err),
- );
- },
- onReorderSingleRow: (result) {
- result.fold(
- (reorderRow) => _rowCache.reorderSingleRow(reorderRow),
- (err) => Log.error(err),
- );
- },
+ }
+ },
+ (err) => Log.error(err),
+ ),
+ onRowsVisibilityChanged: (result) => result.fold(
+ (changeset) => _rowCache.applyRowsVisibility(changeset),
+ (err) => Log.error(err),
+ ),
+ onReorderAllRows: (result) => result.fold(
+ (rowIds) => _rowCache.reorderAllRows(rowIds),
+ (err) => Log.error(err),
+ ),
+ onReorderSingleRow: (result) => result.fold(
+ (reorderRow) => _rowCache.reorderSingleRow(reorderRow),
+ (err) => Log.error(err),
+ ),
);
_rowCache.onRowsChanged(
(reason) {
for (final callback in _callbacks) {
- callback.onNumOfRowsChanged?.call(
- rowInfos,
- _rowCache.rowByRowId,
- reason,
- );
+ callback.onNumOfRowsChanged
+ ?.call(rowInfos, _rowCache.rowByRowId, reason);
}
},
);
}
+ final String viewId;
+ late RowCache _rowCache;
+ final DatabaseViewListener _databaseViewListener;
+ final List<DatabaseViewCallbacks> _callbacks = [];
+
+ UnmodifiableListView<RowInfo> get rowInfos => _rowCache.rowInfos;
+ RowCache get rowCache => _rowCache;
+
+ RowInfo? getRow(RowId rowId) => _rowCache.getRow(rowId);
+
Future<void> dispose() async {
await _databaseViewListener.stop();
_rowCache.dispose();
diff --git a/frontend/appflowy_flutter/lib/plugins/database/application/view/view_listener.dart b/frontend/appflowy_flutter/lib/plugins/database/application/view/view_listener.dart
index 155b87097f..c07ea4b4c1 100644
--- a/frontend/appflowy_flutter/lib/plugins/database/application/view/view_listener.dart
+++ b/frontend/appflowy_flutter/lib/plugins/database/application/view/view_listener.dart
@@ -16,7 +16,10 @@ typedef ReorderAllRowsNotifierValue = Either<List<String>, FlowyError>;
typedef SingleRowNotifierValue = Either<ReorderSingleRowPB, FlowyError>;
class DatabaseViewListener {
+ DatabaseViewListener({required this.viewId});
+
final String viewId;
+
PublishNotifier<NumberOfRowsNotifierValue>? _rowsNotifier = PublishNotifier();
PublishNotifier<ReorderAllRowsNotifierValue>? _reorderAllRows =
PublishNotifier();
@@ -26,7 +29,6 @@ class DatabaseViewListener {
PublishNotifier();
DatabaseNotificationListener? _listener;
- DatabaseViewListener({required this.viewId});
void start({
required void Function(NumberOfRowsNotifierValue) onRowsChanged,
diff --git a/frontend/appflowy_flutter/lib/plugins/database/board/application/board_bloc.dart b/frontend/appflowy_flutter/lib/plugins/database/board/application/board_bloc.dart
index 74320c81e4..00128d1eec 100644
--- a/frontend/appflowy_flutter/lib/plugins/database/board/application/board_bloc.dart
+++ b/frontend/appflowy_flutter/lib/plugins/database/board/application/board_bloc.dart
@@ -1,52 +1,42 @@
import 'dart:async';
import 'dart:collection';
+import 'package:flutter/foundation.dart';
+
import 'package:appflowy/plugins/database/application/defines.dart';
import 'package:appflowy/plugins/database/application/field/field_info.dart';
import 'package:appflowy/plugins/database/application/group/group_service.dart';
import 'package:appflowy/plugins/database/application/row/row_service.dart';
-import 'package:appflowy_board/appflowy_board.dart';
-import 'package:dartz/dartz.dart';
import 'package:appflowy_backend/log.dart';
+import 'package:appflowy_backend/protobuf/flowy-database2/protobuf.dart';
import 'package:appflowy_backend/protobuf/flowy-error/errors.pb.dart';
import 'package:appflowy_backend/protobuf/flowy-folder/view.pb.dart';
-import 'package:appflowy_backend/protobuf/flowy-database2/protobuf.dart';
-import 'package:flutter/foundation.dart';
+import 'package:appflowy_board/appflowy_board.dart';
+import 'package:dartz/dartz.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:freezed_annotation/freezed_annotation.dart';
import 'package:protobuf/protobuf.dart' hide FieldInfo;
+import '../../application/database_controller.dart';
import '../../application/field/field_controller.dart';
import '../../application/row/row_cache.dart';
-import '../../application/database_controller.dart';
+
import 'group_controller.dart';
part 'board_bloc.freezed.dart';
class BoardBloc extends Bloc<BoardEvent, BoardState> {
- final DatabaseController databaseController;
- final LinkedHashMap<String, GroupController> groupControllers =
- LinkedHashMap();
- final List<GroupPB> groupList = [];
-
- late final GroupBackendService groupBackendSvc;
- late final AppFlowyBoardController boardController;
-
- FieldController get fieldController => databaseController.fieldController;
- String get viewId => databaseController.viewId;
-
BoardBloc({
required ViewPB view,
required this.databaseController,
}) : super(BoardState.initial(view.id)) {
groupBackendSvc = GroupBackendService(viewId);
boardController = AppFlowyBoardController(
- onMoveGroup: (fromGroupId, fromIndex, toGroupId, toIndex) {
- databaseController.moveGroup(
- fromGroupId: fromGroupId,
- toGroupId: toGroupId,
- );
- },
+ onMoveGroup: (fromGroupId, fromIndex, toGroupId, toIndex) =>
+ databaseController.moveGroup(
+ fromGroupId: fromGroupId,
+ toGroupId: toGroupId,
+ ),
onMoveGroupItem: (groupId, fromIndex, toIndex) {
final fromRow = groupControllers[groupId]?.rowAtIndex(fromIndex);
final toRow = groupControllers[groupId]?.rowAtIndex(toIndex);
@@ -73,6 +63,21 @@ class BoardBloc extends Bloc<BoardEvent, BoardState> {
},
);
+ _dispatch();
+ }
+
+ final DatabaseController databaseController;
+ final LinkedHashMap<String, GroupController> groupControllers =
+ LinkedHashMap();
+ final List<GroupPB> groupList = [];
+
+ late final AppFlowyBoardController boardController;
+ late final GroupBackendService groupBackendSvc;
+
+ FieldController get fieldController => databaseController.fieldController;
+ String get viewId => databaseController.viewId;
+
+ void _dispatch() {
on<BoardEvent>(
(event, emit) async {
await event.when(
@@ -93,9 +98,7 @@ class BoardBloc extends Bloc<BoardEvent, BoardState> {
);
result.fold(
- (rowMeta) {
- emit(state.copyWith(recentAddedRowMeta: rowMeta));
- },
+ (rowMeta) => emit(state.copyWith(recentAddedRowMeta: rowMeta)),
(err) => Log.error(err),
);
},
@@ -112,9 +115,7 @@ class BoardBloc extends Bloc<BoardEvent, BoardState> {
);
result.fold(
- (rowMeta) {
- emit(state.copyWith(recentAddedRowMeta: rowMeta));
- },
+ (rowMeta) => emit(state.copyWith(recentAddedRowMeta: rowMeta)),
(err) => Log.error(err),
);
},
@@ -465,7 +466,6 @@ class BoardBloc extends Bloc<BoardEvent, BoardState> {
);
final controller = GroupController(
- viewId: state.viewId,
group: group,
delegate: delegate,
onGroupChanged: (newGroup) {
@@ -574,9 +574,6 @@ List<GroupPB> _filterHiddenGroups(bool hideUngrouped, List<GroupPB> groups) {
}
class GroupItem extends AppFlowyGroupItem {
- final RowMetaPB row;
- final FieldInfo fieldInfo;
-
GroupItem({
required this.row,
required this.fieldInfo,
@@ -585,25 +582,26 @@ class GroupItem extends AppFlowyGroupItem {
super.draggable = draggable;
}
+ final RowMetaPB row;
+ final FieldInfo fieldInfo;
+
@override
String get id => row.id.toString();
}
class GroupControllerDelegateImpl extends GroupControllerDelegate {
- final FieldController fieldController;
- final AppFlowyBoardController controller;
- final void Function(String, RowMetaPB, int?) onNewColumnItem;
-
GroupControllerDelegateImpl({
required this.controller,
required this.fieldController,
required this.onNewColumnItem,
});
+ final FieldController fieldController;
+ final AppFlowyBoardController controller;
+ final void Function(String, RowMetaPB, int?) onNewColumnItem;
+
@override
- bool hasGroup(String groupId) {
- return controller.groupIds.contains(groupId);
- }
+ bool hasGroup(String groupId) => controller.groupIds.contains(groupId);
@override
void insertRow(GroupPB group, RowMetaPB row, int? index) {
@@ -667,15 +665,15 @@ class GroupControllerDelegateImpl extends GroupControllerDelegate {
}
class BoardEditingRow {
- GroupPB group;
- RowMetaPB row;
- int? index;
-
BoardEditingRow({
required this.group,
required this.row,
required this.index,
});
+
+ GroupPB group;
+ RowMetaPB row;
+ int? index;
}
class GroupData {
diff --git a/frontend/appflowy_flutter/lib/plugins/database/board/application/group_controller.dart b/frontend/appflowy_flutter/lib/plugins/database/board/application/group_controller.dart
index 8c4e58fbd4..404d84aff4 100644
--- a/frontend/appflowy_flutter/lib/plugins/database/board/application/group_controller.dart
+++ b/frontend/appflowy_flutter/lib/plugins/database/board/application/group_controller.dart
@@ -20,18 +20,17 @@ abstract class GroupControllerDelegate {
}
class GroupController {
- GroupPB group;
- final SingleGroupListener _listener;
- final GroupControllerDelegate delegate;
- final void Function(GroupPB group) onGroupChanged;
-
GroupController({
- required String viewId,
required this.group,
required this.delegate,
required this.onGroupChanged,
}) : _listener = SingleGroupListener(group);
+ GroupPB group;
+ final SingleGroupListener _listener;
+ final GroupControllerDelegate delegate;
+ final void Function(GroupPB group) onGroupChanged;
+
RowMetaPB? rowAtIndex(int index) {
if (index < group.rows.length) {
return group.rows[index];
@@ -116,10 +115,12 @@ class GroupController {
typedef UpdateGroupNotifiedValue = Either<GroupRowsNotificationPB, FlowyError>;
class SingleGroupListener {
+ SingleGroupListener(this.group);
+
final GroupPB group;
+
PublishNotifier<UpdateGroupNotifiedValue>? _groupNotifier = PublishNotifier();
DatabaseNotificationListener? _listener;
- SingleGroupListener(this.group);
void start({
required void Function(UpdateGroupNotifiedValue) onGroupChanged,
diff --git a/frontend/appflowy_flutter/lib/plugins/database/board/application/toolbar/board_setting_bloc.dart b/frontend/appflowy_flutter/lib/plugins/database/board/application/toolbar/board_setting_bloc.dart
index 4eb4440f11..3c4c2abb3a 100644
--- a/frontend/appflowy_flutter/lib/plugins/database/board/application/toolbar/board_setting_bloc.dart
+++ b/frontend/appflowy_flutter/lib/plugins/database/board/application/toolbar/board_setting_bloc.dart
@@ -1,11 +1,10 @@
+import 'package:dartz/dartz.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:freezed_annotation/freezed_annotation.dart';
-import 'package:dartz/dartz.dart';
part 'board_setting_bloc.freezed.dart';
class BoardSettingBloc extends Bloc<BoardSettingEvent, BoardSettingState> {
- final String viewId;
BoardSettingBloc({required this.viewId})
: super(BoardSettingState.initial()) {
on<BoardSettingEvent>(
@@ -18,6 +17,8 @@ class BoardSettingBloc extends Bloc<BoardSettingEvent, BoardSettingState> {
},
);
}
+
+ final String viewId;
}
@freezed
diff --git a/frontend/appflowy_flutter/lib/plugins/database/board/presentation/board_page.dart b/frontend/appflowy_flutter/lib/plugins/database/board/presentation/board_page.dart
index 6034af1607..4503fa2b20 100644
--- a/frontend/appflowy_flutter/lib/plugins/database/board/presentation/board_page.dart
+++ b/frontend/appflowy_flutter/lib/plugins/database/board/presentation/board_page.dart
@@ -290,13 +290,11 @@ class _DesktopBoardContentState extends State<DesktopBoardContent> {
color: Theme.of(context).brightness == Brightness.light
? const Color(0xFF1F2329).withOpacity(0.12)
: const Color(0xFF59647A),
- width: 1.0,
),
),
boxShadow: [
BoxShadow(
blurRadius: 4,
- spreadRadius: 0,
color: const Color(0xFF1F2329).withOpacity(0.02),
),
BoxShadow(
@@ -424,7 +422,6 @@ class _BoardTrailingState extends State<BoardTrailing> {
isDense: true,
),
style: Theme.of(context).textTheme.bodySmall,
- maxLines: 1,
onSubmitted: (groupName) => context
.read<BoardBloc>()
.add(BoardEvent.createGroup(groupName)),
diff --git a/frontend/appflowy_flutter/lib/plugins/database/board/presentation/toolbar/board_setting_bar.dart b/frontend/appflowy_flutter/lib/plugins/database/board/presentation/toolbar/board_setting_bar.dart
index e143d0072a..4a678a160e 100644
--- a/frontend/appflowy_flutter/lib/plugins/database/board/presentation/toolbar/board_setting_bar.dart
+++ b/frontend/appflowy_flutter/lib/plugins/database/board/presentation/toolbar/board_setting_bar.dart
@@ -3,12 +3,13 @@ import 'package:appflowy/plugins/database/widgets/setting/setting_button.dart';
import 'package:flutter/material.dart';
class BoardSettingBar extends StatelessWidget {
- final DatabaseController databaseController;
const BoardSettingBar({
- required this.databaseController,
super.key,
+ required this.databaseController,
});
+ final DatabaseController databaseController;
+
@override
Widget build(BuildContext context) {
return SizedBox(
diff --git a/frontend/appflowy_flutter/lib/plugins/database/board/presentation/widgets/board_column_header.dart b/frontend/appflowy_flutter/lib/plugins/database/board/presentation/widgets/board_column_header.dart
index 2ba3310f01..22da35deaa 100644
--- a/frontend/appflowy_flutter/lib/plugins/database/board/presentation/widgets/board_column_header.dart
+++ b/frontend/appflowy_flutter/lib/plugins/database/board/presentation/widgets/board_column_header.dart
@@ -151,7 +151,6 @@ class _BoardColumnHeaderState extends State<BoardColumnHeader> {
controller: _controller,
focusNode: _focusNode,
onEditingComplete: _saveEdit,
- maxLines: 1,
style: Theme.of(context).textTheme.bodyMedium!.copyWith(fontSize: 14),
decoration: InputDecoration(
filled: true,
diff --git a/frontend/appflowy_flutter/lib/plugins/database/board/presentation/widgets/board_hidden_groups.dart b/frontend/appflowy_flutter/lib/plugins/database/board/presentation/widgets/board_hidden_groups.dart
index fca7e01520..82b11a0fd1 100644
--- a/frontend/appflowy_flutter/lib/plugins/database/board/presentation/widgets/board_hidden_groups.dart
+++ b/frontend/appflowy_flutter/lib/plugins/database/board/presentation/widgets/board_hidden_groups.dart
@@ -22,9 +22,10 @@ import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
class HiddenGroupsColumn extends StatelessWidget {
- final EdgeInsets margin;
const HiddenGroupsColumn({super.key, required this.margin});
+ final EdgeInsets margin;
+
@override
Widget build(BuildContext context) {
final databaseController = context.read<BoardBloc>().databaseController;
@@ -220,9 +221,6 @@ class _HiddenGroupCardState extends State<HiddenGroupCard> {
}
class HiddenGroupButtonContent extends StatelessWidget {
- final String groupId;
- final int index;
- final BoardBloc bloc;
const HiddenGroupButtonContent({
super.key,
required this.popoverController,
@@ -232,6 +230,9 @@ class HiddenGroupButtonContent extends StatelessWidget {
});
final PopoverController popoverController;
+ final String groupId;
+ final int index;
+ final BoardBloc bloc;
@override
Widget build(BuildContext context) {
@@ -309,15 +310,15 @@ class HiddenGroupButtonContent extends StatelessWidget {
}
class HiddenGroupCardActions extends StatelessWidget {
- final bool isVisible;
- final int index;
-
const HiddenGroupCardActions({
super.key,
required this.isVisible,
required this.index,
});
+ final bool isVisible;
+ final int index;
+
@override
Widget build(BuildContext context) {
return ReorderableDragStartListener(
diff --git a/frontend/appflowy_flutter/lib/plugins/database/calendar/application/calendar_bloc.dart b/frontend/appflowy_flutter/lib/plugins/database/calendar/application/calendar_bloc.dart
index 3fe56be033..0c5c56c30a 100644
--- a/frontend/appflowy_flutter/lib/plugins/database/calendar/application/calendar_bloc.dart
+++ b/frontend/appflowy_flutter/lib/plugins/database/calendar/application/calendar_bloc.dart
@@ -5,9 +5,8 @@ import 'package:appflowy/plugins/database/application/field/field_info.dart';
import 'package:appflowy/plugins/database/application/row/row_service.dart';
import 'package:appflowy_backend/dispatch/dispatch.dart';
import 'package:appflowy_backend/log.dart';
-import 'package:appflowy_backend/protobuf/flowy-error/protobuf.dart';
-import 'package:appflowy_backend/protobuf/flowy-folder/protobuf.dart';
import 'package:appflowy_backend/protobuf/flowy-database2/protobuf.dart';
+import 'package:appflowy_backend/protobuf/flowy-error/protobuf.dart';
import 'package:calendar_view/calendar_view.dart';
import 'package:dartz/dartz.dart';
import 'package:fixnum/fixnum.dart';
@@ -20,6 +19,11 @@ import '../../application/row/row_cache.dart';
part 'calendar_bloc.freezed.dart';
class CalendarBloc extends Bloc<CalendarEvent, CalendarState> {
+ CalendarBloc({required this.databaseController})
+ : super(CalendarState.initial()) {
+ _dispatch();
+ }
+
final DatabaseController databaseController;
Map<String, FieldInfo> fieldInfoByFieldId = {};
@@ -29,8 +33,7 @@ class CalendarBloc extends Bloc<CalendarEvent, CalendarState> {
CellMemCache get cellCache => databaseController.rowCache.cellCache;
RowCache get rowCache => databaseController.rowCache;
- CalendarBloc({required ViewPB view, required this.databaseController})
- : super(CalendarState.initial()) {
+ void _dispatch() {
on<CalendarEvent>(
(event, emit) async {
await event.when(
@@ -435,13 +438,13 @@ class CalendarState with _$CalendarState {
}
class CalendarEditingRow {
- RowPB row;
- int? index;
-
CalendarEditingRow({
required this.row,
required this.index,
});
+
+ RowPB row;
+ int? index;
}
@freezed
diff --git a/frontend/appflowy_flutter/lib/plugins/database/calendar/application/calendar_event_editor_bloc.dart b/frontend/appflowy_flutter/lib/plugins/database/calendar/application/calendar_event_editor_bloc.dart
index 5a5a47b34f..a0a5ec0efc 100644
--- a/frontend/appflowy_flutter/lib/plugins/database/calendar/application/calendar_event_editor_bloc.dart
+++ b/frontend/appflowy_flutter/lib/plugins/database/calendar/application/calendar_event_editor_bloc.dart
@@ -12,43 +12,49 @@ part 'calendar_event_editor_bloc.freezed.dart';
class CalendarEventEditorBloc
extends Bloc<CalendarEventEditorEvent, CalendarEventEditorState> {
- final FieldController fieldController;
- final RowController rowController;
- final CalendarLayoutSettingPB layoutSettings;
-
CalendarEventEditorBloc({
required this.fieldController,
required this.rowController,
required this.layoutSettings,
}) : super(CalendarEventEditorState.initial()) {
- on<CalendarEventEditorEvent>((event, emit) async {
- await event.when(
- initial: () {
- _startListening();
- final primaryFieldId = fieldController.fieldInfos
- .firstWhere((fieldInfo) => fieldInfo.isPrimary)
- .id;
- final cells = rowController
- .loadData()
- .where(
- (cellContext) =>
- _filterCellContext(cellContext, primaryFieldId),
- )
- .toList();
- add(CalendarEventEditorEvent.didReceiveCellDatas(cells));
- },
- didReceiveCellDatas: (cells) {
- emit(state.copyWith(cells: cells));
- },
- delete: () async {
- final result = await RowBackendService.deleteRow(
- rowController.viewId,
- rowController.rowId,
- );
- result.fold((l) => null, (err) => Log.error(err));
- },
- );
- });
+ _dispatch();
+ }
+
+ final FieldController fieldController;
+ final RowController rowController;
+ final CalendarLayoutSettingPB layoutSettings;
+
+ void _dispatch() {
+ on<CalendarEventEditorEvent>(
+ (event, emit) async {
+ await event.when(
+ initial: () {
+ _startListening();
+ final primaryFieldId = fieldController.fieldInfos
+ .firstWhere((fieldInfo) => fieldInfo.isPrimary)
+ .id;
+ final cells = rowController
+ .loadData()
+ .where(
+ (cellContext) =>
+ _filterCellContext(cellContext, primaryFieldId),
+ )
+ .toList();
+ add(CalendarEventEditorEvent.didReceiveCellDatas(cells));
+ },
+ didReceiveCellDatas: (cells) {
+ emit(state.copyWith(cells: cells));
+ },
+ delete: () async {
+ final result = await RowBackendService.deleteRow(
+ rowController.viewId,
+ rowController.rowId,
+ );
+ result.fold((l) => null, (err) => Log.error(err));
+ },
+ );
+ },
+ );
}
void _startListening() {
diff --git a/frontend/appflowy_flutter/lib/plugins/database/calendar/application/calendar_setting_bloc.dart b/frontend/appflowy_flutter/lib/plugins/database/calendar/application/calendar_setting_bloc.dart
index 5f877d3387..ee4f34586b 100644
--- a/frontend/appflowy_flutter/lib/plugins/database/calendar/application/calendar_setting_bloc.dart
+++ b/frontend/appflowy_flutter/lib/plugins/database/calendar/application/calendar_setting_bloc.dart
@@ -12,18 +12,21 @@ typedef DayOfWeek = int;
class CalendarSettingBloc
extends Bloc<CalendarSettingEvent, CalendarSettingState> {
- final DatabaseController _databaseController;
- final DatabaseLayoutSettingListener _listener;
-
- CalendarSettingBloc({
- required DatabaseController databaseController,
- }) : _databaseController = databaseController,
+ CalendarSettingBloc({required DatabaseController databaseController})
+ : _databaseController = databaseController,
_listener = DatabaseLayoutSettingListener(databaseController.viewId),
super(
CalendarSettingState.initial(
databaseController.databaseLayoutSetting?.calendar,
),
) {
+ _dispatch();
+ }
+
+ final DatabaseController _databaseController;
+ final DatabaseLayoutSettingListener _listener;
+
+ void _dispatch() {
on<CalendarSettingEvent>((event, emit) {
event.when(
initial: () {
diff --git a/frontend/appflowy_flutter/lib/plugins/database/calendar/application/unschedule_event_bloc.dart b/frontend/appflowy_flutter/lib/plugins/database/calendar/application/unschedule_event_bloc.dart
index cefdbf6504..bcf995a580 100644
--- a/frontend/appflowy_flutter/lib/plugins/database/calendar/application/unschedule_event_bloc.dart
+++ b/frontend/appflowy_flutter/lib/plugins/database/calendar/application/unschedule_event_bloc.dart
@@ -16,6 +16,11 @@ part 'unschedule_event_bloc.freezed.dart';
class UnscheduleEventsBloc
extends Bloc<UnscheduleEventsEvent, UnscheduleEventsState> {
+ UnscheduleEventsBloc({required this.databaseController})
+ : super(UnscheduleEventsState.initial()) {
+ _dispatch();
+ }
+
final DatabaseController databaseController;
Map<String, FieldInfo> fieldInfoByFieldId = {};
@@ -25,9 +30,7 @@ class UnscheduleEventsBloc
CellMemCache get cellCache => databaseController.rowCache.cellCache;
RowCache get rowCache => databaseController.rowCache;
- UnscheduleEventsBloc({
- required this.databaseController,
- }) : super(UnscheduleEventsState.initial()) {
+ void _dispatch() {
on<UnscheduleEventsEvent>(
(event, emit) async {
await event.when(
diff --git a/frontend/appflowy_flutter/lib/plugins/database/calendar/presentation/calendar_day.dart b/frontend/appflowy_flutter/lib/plugins/database/calendar/presentation/calendar_day.dart
index 9724cef993..5d1a29141e 100644
--- a/frontend/appflowy_flutter/lib/plugins/database/calendar/presentation/calendar_day.dart
+++ b/frontend/appflowy_flutter/lib/plugins/database/calendar/presentation/calendar_day.dart
@@ -95,7 +95,6 @@ class CalendarDayCard extends StatelessWidget {
),
),
DragTarget<CalendarDayEvent>(
- hitTestBehavior: HitTestBehavior.translucent,
builder: (context, candidate, __) {
return Stack(
children: [
@@ -238,7 +237,6 @@ class NewEventButton extends StatelessWidget {
padding: const EdgeInsets.all(4.0),
child: FlowyIconButton(
onPressed: onCreate,
- iconPadding: EdgeInsets.zero,
icon: const FlowySvg(FlowySvgs.add_s),
fillColor: Theme.of(context).colorScheme.background,
hoverColor: AFThemeExtension.of(context).lightGreyHover,
@@ -261,7 +259,6 @@ class NewEventButton extends StatelessWidget {
blurRadius: 2,
),
BoxShadow(
- spreadRadius: 0,
color: const Color(0xFF1F2329).withOpacity(0.02),
blurRadius: 4,
),
@@ -314,7 +311,6 @@ class _DayBadge extends StatelessWidget {
mainAxisAlignment: PlatformExtension.isMobile
? MainAxisAlignment.center
: MainAxisAlignment.end,
- crossAxisAlignment: CrossAxisAlignment.center,
children: [
if (date.day == 1 && !PlatformExtension.isMobile)
FlowyText.medium(
@@ -387,10 +383,10 @@ class _EventList extends StatelessWidget {
}
class _CardEnterNotifier extends ChangeNotifier {
- bool _onEnter = false;
-
_CardEnterNotifier();
+ bool _onEnter = false;
+
set onEnter(bool value) {
if (_onEnter != value) {
_onEnter = value;
diff --git a/frontend/appflowy_flutter/lib/plugins/database/calendar/presentation/calendar_event_card.dart b/frontend/appflowy_flutter/lib/plugins/database/calendar/presentation/calendar_event_card.dart
index 1752663473..64ca08e00a 100644
--- a/frontend/appflowy_flutter/lib/plugins/database/calendar/presentation/calendar_event_card.dart
+++ b/frontend/appflowy_flutter/lib/plugins/database/calendar/presentation/calendar_event_card.dart
@@ -125,7 +125,6 @@ class _EventCardState extends State<EventCard> {
blurRadius: 2,
),
BoxShadow(
- spreadRadius: 0,
color: const Color(0xFF1F2329).withOpacity(0.02),
blurRadius: 4,
),
diff --git a/frontend/appflowy_flutter/lib/plugins/database/calendar/presentation/calendar_event_editor.dart b/frontend/appflowy_flutter/lib/plugins/database/calendar/presentation/calendar_event_editor.dart
index d3fc975ee9..53536a9f29 100644
--- a/frontend/appflowy_flutter/lib/plugins/database/calendar/presentation/calendar_event_editor.dart
+++ b/frontend/appflowy_flutter/lib/plugins/database/calendar/presentation/calendar_event_editor.dart
@@ -23,11 +23,6 @@ import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
class CalendarEventEditor extends StatelessWidget {
- final DatabaseController databaseController;
- final RowController rowController;
- final CalendarLayoutSettingPB layoutSettings;
- final EditableCellBuilder cellBuilder;
-
CalendarEventEditor({
super.key,
required RowMetaPB rowMeta,
@@ -38,9 +33,13 @@ class CalendarEventEditor extends StatelessWidget {
viewId: databaseController.viewId,
rowCache: databaseController.rowCache,
),
- cellBuilder = EditableCellBuilder(
- databaseController: databaseController,
- );
+ cellBuilder =
+ EditableCellBuilder(databaseController: databaseController);
+
+ final CalendarLayoutSettingPB layoutSettings;
+ final DatabaseController databaseController;
+ final RowController rowController;
+ final EditableCellBuilder cellBuilder;
@override
Widget build(BuildContext context) {
@@ -124,10 +123,6 @@ class EventEditorControls extends StatelessWidget {
}
class EventPropertyList extends StatelessWidget {
- final FieldController fieldController;
- final String dateFieldId;
- final EditableCellBuilder cellBuilder;
-
const EventPropertyList({
super.key,
required this.fieldController,
@@ -135,6 +130,10 @@ class EventPropertyList extends StatelessWidget {
required this.cellBuilder,
});
+ final FieldController fieldController;
+ final String dateFieldId;
+ final EditableCellBuilder cellBuilder;
+
@override
Widget build(BuildContext context) {
return BlocBuilder<CalendarEventEditorBloc, CalendarEventEditorState>(
@@ -184,17 +183,17 @@ class EventPropertyList extends StatelessWidget {
}
class PropertyCell extends StatefulWidget {
- final FieldController fieldController;
- final CellContext cellContext;
- final EditableCellBuilder cellBuilder;
-
const PropertyCell({
+ super.key,
required this.fieldController,
required this.cellContext,
required this.cellBuilder,
- super.key,
});
+ final FieldController fieldController;
+ final CellContext cellContext;
+ final EditableCellBuilder cellBuilder;
+
@override
State<StatefulWidget> createState() => _PropertyCellState();
}
@@ -221,7 +220,6 @@ class _PropertyCellState extends State<PropertyCell> {
constraints: const BoxConstraints(minHeight: 28),
child: Row(
crossAxisAlignment: CrossAxisAlignment.start,
- mainAxisAlignment: MainAxisAlignment.start,
children: [
SizedBox(
width: 88,
diff --git a/frontend/appflowy_flutter/lib/plugins/database/calendar/presentation/calendar_page.dart b/frontend/appflowy_flutter/lib/plugins/database/calendar/presentation/calendar_page.dart
index a4f72d4420..756c385067 100644
--- a/frontend/appflowy_flutter/lib/plugins/database/calendar/presentation/calendar_page.dart
+++ b/frontend/appflowy_flutter/lib/plugins/database/calendar/presentation/calendar_page.dart
@@ -93,7 +93,6 @@ class _CalendarPageState extends State<CalendarPage> {
void initState() {
_calendarState = GlobalKey<MonthViewState>();
_calendarBloc = CalendarBloc(
- view: widget.view,
databaseController: widget.databaseController,
)..add(const CalendarEvent.initial());
@@ -217,7 +216,6 @@ class _CalendarPageState extends State<CalendarPage> {
return SizedBox(
height: 24,
child: Row(
- crossAxisAlignment: CrossAxisAlignment.center,
children: [
GestureDetector(
onTap: PlatformExtension.isMobile
diff --git a/frontend/appflowy_flutter/lib/plugins/database/calendar/presentation/toolbar/calendar_layout_setting.dart b/frontend/appflowy_flutter/lib/plugins/database/calendar/presentation/toolbar/calendar_layout_setting.dart
index f66a60b2e0..3ec5e7c34f 100644
--- a/frontend/appflowy_flutter/lib/plugins/database/calendar/presentation/toolbar/calendar_layout_setting.dart
+++ b/frontend/appflowy_flutter/lib/plugins/database/calendar/presentation/toolbar/calendar_layout_setting.dart
@@ -16,13 +16,13 @@ import 'package:flutter_bloc/flutter_bloc.dart';
/// Widget that displays a list of settings that alters the appearance of the
/// calendar
class CalendarLayoutSetting extends StatefulWidget {
- final DatabaseController databaseController;
-
const CalendarLayoutSetting({
super.key,
required this.databaseController,
});
+ final DatabaseController databaseController;
+
@override
State<CalendarLayoutSetting> createState() => _CalendarLayoutSettingState();
}
diff --git a/frontend/appflowy_flutter/lib/plugins/database/calendar/presentation/toolbar/calendar_setting_bar.dart b/frontend/appflowy_flutter/lib/plugins/database/calendar/presentation/toolbar/calendar_setting_bar.dart
index 2c8164cb23..cc496873ef 100644
--- a/frontend/appflowy_flutter/lib/plugins/database/calendar/presentation/toolbar/calendar_setting_bar.dart
+++ b/frontend/appflowy_flutter/lib/plugins/database/calendar/presentation/toolbar/calendar_setting_bar.dart
@@ -3,12 +3,13 @@ import 'package:appflowy/plugins/database/widgets/setting/setting_button.dart';
import 'package:flutter/material.dart';
class CalendarSettingBar extends StatelessWidget {
- final DatabaseController databaseController;
const CalendarSettingBar({
- required this.databaseController,
super.key,
+ required this.databaseController,
});
+ final DatabaseController databaseController;
+
@override
Widget build(BuildContext context) {
return SizedBox(
diff --git a/frontend/appflowy_flutter/lib/plugins/database/grid/application/filter/checkbox_filter_editor_bloc.dart b/frontend/appflowy_flutter/lib/plugins/database/grid/application/filter/checkbox_filter_editor_bloc.dart
index ab0220d6b8..aeef4e4d5e 100644
--- a/frontend/appflowy_flutter/lib/plugins/database/grid/application/filter/checkbox_filter_editor_bloc.dart
+++ b/frontend/appflowy_flutter/lib/plugins/database/grid/application/filter/checkbox_filter_editor_bloc.dart
@@ -1,3 +1,5 @@
+import 'dart:async';
+
import 'package:appflowy/plugins/database/application/filter/filter_listener.dart';
import 'package:appflowy/plugins/database/application/filter/filter_service.dart';
import 'package:appflowy/plugins/database/grid/presentation/widgets/filter/filter_info.dart';
@@ -5,16 +7,11 @@ import 'package:appflowy_backend/protobuf/flowy-database2/checkbox_filter.pb.dar
import 'package:appflowy_backend/protobuf/flowy-database2/util.pb.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:freezed_annotation/freezed_annotation.dart';
-import 'dart:async';
part 'checkbox_filter_editor_bloc.freezed.dart';
class CheckboxFilterEditorBloc
extends Bloc<CheckboxFilterEditorEvent, CheckboxFilterEditorState> {
- final FilterInfo filterInfo;
- final FilterBackendService _filterBackendSvc;
- final FilterListener _listener;
-
CheckboxFilterEditorBloc({required this.filterInfo})
: _filterBackendSvc = FilterBackendService(viewId: filterInfo.viewId),
_listener = FilterListener(
@@ -22,6 +19,14 @@ class CheckboxFilterEditorBloc
filterId: filterInfo.filter.id,
),
super(CheckboxFilterEditorState.initial(filterInfo)) {
+ _dispatch();
+ }
+
+ final FilterInfo filterInfo;
+ final FilterBackendService _filterBackendSvc;
+ final FilterListener _listener;
+
+ void _dispatch() {
on<CheckboxFilterEditorEvent>(
(event, emit) async {
event.when(
diff --git a/frontend/appflowy_flutter/lib/plugins/database/grid/application/filter/checklist_filter_bloc.dart b/frontend/appflowy_flutter/lib/plugins/database/grid/application/filter/checklist_filter_bloc.dart
index 4def8f674b..c68f553744 100644
--- a/frontend/appflowy_flutter/lib/plugins/database/grid/application/filter/checklist_filter_bloc.dart
+++ b/frontend/appflowy_flutter/lib/plugins/database/grid/application/filter/checklist_filter_bloc.dart
@@ -1,3 +1,5 @@
+import 'dart:async';
+
import 'package:appflowy/plugins/database/application/filter/filter_listener.dart';
import 'package:appflowy/plugins/database/application/filter/filter_service.dart';
import 'package:appflowy/plugins/database/grid/presentation/widgets/filter/filter_info.dart';
@@ -5,24 +7,26 @@ import 'package:appflowy_backend/protobuf/flowy-database2/checklist_filter.pb.da
import 'package:appflowy_backend/protobuf/flowy-database2/util.pb.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:freezed_annotation/freezed_annotation.dart';
-import 'dart:async';
part 'checklist_filter_bloc.freezed.dart';
class ChecklistFilterEditorBloc
extends Bloc<ChecklistFilterEditorEvent, ChecklistFilterEditorState> {
- final FilterInfo filterInfo;
- final FilterBackendService _filterBackendSvc;
- final FilterListener _listener;
-
- ChecklistFilterEditorBloc({
- required this.filterInfo,
- }) : _filterBackendSvc = FilterBackendService(viewId: filterInfo.viewId),
+ ChecklistFilterEditorBloc({required this.filterInfo})
+ : _filterBackendSvc = FilterBackendService(viewId: filterInfo.viewId),
_listener = FilterListener(
viewId: filterInfo.viewId,
filterId: filterInfo.filter.id,
),
super(ChecklistFilterEditorState.initial(filterInfo)) {
+ _dispatch();
+ }
+
+ final FilterInfo filterInfo;
+ final FilterBackendService _filterBackendSvc;
+ final FilterListener _listener;
+
+ void _dispatch() {
on<ChecklistFilterEditorEvent>(
(event, emit) async {
event.when(
diff --git a/frontend/appflowy_flutter/lib/plugins/database/grid/application/filter/filter_create_bloc.dart b/frontend/appflowy_flutter/lib/plugins/database/grid/application/filter/filter_create_bloc.dart
index 5de913def8..e25e71ef95 100644
--- a/frontend/appflowy_flutter/lib/plugins/database/grid/application/filter/filter_create_bloc.dart
+++ b/frontend/appflowy_flutter/lib/plugins/database/grid/application/filter/filter_create_bloc.dart
@@ -1,8 +1,8 @@
+import 'dart:async';
+
import 'package:appflowy/plugins/database/application/field/field_controller.dart';
import 'package:appflowy/plugins/database/application/field/field_info.dart';
import 'package:appflowy/plugins/database/application/filter/filter_service.dart';
-import 'package:dartz/dartz.dart';
-import 'package:appflowy_backend/protobuf/flowy-error/errors.pbserver.dart';
import 'package:appflowy_backend/protobuf/flowy-database2/checkbox_filter.pbenum.dart';
import 'package:appflowy_backend/protobuf/flowy-database2/checklist_filter.pb.dart';
import 'package:appflowy_backend/protobuf/flowy-database2/date_filter.pbenum.dart';
@@ -10,21 +10,27 @@ import 'package:appflowy_backend/protobuf/flowy-database2/field_entities.pb.dart
import 'package:appflowy_backend/protobuf/flowy-database2/number_filter.pb.dart';
import 'package:appflowy_backend/protobuf/flowy-database2/select_option_filter.pbenum.dart';
import 'package:appflowy_backend/protobuf/flowy-database2/text_filter.pb.dart';
+import 'package:appflowy_backend/protobuf/flowy-error/errors.pbserver.dart';
+import 'package:dartz/dartz.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:freezed_annotation/freezed_annotation.dart';
-import 'dart:async';
part 'filter_create_bloc.freezed.dart';
class GridCreateFilterBloc
extends Bloc<GridCreateFilterEvent, GridCreateFilterState> {
+ GridCreateFilterBloc({required this.viewId, required this.fieldController})
+ : _filterBackendSvc = FilterBackendService(viewId: viewId),
+ super(GridCreateFilterState.initial(fieldController.fieldInfos)) {
+ _dispatch();
+ }
+
final String viewId;
final FilterBackendService _filterBackendSvc;
final FieldController fieldController;
void Function(List<FieldInfo>)? _onFieldFn;
- GridCreateFilterBloc({required this.viewId, required this.fieldController})
- : _filterBackendSvc = FilterBackendService(viewId: viewId),
- super(GridCreateFilterState.initial(fieldController.fieldInfos)) {
+
+ void _dispatch() {
on<GridCreateFilterEvent>(
(event, emit) async {
event.when(
@@ -118,7 +124,6 @@ class GridCreateFilterBloc
return _filterBackendSvc.insertNumberFilter(
fieldId: fieldId,
condition: NumberFilterConditionPB.Equal,
- content: "",
);
case FieldType.RichText:
return _filterBackendSvc.insertTextFilter(
diff --git a/frontend/appflowy_flutter/lib/plugins/database/grid/application/filter/filter_menu_bloc.dart b/frontend/appflowy_flutter/lib/plugins/database/grid/application/filter/filter_menu_bloc.dart
index bf08dfec9a..6c98287ad7 100644
--- a/frontend/appflowy_flutter/lib/plugins/database/grid/application/filter/filter_menu_bloc.dart
+++ b/frontend/appflowy_flutter/lib/plugins/database/grid/application/filter/filter_menu_bloc.dart
@@ -1,19 +1,15 @@
+import 'dart:async';
+
import 'package:appflowy/plugins/database/application/field/field_controller.dart';
import 'package:appflowy/plugins/database/application/field/field_info.dart';
import 'package:appflowy/plugins/database/grid/presentation/widgets/filter/filter_info.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:freezed_annotation/freezed_annotation.dart';
-import 'dart:async';
part 'filter_menu_bloc.freezed.dart';
class GridFilterMenuBloc
extends Bloc<GridFilterMenuEvent, GridFilterMenuState> {
- final String viewId;
- final FieldController fieldController;
- void Function(List<FilterInfo>)? _onFilterFn;
- void Function(List<FieldInfo>)? _onFieldFn;
-
GridFilterMenuBloc({required this.viewId, required this.fieldController})
: super(
GridFilterMenuState.initial(
@@ -22,6 +18,15 @@ class GridFilterMenuBloc
fieldController.fieldInfos,
),
) {
+ _dispatch();
+ }
+
+ final String viewId;
+ final FieldController fieldController;
+ void Function(List<FilterInfo>)? _onFilterFn;
+ void Function(List<FieldInfo>)? _onFieldFn;
+
+ void _dispatch() {
on<GridFilterMenuEvent>(
(event, emit) async {
event.when(
diff --git a/frontend/appflowy_flutter/lib/plugins/database/grid/application/filter/select_option_filter_bloc.dart b/frontend/appflowy_flutter/lib/plugins/database/grid/application/filter/select_option_filter_bloc.dart
index 7dc2d67c0e..85a375ac9d 100644
--- a/frontend/appflowy_flutter/lib/plugins/database/grid/application/filter/select_option_filter_bloc.dart
+++ b/frontend/appflowy_flutter/lib/plugins/database/grid/application/filter/select_option_filter_bloc.dart
@@ -1,3 +1,5 @@
+import 'dart:async';
+
import 'package:appflowy/plugins/database/application/filter/filter_listener.dart';
import 'package:appflowy/plugins/database/application/filter/filter_service.dart';
import 'package:appflowy/plugins/database/grid/presentation/widgets/filter/choicechip/select_option/select_option_loader.dart';
@@ -6,17 +8,11 @@ import 'package:appflowy_backend/protobuf/flowy-database2/select_option_filter.p
import 'package:appflowy_backend/protobuf/flowy-database2/util.pb.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:freezed_annotation/freezed_annotation.dart';
-import 'dart:async';
part 'select_option_filter_bloc.freezed.dart';
class SelectOptionFilterEditorBloc
extends Bloc<SelectOptionFilterEditorEvent, SelectOptionFilterEditorState> {
- final FilterInfo filterInfo;
- final FilterBackendService _filterBackendSvc;
- final FilterListener _listener;
- final SelectOptionFilterDelegate delegate;
-
SelectOptionFilterEditorBloc({
required this.filterInfo,
required this.delegate,
@@ -26,6 +22,15 @@ class SelectOptionFilterEditorBloc
filterId: filterInfo.filter.id,
),
super(SelectOptionFilterEditorState.initial(filterInfo)) {
+ _dispatch();
+ }
+
+ final FilterInfo filterInfo;
+ final FilterBackendService _filterBackendSvc;
+ final FilterListener _listener;
+ final SelectOptionFilterDelegate delegate;
+
+ void _dispatch() {
on<SelectOptionFilterEditorEvent>(
(event, emit) async {
event.when(
diff --git a/frontend/appflowy_flutter/lib/plugins/database/grid/application/filter/select_option_filter_list_bloc.dart b/frontend/appflowy_flutter/lib/plugins/database/grid/application/filter/select_option_filter_list_bloc.dart
index f1a5bef2de..6bcc5b8806 100644
--- a/frontend/appflowy_flutter/lib/plugins/database/grid/application/filter/select_option_filter_list_bloc.dart
+++ b/frontend/appflowy_flutter/lib/plugins/database/grid/application/filter/select_option_filter_list_bloc.dart
@@ -1,5 +1,4 @@
import 'package:appflowy/plugins/database/grid/presentation/widgets/filter/choicechip/select_option/select_option_loader.dart';
-import 'package:appflowy_backend/protobuf/flowy-database2/field_entities.pb.dart';
import 'package:appflowy_backend/protobuf/flowy-database2/select_option_entities.pb.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:freezed_annotation/freezed_annotation.dart';
@@ -8,13 +7,16 @@ part 'select_option_filter_list_bloc.freezed.dart';
class SelectOptionFilterListBloc<T>
extends Bloc<SelectOptionFilterListEvent, SelectOptionFilterListState> {
- final SelectOptionFilterDelegate delegate;
SelectOptionFilterListBloc({
- required String viewId,
- required FieldPB fieldPB,
required this.delegate,
required List<String> selectedOptionIds,
}) : super(SelectOptionFilterListState.initial(selectedOptionIds)) {
+ _dispatch();
+ }
+
+ final SelectOptionFilterDelegate delegate;
+
+ void _dispatch() {
on<SelectOptionFilterListEvent>(
(event, emit) async {
await event.when(
@@ -145,8 +147,8 @@ class SelectOptionFilterListState with _$SelectOptionFilterListState {
}
class VisibleSelectOption {
+ VisibleSelectOption(this.optionPB, this.isSelected);
+
final SelectOptionPB optionPB;
final bool isSelected;
-
- VisibleSelectOption(this.optionPB, this.isSelected);
}
diff --git a/frontend/appflowy_flutter/lib/plugins/database/grid/application/filter/text_filter_editor_bloc.dart b/frontend/appflowy_flutter/lib/plugins/database/grid/application/filter/text_filter_editor_bloc.dart
index 067383a2ef..9f39d3d489 100644
--- a/frontend/appflowy_flutter/lib/plugins/database/grid/application/filter/text_filter_editor_bloc.dart
+++ b/frontend/appflowy_flutter/lib/plugins/database/grid/application/filter/text_filter_editor_bloc.dart
@@ -1,3 +1,5 @@
+import 'dart:async';
+
import 'package:appflowy/plugins/database/application/filter/filter_listener.dart';
import 'package:appflowy/plugins/database/application/filter/filter_service.dart';
import 'package:appflowy/plugins/database/grid/presentation/widgets/filter/filter_info.dart';
@@ -5,16 +7,11 @@ import 'package:appflowy_backend/protobuf/flowy-database2/text_filter.pbserver.d
import 'package:appflowy_backend/protobuf/flowy-database2/util.pb.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:freezed_annotation/freezed_annotation.dart';
-import 'dart:async';
part 'text_filter_editor_bloc.freezed.dart';
class TextFilterEditorBloc
extends Bloc<TextFilterEditorEvent, TextFilterEditorState> {
- final FilterInfo filterInfo;
- final FilterBackendService _filterBackendSvc;
- final FilterListener _listener;
-
TextFilterEditorBloc({required this.filterInfo})
: _filterBackendSvc = FilterBackendService(viewId: filterInfo.viewId),
_listener = FilterListener(
@@ -22,6 +19,14 @@ class TextFilterEditorBloc
filterId: filterInfo.filter.id,
),
super(TextFilterEditorState.initial(filterInfo)) {
+ _dispatch();
+ }
+
+ final FilterInfo filterInfo;
+ final FilterBackendService _filterBackendSvc;
+ final FilterListener _listener;
+
+ void _dispatch() {
on<TextFilterEditorEvent>(
(event, emit) async {
event.when(
diff --git a/frontend/appflowy_flutter/lib/plugins/database/grid/application/grid_accessory_bloc.dart b/frontend/appflowy_flutter/lib/plugins/database/grid/application/grid_accessory_bloc.dart
index 199c4e2252..11495c87d5 100644
--- a/frontend/appflowy_flutter/lib/plugins/database/grid/application/grid_accessory_bloc.dart
+++ b/frontend/appflowy_flutter/lib/plugins/database/grid/application/grid_accessory_bloc.dart
@@ -5,14 +5,8 @@ part 'grid_accessory_bloc.freezed.dart';
class DatabaseViewSettingExtensionBloc extends Bloc<
DatabaseViewSettingExtensionEvent, DatabaseViewSettingExtensionState> {
- final String viewId;
-
DatabaseViewSettingExtensionBloc({required this.viewId})
- : super(
- DatabaseViewSettingExtensionState.initial(
- viewId,
- ),
- ) {
+ : super(DatabaseViewSettingExtensionState.initial(viewId)) {
on<DatabaseViewSettingExtensionEvent>(
(event, emit) async {
event.when(
@@ -24,6 +18,8 @@ class DatabaseViewSettingExtensionBloc extends Bloc<
},
);
}
+
+ final String viewId;
}
@freezed
diff --git a/frontend/appflowy_flutter/lib/plugins/database/grid/application/grid_bloc.dart b/frontend/appflowy_flutter/lib/plugins/database/grid/application/grid_bloc.dart
index a63d082853..d7a5d901fa 100644
--- a/frontend/appflowy_flutter/lib/plugins/database/grid/application/grid_bloc.dart
+++ b/frontend/appflowy_flutter/lib/plugins/database/grid/application/grid_bloc.dart
@@ -1,4 +1,5 @@
import 'dart:async';
+
import 'package:appflowy/plugins/database/application/defines.dart';
import 'package:appflowy/plugins/database/application/field/field_info.dart';
import 'package:appflowy/plugins/database/application/row/row_cache.dart';
@@ -6,20 +7,27 @@ import 'package:appflowy/plugins/database/application/row/row_service.dart';
import 'package:appflowy/plugins/database/grid/presentation/widgets/filter/filter_info.dart';
import 'package:appflowy/plugins/database/grid/presentation/widgets/sort/sort_info.dart';
import 'package:appflowy_backend/log.dart';
-import 'package:dartz/dartz.dart';
-import 'package:appflowy_backend/protobuf/flowy-folder/view.pb.dart';
import 'package:appflowy_backend/protobuf/flowy-database2/protobuf.dart';
+import 'package:appflowy_backend/protobuf/flowy-folder/view.pb.dart';
+import 'package:dartz/dartz.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:freezed_annotation/freezed_annotation.dart';
+
import '../../application/database_controller.dart';
part 'grid_bloc.freezed.dart';
class GridBloc extends Bloc<GridEvent, GridState> {
- final DatabaseController databaseController;
-
GridBloc({required ViewPB view, required this.databaseController})
: super(GridState.initial(view.id)) {
+ _dispatch();
+ }
+
+ final DatabaseController databaseController;
+
+ String get viewId => databaseController.viewId;
+
+ void _dispatch() {
on<GridEvent>(
(event, emit) async {
await event.when(
@@ -93,11 +101,7 @@ class GridBloc extends Bloc<GridEvent, GridState> {
);
}
- String get viewId => databaseController.viewId;
-
- RowCache getRowCache(RowId rowId) {
- return databaseController.rowCache;
- }
+ RowCache getRowCache(RowId rowId) => databaseController.rowCache;
void _startListening() {
final onDatabaseChanged = DatabaseCallbacks(
diff --git a/frontend/appflowy_flutter/lib/plugins/database/grid/application/grid_header_bloc.dart b/frontend/appflowy_flutter/lib/plugins/database/grid/application/grid_header_bloc.dart
index ad2a0f56ea..59e5a61e7f 100644
--- a/frontend/appflowy_flutter/lib/plugins/database/grid/application/grid_header_bloc.dart
+++ b/frontend/appflowy_flutter/lib/plugins/database/grid/application/grid_header_bloc.dart
@@ -12,13 +12,15 @@ import '../../application/field/field_service.dart';
part 'grid_header_bloc.freezed.dart';
class GridHeaderBloc extends Bloc<GridHeaderEvent, GridHeaderState> {
- final FieldController fieldController;
+ GridHeaderBloc({required this.viewId, required this.fieldController})
+ : super(GridHeaderState.initial()) {
+ _dispatch();
+ }
+
final String viewId;
+ final FieldController fieldController;
- GridHeaderBloc({
- required this.viewId,
- required this.fieldController,
- }) : super(GridHeaderState.initial()) {
+ void _dispatch() {
on<GridHeaderEvent>(
(event, emit) async {
await event.when(
diff --git a/frontend/appflowy_flutter/lib/plugins/database/grid/application/row/mobile_row_detail_bloc.dart b/frontend/appflowy_flutter/lib/plugins/database/grid/application/row/mobile_row_detail_bloc.dart
index 4b80e5eb6d..60c7ad8e65 100644
--- a/frontend/appflowy_flutter/lib/plugins/database/grid/application/row/mobile_row_detail_bloc.dart
+++ b/frontend/appflowy_flutter/lib/plugins/database/grid/application/row/mobile_row_detail_bloc.dart
@@ -7,11 +7,14 @@ part 'mobile_row_detail_bloc.freezed.dart';
class MobileRowDetailBloc
extends Bloc<MobileRowDetailEvent, MobileRowDetailState> {
+ MobileRowDetailBloc({required this.databaseController})
+ : super(MobileRowDetailState.initial()) {
+ _dispatch();
+ }
+
final DatabaseController databaseController;
- MobileRowDetailBloc({
- required this.databaseController,
- }) : super(MobileRowDetailState.initial()) {
+ void _dispatch() {
on<MobileRowDetailEvent>(
(event, emit) {
event.when(
diff --git a/frontend/appflowy_flutter/lib/plugins/database/grid/application/row/row_bloc.dart b/frontend/appflowy_flutter/lib/plugins/database/grid/application/row/row_bloc.dart
index 85b55e671f..a0c0467b95 100644
--- a/frontend/appflowy_flutter/lib/plugins/database/grid/application/row/row_bloc.dart
+++ b/frontend/appflowy_flutter/lib/plugins/database/grid/application/row/row_bloc.dart
@@ -1,9 +1,10 @@
import 'dart:async';
+import 'package:flutter/foundation.dart';
+
import 'package:appflowy/plugins/database/application/cell/cell_controller.dart';
import 'package:appflowy/plugins/database/application/field/field_controller.dart';
import 'package:appflowy/plugins/database/widgets/setting/field_visibility_extension.dart';
-import 'package:flutter/foundation.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:freezed_annotation/freezed_annotation.dart';
@@ -14,12 +15,6 @@ import '../../../application/row/row_service.dart';
part 'row_bloc.freezed.dart';
class RowBloc extends Bloc<RowEvent, RowState> {
- final FieldController fieldController;
- final RowBackendService _rowBackendSvc;
- final RowController _rowController;
- final String viewId;
- final String rowId;
-
RowBloc({
required this.fieldController,
required this.rowId,
@@ -33,6 +28,12 @@ class RowBloc extends Bloc<RowEvent, RowState> {
_init();
}
+ final FieldController fieldController;
+ final RowBackendService _rowBackendSvc;
+ final RowController _rowController;
+ final String viewId;
+ final String rowId;
+
@override
Future<void> close() async {
_rowController.dispose();
@@ -104,10 +105,5 @@ class RowState with _$RowState {
ChangedReason? changeReason,
}) = _RowState;
- factory RowState.initial() {
- return const RowState(
- cellContexts: [],
- changeReason: null,
- );
- }
+ factory RowState.initial() => const RowState(cellContexts: []);
}
diff --git a/frontend/appflowy_flutter/lib/plugins/database/grid/application/row/row_detail_bloc.dart b/frontend/appflowy_flutter/lib/plugins/database/grid/application/row/row_detail_bloc.dart
index 48abad2f0a..2545309868 100644
--- a/frontend/appflowy_flutter/lib/plugins/database/grid/application/row/row_detail_bloc.dart
+++ b/frontend/appflowy_flutter/lib/plugins/database/grid/application/row/row_detail_bloc.dart
@@ -13,11 +13,6 @@ import 'package:freezed_annotation/freezed_annotation.dart';
part 'row_detail_bloc.freezed.dart';
class RowDetailBloc extends Bloc<RowDetailEvent, RowDetailState> {
- final FieldController fieldController;
- final RowController rowController;
-
- final List<CellContext> allCells = [];
-
RowDetailBloc({
required this.fieldController,
required this.rowController,
@@ -27,6 +22,11 @@ class RowDetailBloc extends Bloc<RowDetailEvent, RowDetailState> {
_init();
}
+ final FieldController fieldController;
+ final RowController rowController;
+
+ final List<CellContext> allCells = [];
+
@override
Future<void> close() async {
rowController.dispose();
diff --git a/frontend/appflowy_flutter/lib/plugins/database/grid/application/row/row_document_bloc.dart b/frontend/appflowy_flutter/lib/plugins/database/grid/application/row/row_document_bloc.dart
index 998a30beb6..24fce68cee 100644
--- a/frontend/appflowy_flutter/lib/plugins/database/grid/application/row/row_document_bloc.dart
+++ b/frontend/appflowy_flutter/lib/plugins/database/grid/application/row/row_document_bloc.dart
@@ -1,28 +1,33 @@
+import 'package:flutter/foundation.dart';
+
import 'package:appflowy/generated/locale_keys.g.dart';
import 'package:appflowy/workspace/application/view/view_service.dart';
import 'package:appflowy_backend/log.dart';
import 'package:appflowy_backend/protobuf/flowy-database2/protobuf.dart';
import 'package:appflowy_backend/protobuf/flowy-error/code.pbenum.dart';
+import 'package:appflowy_backend/protobuf/flowy-error/errors.pb.dart';
import 'package:appflowy_backend/protobuf/flowy-folder/view.pb.dart';
import 'package:easy_localization/easy_localization.dart';
-import 'package:flutter/foundation.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:freezed_annotation/freezed_annotation.dart';
-import 'package:appflowy_backend/protobuf/flowy-error/errors.pb.dart';
import '../../../application/row/row_service.dart';
part 'row_document_bloc.freezed.dart';
class RowDocumentBloc extends Bloc<RowDocumentEvent, RowDocumentState> {
- final String rowId;
- final RowBackendService _rowBackendSvc;
-
RowDocumentBloc({
required this.rowId,
required String viewId,
}) : _rowBackendSvc = RowBackendService(viewId: viewId),
super(RowDocumentState.initial()) {
+ _dispatch();
+ }
+
+ final String rowId;
+ final RowBackendService _rowBackendSvc;
+
+ void _dispatch() {
on<RowDocumentEvent>(
(event, emit) async {
await event.when(
diff --git a/frontend/appflowy_flutter/lib/plugins/database/grid/application/sort/sort_create_bloc.dart b/frontend/appflowy_flutter/lib/plugins/database/grid/application/sort/sort_create_bloc.dart
index b5294574e9..5f2642c8a2 100644
--- a/frontend/appflowy_flutter/lib/plugins/database/grid/application/sort/sort_create_bloc.dart
+++ b/frontend/appflowy_flutter/lib/plugins/database/grid/application/sort/sort_create_bloc.dart
@@ -1,26 +1,33 @@
+import 'dart:async';
+
import 'package:appflowy/plugins/database/application/field/field_info.dart';
-import 'package:dartz/dartz.dart';
-import 'package:appflowy_backend/protobuf/flowy-error/errors.pbserver.dart';
import 'package:appflowy_backend/protobuf/flowy-database2/sort_entities.pbenum.dart';
import 'package:appflowy_backend/protobuf/flowy-database2/sort_entities.pbserver.dart';
+import 'package:appflowy_backend/protobuf/flowy-error/errors.pbserver.dart';
+import 'package:dartz/dartz.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:freezed_annotation/freezed_annotation.dart';
-import 'dart:async';
import '../../../application/field/field_controller.dart';
import '../../../application/sort/sort_service.dart';
+
import 'util.dart';
part 'sort_create_bloc.freezed.dart';
class CreateSortBloc extends Bloc<CreateSortEvent, CreateSortState> {
+ CreateSortBloc({required this.viewId, required this.fieldController})
+ : _sortBackendSvc = SortBackendService(viewId: viewId),
+ super(CreateSortState.initial(fieldController.fieldInfos)) {
+ _dispatch();
+ }
+
final String viewId;
final SortBackendService _sortBackendSvc;
final FieldController fieldController;
void Function(List<FieldInfo>)? _onFieldFn;
- CreateSortBloc({required this.viewId, required this.fieldController})
- : _sortBackendSvc = SortBackendService(viewId: viewId),
- super(CreateSortState.initial(fieldController.fieldInfos)) {
+
+ void _dispatch() {
on<CreateSortEvent>(
(event, emit) async {
event.when(
diff --git a/frontend/appflowy_flutter/lib/plugins/database/grid/application/sort/sort_editor_bloc.dart b/frontend/appflowy_flutter/lib/plugins/database/grid/application/sort/sort_editor_bloc.dart
index e589dd00fb..50025c9235 100644
--- a/frontend/appflowy_flutter/lib/plugins/database/grid/application/sort/sort_editor_bloc.dart
+++ b/frontend/appflowy_flutter/lib/plugins/database/grid/application/sort/sort_editor_bloc.dart
@@ -1,28 +1,35 @@
+import 'dart:async';
+
import 'package:appflowy/plugins/database/application/field/field_controller.dart';
import 'package:appflowy/plugins/database/application/field/field_info.dart';
import 'package:appflowy/plugins/database/application/sort/sort_service.dart';
import 'package:appflowy/plugins/database/grid/presentation/widgets/sort/sort_info.dart';
-import 'package:appflowy_backend/protobuf/flowy-database2/sort_entities.pbenum.dart';
import 'package:appflowy_backend/log.dart';
+import 'package:appflowy_backend/protobuf/flowy-database2/sort_entities.pbenum.dart';
import 'package:appflowy_backend/protobuf/flowy-database2/sort_entities.pbserver.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:freezed_annotation/freezed_annotation.dart';
-import 'dart:async';
+
import 'util.dart';
part 'sort_editor_bloc.freezed.dart';
class SortEditorBloc extends Bloc<SortEditorEvent, SortEditorState> {
- final String viewId;
- final SortBackendService _sortBackendSvc;
- final FieldController fieldController;
- void Function(List<FieldInfo>)? _onFieldFn;
SortEditorBloc({
required this.viewId,
required this.fieldController,
required List<SortInfo> sortInfos,
}) : _sortBackendSvc = SortBackendService(viewId: viewId),
super(SortEditorState.initial(sortInfos, fieldController.fieldInfos)) {
+ _dispatch();
+ }
+
+ final String viewId;
+ final SortBackendService _sortBackendSvc;
+ final FieldController fieldController;
+ void Function(List<FieldInfo>)? _onFieldFn;
+
+ void _dispatch() {
on<SortEditorEvent>(
(event, emit) async {
event.when(
diff --git a/frontend/appflowy_flutter/lib/plugins/database/grid/application/sort/sort_menu_bloc.dart b/frontend/appflowy_flutter/lib/plugins/database/grid/application/sort/sort_menu_bloc.dart
index 3687f96c8f..b65f71ed1e 100644
--- a/frontend/appflowy_flutter/lib/plugins/database/grid/application/sort/sort_menu_bloc.dart
+++ b/frontend/appflowy_flutter/lib/plugins/database/grid/application/sort/sort_menu_bloc.dart
@@ -1,19 +1,17 @@
+import 'dart:async';
+
import 'package:appflowy/plugins/database/application/field/field_info.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:freezed_annotation/freezed_annotation.dart';
-import 'dart:async';
+
import '../../../application/field/field_controller.dart';
import '../../presentation/widgets/sort/sort_info.dart';
+
import 'util.dart';
part 'sort_menu_bloc.freezed.dart';
class SortMenuBloc extends Bloc<SortMenuEvent, SortMenuState> {
- final String viewId;
- final FieldController fieldController;
- void Function(List<SortInfo>)? _onSortChangeFn;
- void Function(List<FieldInfo>)? _onFieldFn;
-
SortMenuBloc({required this.viewId, required this.fieldController})
: super(
SortMenuState.initial(
@@ -22,6 +20,15 @@ class SortMenuBloc extends Bloc<SortMenuEvent, SortMenuState> {
fieldController.fieldInfos,
),
) {
+ _dispatch();
+ }
+
+ final String viewId;
+ final FieldController fieldController;
+ void Function(List<SortInfo>)? _onSortChangeFn;
+ void Function(List<FieldInfo>)? _onFieldFn;
+
+ void _dispatch() {
on<SortMenuEvent>(
(event, emit) async {
event.when(
diff --git a/frontend/appflowy_flutter/lib/plugins/database/grid/presentation/grid_page.dart b/frontend/appflowy_flutter/lib/plugins/database/grid/presentation/grid_page.dart
index c2b2bbc429..8b26ed1e75 100755
--- a/frontend/appflowy_flutter/lib/plugins/database/grid/presentation/grid_page.dart
+++ b/frontend/appflowy_flutter/lib/plugins/database/grid/presentation/grid_page.dart
@@ -238,9 +238,10 @@ class _GridPageContentState extends State<GridPageContent> {
}
class _GridHeader extends StatelessWidget {
- final ScrollController headerScrollController;
const _GridHeader({required this.headerScrollController});
+ final ScrollController headerScrollController;
+
@override
Widget build(BuildContext context) {
return BlocBuilder<GridBloc, GridState>(
@@ -255,14 +256,14 @@ class _GridHeader extends StatelessWidget {
}
class _GridRows extends StatelessWidget {
- final String viewId;
- final GridScrollController scrollController;
-
const _GridRows({
required this.viewId,
required this.scrollController,
});
+ final String viewId;
+ final GridScrollController scrollController;
+
@override
Widget build(BuildContext context) {
return BlocBuilder<GridBloc, GridState>(
diff --git a/frontend/appflowy_flutter/lib/plugins/database/grid/presentation/grid_scroll.dart b/frontend/appflowy_flutter/lib/plugins/database/grid/presentation/grid_scroll.dart
index 90e29d6716..866a9d11b5 100755
--- a/frontend/appflowy_flutter/lib/plugins/database/grid/presentation/grid_scroll.dart
+++ b/frontend/appflowy_flutter/lib/plugins/database/grid/presentation/grid_scroll.dart
@@ -2,18 +2,18 @@ import 'package:flutter/material.dart';
import 'package:linked_scroll_controller/linked_scroll_controller.dart';
class GridScrollController {
- final LinkedScrollControllerGroup _scrollGroupController;
- final ScrollController verticalController;
- final ScrollController horizontalController;
-
- final List<ScrollController> _linkHorizontalControllers = [];
-
GridScrollController({
required LinkedScrollControllerGroup scrollGroupController,
}) : _scrollGroupController = scrollGroupController,
verticalController = ScrollController(),
horizontalController = scrollGroupController.addAndGet();
+ final LinkedScrollControllerGroup _scrollGroupController;
+ final ScrollController verticalController;
+ final ScrollController horizontalController;
+
+ final List<ScrollController> _linkHorizontalControllers = [];
+
ScrollController linkHorizontalController() {
final controller = _scrollGroupController.addAndGet();
_linkHorizontalControllers.add(controller);
diff --git a/frontend/appflowy_flutter/lib/plugins/database/grid/presentation/mobile_grid_page.dart b/frontend/appflowy_flutter/lib/plugins/database/grid/presentation/mobile_grid_page.dart
index 2f566ec9ca..dcfa0f724d 100644
--- a/frontend/appflowy_flutter/lib/plugins/database/grid/presentation/mobile_grid_page.dart
+++ b/frontend/appflowy_flutter/lib/plugins/database/grid/presentation/mobile_grid_page.dart
@@ -142,12 +142,13 @@ class _MobileGridPageState extends State<MobileGridPage> {
}
class GridPageContent extends StatefulWidget {
- final ViewPB view;
const GridPageContent({
- required this.view,
super.key,
+ required this.view,
});
+ final ViewPB view;
+
@override
State<GridPageContent> createState() => _GridPageContentState();
}
@@ -215,9 +216,10 @@ class _GridPageContentState extends State<GridPageContent> {
}
class _GridHeader extends StatelessWidget {
- final ScrollController headerScrollController;
const _GridHeader({required this.headerScrollController});
+ final ScrollController headerScrollController;
+
@override
Widget build(BuildContext context) {
return BlocBuilder<GridBloc, GridState>(
@@ -232,14 +234,14 @@ class _GridHeader extends StatelessWidget {
}
class _GridRows extends StatelessWidget {
- final String viewId;
- final GridScrollController scrollController;
-
const _GridRows({
required this.viewId,
required this.scrollController,
});
+ final String viewId;
+ final GridScrollController scrollController;
+
@override
Widget build(BuildContext context) {
return BlocBuilder<GridBloc, GridState>(
@@ -400,7 +402,6 @@ class _AddRowButton extends StatelessWidget {
Widget build(BuildContext context) {
final borderSide = BorderSide(
color: Theme.of(context).dividerColor,
- width: 1.0,
);
const radius = BorderRadius.only(
bottomLeft: Radius.circular(24),
diff --git a/frontend/appflowy_flutter/lib/plugins/database/grid/presentation/widgets/common/type_option_separator.dart b/frontend/appflowy_flutter/lib/plugins/database/grid/presentation/widgets/common/type_option_separator.dart
index 14f72f20c0..1d316ca5cb 100644
--- a/frontend/appflowy_flutter/lib/plugins/database/grid/presentation/widgets/common/type_option_separator.dart
+++ b/frontend/appflowy_flutter/lib/plugins/database/grid/presentation/widgets/common/type_option_separator.dart
@@ -1,9 +1,10 @@
import 'package:flutter/material.dart';
class TypeOptionSeparator extends StatelessWidget {
- final double spacing;
const TypeOptionSeparator({this.spacing = 6.0, super.key});
+ final double spacing;
+
@override
Widget build(BuildContext context) {
return Padding(
diff --git a/frontend/appflowy_flutter/lib/plugins/database/grid/presentation/widgets/filter/choicechip/checkbox.dart b/frontend/appflowy_flutter/lib/plugins/database/grid/presentation/widgets/filter/choicechip/checkbox.dart
index c01ad61c6e..7341f6046d 100644
--- a/frontend/appflowy_flutter/lib/plugins/database/grid/presentation/widgets/filter/choicechip/checkbox.dart
+++ b/frontend/appflowy_flutter/lib/plugins/database/grid/presentation/widgets/filter/choicechip/checkbox.dart
@@ -16,9 +16,10 @@ import '../filter_info.dart';
import 'choicechip.dart';
class CheckboxFilterChoicechip extends StatefulWidget {
- final FilterInfo filterInfo;
const CheckboxFilterChoicechip({required this.filterInfo, super.key});
+ final FilterInfo filterInfo;
+
@override
State<CheckboxFilterChoicechip> createState() =>
_CheckboxFilterChoicechipState();
@@ -70,9 +71,10 @@ class _CheckboxFilterChoicechipState extends State<CheckboxFilterChoicechip> {
}
class CheckboxFilterEditor extends StatefulWidget {
- final CheckboxFilterEditorBloc bloc;
const CheckboxFilterEditor({required this.bloc, super.key});
+ final CheckboxFilterEditorBloc bloc;
+
@override
State<CheckboxFilterEditor> createState() => _CheckboxFilterEditorState();
}
@@ -142,16 +144,17 @@ class _CheckboxFilterEditorState extends State<CheckboxFilterEditor> {
}
class CheckboxFilterConditionList extends StatelessWidget {
- final FilterInfo filterInfo;
- final PopoverMutex popoverMutex;
- final Function(CheckboxFilterConditionPB) onCondition;
const CheckboxFilterConditionList({
+ super.key,
required this.filterInfo,
required this.popoverMutex,
required this.onCondition,
- super.key,
});
+ final FilterInfo filterInfo;
+ final PopoverMutex popoverMutex;
+ final Function(CheckboxFilterConditionPB) onCondition;
+
@override
Widget build(BuildContext context) {
final checkboxFilter = filterInfo.checkboxFilter()!;
@@ -182,19 +185,14 @@ class CheckboxFilterConditionList extends StatelessWidget {
}
class ConditionWrapper extends ActionCell {
+ ConditionWrapper(this.inner, this.isSelected);
+
final CheckboxFilterConditionPB inner;
final bool isSelected;
- ConditionWrapper(this.inner, this.isSelected);
-
@override
- Widget? rightIcon(Color iconColor) {
- if (isSelected) {
- return const FlowySvg(FlowySvgs.check_s);
- } else {
- return null;
- }
- }
+ Widget? rightIcon(Color iconColor) =>
+ isSelected ? const FlowySvg(FlowySvgs.check_s) : null;
@override
String get name => inner.filterName;
diff --git a/frontend/appflowy_flutter/lib/plugins/database/grid/presentation/widgets/filter/choicechip/checklist/checklist.dart b/frontend/appflowy_flutter/lib/plugins/database/grid/presentation/widgets/filter/choicechip/checklist/checklist.dart
index c0aef62707..c16df32306 100644
--- a/frontend/appflowy_flutter/lib/plugins/database/grid/presentation/widgets/filter/choicechip/checklist/checklist.dart
+++ b/frontend/appflowy_flutter/lib/plugins/database/grid/presentation/widgets/filter/choicechip/checklist/checklist.dart
@@ -13,9 +13,10 @@ import '../../filter_info.dart';
import '../choicechip.dart';
class ChecklistFilterChoicechip extends StatefulWidget {
- final FilterInfo filterInfo;
const ChecklistFilterChoicechip({required this.filterInfo, super.key});
+ final FilterInfo filterInfo;
+
@override
State<ChecklistFilterChoicechip> createState() =>
_ChecklistFilterChoicechipState();
@@ -67,14 +68,15 @@ class _ChecklistFilterChoicechipState extends State<ChecklistFilterChoicechip> {
}
class ChecklistFilterEditor extends StatefulWidget {
- final ChecklistFilterEditorBloc bloc;
- final PopoverMutex popoverMutex;
const ChecklistFilterEditor({
+ super.key,
required this.bloc,
required this.popoverMutex,
- super.key,
});
+ final ChecklistFilterEditorBloc bloc;
+ final PopoverMutex popoverMutex;
+
@override
ChecklistState createState() => ChecklistState();
}
@@ -122,12 +124,13 @@ class ChecklistState extends State<ChecklistFilterEditor> {
}
class ChecklistFilterConditionList extends StatelessWidget {
- final FilterInfo filterInfo;
const ChecklistFilterConditionList({
- required this.filterInfo,
super.key,
+ required this.filterInfo,
});
+ final FilterInfo filterInfo;
+
@override
Widget build(BuildContext context) {
final checklistFilter = filterInfo.checklistFilter()!;
@@ -154,10 +157,10 @@ class ChecklistFilterConditionList extends StatelessWidget {
}
class ConditionWrapper extends ActionCell {
- final ChecklistFilterConditionPB inner;
-
ConditionWrapper(this.inner);
+ final ChecklistFilterConditionPB inner;
+
@override
String get name => inner.filterName;
}
diff --git a/frontend/appflowy_flutter/lib/plugins/database/grid/presentation/widgets/filter/choicechip/choicechip.dart b/frontend/appflowy_flutter/lib/plugins/database/grid/presentation/widgets/filter/choicechip/choicechip.dart
index 3be92bb5ba..c99823712f 100644
--- a/frontend/appflowy_flutter/lib/plugins/database/grid/presentation/widgets/filter/choicechip/choicechip.dart
+++ b/frontend/appflowy_flutter/lib/plugins/database/grid/presentation/widgets/filter/choicechip/choicechip.dart
@@ -10,10 +10,6 @@ import 'dart:math' as math;
import '../filter_info.dart';
class ChoiceChipButton extends StatelessWidget {
- final FilterInfo filterInfo;
- final VoidCallback? onTap;
- final String filterDesc;
-
const ChoiceChipButton({
super.key,
required this.filterInfo,
@@ -21,11 +17,14 @@ class ChoiceChipButton extends StatelessWidget {
this.onTap,
});
+ final FilterInfo filterInfo;
+ final String filterDesc;
+ final VoidCallback? onTap;
+
@override
Widget build(BuildContext context) {
final borderSide = BorderSide(
color: AFThemeExtension.of(context).toggleOffFill,
- width: 1.0,
);
final decoration = BoxDecoration(
@@ -58,9 +57,10 @@ class ChoiceChipButton extends StatelessWidget {
}
class _ChoicechipFilterDesc extends StatelessWidget {
- final String filterDesc;
const _ChoicechipFilterDesc({this.filterDesc = ''});
+ final String filterDesc;
+
@override
Widget build(BuildContext context) {
final arrow = Transform.rotate(
diff --git a/frontend/appflowy_flutter/lib/plugins/database/grid/presentation/widgets/filter/choicechip/date.dart b/frontend/appflowy_flutter/lib/plugins/database/grid/presentation/widgets/filter/choicechip/date.dart
index 18a3e27c12..3c97aaddb2 100644
--- a/frontend/appflowy_flutter/lib/plugins/database/grid/presentation/widgets/filter/choicechip/date.dart
+++ b/frontend/appflowy_flutter/lib/plugins/database/grid/presentation/widgets/filter/choicechip/date.dart
@@ -4,9 +4,10 @@ import '../filter_info.dart';
import 'choicechip.dart';
class DateFilterChoicechip extends StatelessWidget {
- final FilterInfo filterInfo;
const DateFilterChoicechip({required this.filterInfo, super.key});
+ final FilterInfo filterInfo;
+
@override
Widget build(BuildContext context) {
return ChoiceChipButton(filterInfo: filterInfo);
diff --git a/frontend/appflowy_flutter/lib/plugins/database/grid/presentation/widgets/filter/choicechip/number.dart b/frontend/appflowy_flutter/lib/plugins/database/grid/presentation/widgets/filter/choicechip/number.dart
index 034e709476..f94f72b59c 100644
--- a/frontend/appflowy_flutter/lib/plugins/database/grid/presentation/widgets/filter/choicechip/number.dart
+++ b/frontend/appflowy_flutter/lib/plugins/database/grid/presentation/widgets/filter/choicechip/number.dart
@@ -4,9 +4,10 @@ import '../filter_info.dart';
import 'choicechip.dart';
class NumberFilterChoicechip extends StatelessWidget {
- final FilterInfo filterInfo;
const NumberFilterChoicechip({required this.filterInfo, super.key});
+ final FilterInfo filterInfo;
+
@override
Widget build(BuildContext context) {
return ChoiceChipButton(filterInfo: filterInfo);
diff --git a/frontend/appflowy_flutter/lib/plugins/database/grid/presentation/widgets/filter/choicechip/select_option/condition_list.dart b/frontend/appflowy_flutter/lib/plugins/database/grid/presentation/widgets/filter/choicechip/select_option/condition_list.dart
index c2344e7f8e..74b1dfdced 100644
--- a/frontend/appflowy_flutter/lib/plugins/database/grid/presentation/widgets/filter/choicechip/select_option/condition_list.dart
+++ b/frontend/appflowy_flutter/lib/plugins/database/grid/presentation/widgets/filter/choicechip/select_option/condition_list.dart
@@ -12,16 +12,17 @@ import '../../condition_button.dart';
import '../../filter_info.dart';
class SelectOptionFilterConditionList extends StatelessWidget {
- final FilterInfo filterInfo;
- final PopoverMutex popoverMutex;
- final Function(SelectOptionConditionPB) onCondition;
const SelectOptionFilterConditionList({
+ super.key,
required this.filterInfo,
required this.popoverMutex,
required this.onCondition,
- super.key,
});
+ final FilterInfo filterInfo;
+ final PopoverMutex popoverMutex;
+ final Function(SelectOptionConditionPB) onCondition;
+
@override
Widget build(BuildContext context) {
final selectOptionFilter = filterInfo.selectOptionFilter()!;
@@ -61,12 +62,12 @@ class SelectOptionFilterConditionList extends StatelessWidget {
}
class ConditionWrapper extends ActionCell {
+ ConditionWrapper(this.inner, this.isSelected, this.fieldType);
+
final SelectOptionConditionPB inner;
final bool isSelected;
final FieldType fieldType;
- ConditionWrapper(this.inner, this.isSelected, this.fieldType);
-
@override
Widget? rightIcon(Color iconColor) {
if (isSelected) {
diff --git a/frontend/appflowy_flutter/lib/plugins/database/grid/presentation/widgets/filter/choicechip/select_option/option_list.dart b/frontend/appflowy_flutter/lib/plugins/database/grid/presentation/widgets/filter/choicechip/select_option/option_list.dart
index edc672faff..aeb4a634f8 100644
--- a/frontend/appflowy_flutter/lib/plugins/database/grid/presentation/widgets/filter/choicechip/select_option/option_list.dart
+++ b/frontend/appflowy_flutter/lib/plugins/database/grid/presentation/widgets/filter/choicechip/select_option/option_list.dart
@@ -12,16 +12,17 @@ import 'package:flutter_bloc/flutter_bloc.dart';
import 'select_option_loader.dart';
class SelectOptionFilterList extends StatelessWidget {
- final FilterInfo filterInfo;
- final List<String> selectedOptionIds;
- final Function(List<String>) onSelectedOptions;
const SelectOptionFilterList({
+ super.key,
required this.filterInfo,
required this.selectedOptionIds,
required this.onSelectedOptions,
- super.key,
});
+ final FilterInfo filterInfo;
+ final List<String> selectedOptionIds;
+ final Function(List<String>) onSelectedOptions;
+
@override
Widget build(BuildContext context) {
return BlocProvider(
@@ -29,16 +30,12 @@ class SelectOptionFilterList extends StatelessWidget {
late SelectOptionFilterListBloc bloc;
if (filterInfo.fieldInfo.fieldType == FieldType.SingleSelect) {
bloc = SelectOptionFilterListBloc(
- viewId: filterInfo.viewId,
- fieldPB: filterInfo.fieldInfo.field,
selectedOptionIds: selectedOptionIds,
delegate:
SingleSelectOptionFilterDelegateImpl(filterInfo: filterInfo),
);
} else {
bloc = SelectOptionFilterListBloc(
- viewId: filterInfo.viewId,
- fieldPB: filterInfo.fieldInfo.field,
selectedOptionIds: selectedOptionIds,
delegate:
MultiSelectOptionFilterDelegateImpl(filterInfo: filterInfo),
@@ -81,14 +78,15 @@ class SelectOptionFilterList extends StatelessWidget {
}
class SelectOptionFilterCell extends StatefulWidget {
- final SelectOptionPB option;
- final bool isSelected;
const SelectOptionFilterCell({
+ super.key,
required this.option,
required this.isSelected,
- super.key,
});
+ final SelectOptionPB option;
+ final bool isSelected;
+
@override
State<SelectOptionFilterCell> createState() => _SelectOptionFilterCellState();
}
diff --git a/frontend/appflowy_flutter/lib/plugins/database/grid/presentation/widgets/filter/choicechip/select_option/select_option.dart b/frontend/appflowy_flutter/lib/plugins/database/grid/presentation/widgets/filter/choicechip/select_option/select_option.dart
index 4d4bf376e9..6c80c9f01a 100644
--- a/frontend/appflowy_flutter/lib/plugins/database/grid/presentation/widgets/filter/choicechip/select_option/select_option.dart
+++ b/frontend/appflowy_flutter/lib/plugins/database/grid/presentation/widgets/filter/choicechip/select_option/select_option.dart
@@ -14,9 +14,10 @@ import 'option_list.dart';
import 'select_option_loader.dart';
class SelectOptionFilterChoicechip extends StatefulWidget {
- final FilterInfo filterInfo;
const SelectOptionFilterChoicechip({required this.filterInfo, super.key});
+ final FilterInfo filterInfo;
+
@override
State<SelectOptionFilterChoicechip> createState() =>
_SelectOptionFilterChoicechipState();
@@ -77,9 +78,10 @@ class _SelectOptionFilterChoicechipState
}
class SelectOptionFilterEditor extends StatefulWidget {
- final SelectOptionFilterEditorBloc bloc;
const SelectOptionFilterEditor({required this.bloc, super.key});
+ final SelectOptionFilterEditorBloc bloc;
+
@override
State<SelectOptionFilterEditor> createState() =>
_SelectOptionFilterEditorState();
diff --git a/frontend/appflowy_flutter/lib/plugins/database/grid/presentation/widgets/filter/choicechip/select_option/select_option_loader.dart b/frontend/appflowy_flutter/lib/plugins/database/grid/presentation/widgets/filter/choicechip/select_option/select_option_loader.dart
index 2b2e45c1b6..c36ac8c992 100644
--- a/frontend/appflowy_flutter/lib/plugins/database/grid/presentation/widgets/filter/choicechip/select_option/select_option_loader.dart
+++ b/frontend/appflowy_flutter/lib/plugins/database/grid/presentation/widgets/filter/choicechip/select_option/select_option_loader.dart
@@ -8,11 +8,9 @@ abstract class SelectOptionFilterDelegate {
class SingleSelectOptionFilterDelegateImpl
implements SelectOptionFilterDelegate {
- final FilterInfo filterInfo;
+ SingleSelectOptionFilterDelegateImpl({required this.filterInfo});
- SingleSelectOptionFilterDelegateImpl({
- required this.filterInfo,
- });
+ final FilterInfo filterInfo;
@override
List<SelectOptionPB> loadOptions() {
@@ -23,10 +21,10 @@ class SingleSelectOptionFilterDelegateImpl
class MultiSelectOptionFilterDelegateImpl
implements SelectOptionFilterDelegate {
- final FilterInfo filterInfo;
-
MultiSelectOptionFilterDelegateImpl({required this.filterInfo});
+ final FilterInfo filterInfo;
+
@override
List<SelectOptionPB> loadOptions() {
final parser = MultiSelectTypeOptionDataParser();
diff --git a/frontend/appflowy_flutter/lib/plugins/database/grid/presentation/widgets/filter/choicechip/text.dart b/frontend/appflowy_flutter/lib/plugins/database/grid/presentation/widgets/filter/choicechip/text.dart
index bf12b2d626..9c15af4f93 100644
--- a/frontend/appflowy_flutter/lib/plugins/database/grid/presentation/widgets/filter/choicechip/text.dart
+++ b/frontend/appflowy_flutter/lib/plugins/database/grid/presentation/widgets/filter/choicechip/text.dart
@@ -15,9 +15,10 @@ import '../filter_info.dart';
import 'choicechip.dart';
class TextFilterChoicechip extends StatefulWidget {
- final FilterInfo filterInfo;
const TextFilterChoicechip({required this.filterInfo, super.key});
+ final FilterInfo filterInfo;
+
@override
State<TextFilterChoicechip> createState() => _TextFilterChoicechipState();
}
@@ -77,9 +78,10 @@ class _TextFilterChoicechipState extends State<TextFilterChoicechip> {
}
class TextFilterEditor extends StatefulWidget {
- final TextFilterEditorBloc bloc;
const TextFilterEditor({required this.bloc, super.key});
+ final TextFilterEditorBloc bloc;
+
@override
State<TextFilterEditor> createState() => _TextFilterEditorState();
}
@@ -172,16 +174,17 @@ class _TextFilterEditorState extends State<TextFilterEditor> {
}
class TextFilterConditionPBList extends StatelessWidget {
- final FilterInfo filterInfo;
- final PopoverMutex popoverMutex;
- final Function(TextFilterConditionPB) onCondition;
const TextFilterConditionPBList({
+ super.key,
required this.filterInfo,
required this.popoverMutex,
required this.onCondition,
- super.key,
});
+ final FilterInfo filterInfo;
+ final PopoverMutex popoverMutex;
+ final Function(TextFilterConditionPB) onCondition;
+
@override
Widget build(BuildContext context) {
final textFilter = filterInfo.textFilter()!;
@@ -212,11 +215,11 @@ class TextFilterConditionPBList extends StatelessWidget {
}
class ConditionWrapper extends ActionCell {
+ ConditionWrapper(this.inner, this.isSelected);
+
final TextFilterConditionPB inner;
final bool isSelected;
- ConditionWrapper(this.inner, this.isSelected);
-
@override
Widget? rightIcon(Color iconColor) {
if (isSelected) {
diff --git a/frontend/appflowy_flutter/lib/plugins/database/grid/presentation/widgets/filter/choicechip/url.dart b/frontend/appflowy_flutter/lib/plugins/database/grid/presentation/widgets/filter/choicechip/url.dart
index 7ea6229302..440091f24d 100644
--- a/frontend/appflowy_flutter/lib/plugins/database/grid/presentation/widgets/filter/choicechip/url.dart
+++ b/frontend/appflowy_flutter/lib/plugins/database/grid/presentation/widgets/filter/choicechip/url.dart
@@ -3,9 +3,10 @@ import '../filter_info.dart';
import 'choicechip.dart';
class URLFilterChoicechip extends StatelessWidget {
- final FilterInfo filterInfo;
const URLFilterChoicechip({required this.filterInfo, super.key});
+ final FilterInfo filterInfo;
+
@override
Widget build(BuildContext context) {
return ChoiceChipButton(filterInfo: filterInfo);
diff --git a/frontend/appflowy_flutter/lib/plugins/database/grid/presentation/widgets/filter/condition_button.dart b/frontend/appflowy_flutter/lib/plugins/database/grid/presentation/widgets/filter/condition_button.dart
index edae081e31..736fdee63a 100644
--- a/frontend/appflowy_flutter/lib/plugins/database/grid/presentation/widgets/filter/condition_button.dart
+++ b/frontend/appflowy_flutter/lib/plugins/database/grid/presentation/widgets/filter/condition_button.dart
@@ -7,14 +7,15 @@ import 'package:flowy_infra_ui/style_widget/text.dart';
import 'package:flutter/material.dart';
class ConditionButton extends StatelessWidget {
- final String conditionName;
- final VoidCallback onTap;
const ConditionButton({
+ super.key,
required this.conditionName,
required this.onTap,
- super.key,
});
+ final String conditionName;
+ final VoidCallback onTap;
+
@override
Widget build(BuildContext context) {
final arrow = Transform.rotate(
diff --git a/frontend/appflowy_flutter/lib/plugins/database/grid/presentation/widgets/filter/create_filter_list.dart b/frontend/appflowy_flutter/lib/plugins/database/grid/presentation/widgets/filter/create_filter_list.dart
index c74b2546ef..13fbc53834 100644
--- a/frontend/appflowy_flutter/lib/plugins/database/grid/presentation/widgets/filter/create_filter_list.dart
+++ b/frontend/appflowy_flutter/lib/plugins/database/grid/presentation/widgets/filter/create_filter_list.dart
@@ -17,19 +17,19 @@ import '../../../../application/field/field_controller.dart';
import '../../../application/filter/filter_create_bloc.dart';
class GridCreateFilterList extends StatefulWidget {
- final String viewId;
- final FieldController fieldController;
- final VoidCallback onClosed;
- final VoidCallback? onCreateFilter;
-
const GridCreateFilterList({
+ super.key,
required this.viewId,
required this.fieldController,
required this.onClosed,
this.onCreateFilter,
- super.key,
});
+ final String viewId;
+ final FieldController fieldController;
+ final VoidCallback onClosed;
+ final VoidCallback? onCreateFilter;
+
@override
State<StatefulWidget> createState() => _GridCreateFilterListState();
}
@@ -148,14 +148,15 @@ class _FilterTextFieldDelegate extends SliverPersistentHeaderDelegate {
}
class GridFilterPropertyCell extends StatelessWidget {
- final FieldInfo fieldInfo;
- final Function(FieldInfo) onTap;
const GridFilterPropertyCell({
+ super.key,
required this.fieldInfo,
required this.onTap,
- super.key,
});
+ final FieldInfo fieldInfo;
+ final Function(FieldInfo) onTap;
+
@override
Widget build(BuildContext context) {
return FlowyButton(
diff --git a/frontend/appflowy_flutter/lib/plugins/database/grid/presentation/widgets/filter/disclosure_button.dart b/frontend/appflowy_flutter/lib/plugins/database/grid/presentation/widgets/filter/disclosure_button.dart
index cd93df49c1..4f71e48ab3 100644
--- a/frontend/appflowy_flutter/lib/plugins/database/grid/presentation/widgets/filter/disclosure_button.dart
+++ b/frontend/appflowy_flutter/lib/plugins/database/grid/presentation/widgets/filter/disclosure_button.dart
@@ -9,14 +9,15 @@ import 'package:flowy_infra_ui/style_widget/icon_button.dart';
import 'package:flutter/material.dart';
class DisclosureButton extends StatefulWidget {
- final PopoverMutex popoverMutex;
- final Function(FilterDisclosureAction) onAction;
const DisclosureButton({
+ super.key,
required this.popoverMutex,
required this.onAction,
- super.key,
});
+ final PopoverMutex popoverMutex;
+ final Function(FilterDisclosureAction) onAction;
+
@override
State<DisclosureButton> createState() => _DisclosureButtonState();
}
@@ -27,7 +28,6 @@ class _DisclosureButtonState extends State<DisclosureButton> {
return PopoverActionList<FilterDisclosureActionWrapper>(
asBarrier: true,
mutex: widget.popoverMutex,
- direction: PopoverDirection.rightWithTopAligned,
actions: FilterDisclosureAction.values
.map((action) => FilterDisclosureActionWrapper(action))
.toList(),
@@ -55,10 +55,10 @@ enum FilterDisclosureAction {
}
class FilterDisclosureActionWrapper extends ActionCell {
- final FilterDisclosureAction inner;
-
FilterDisclosureActionWrapper(this.inner);
+ final FilterDisclosureAction inner;
+
@override
Widget? leftIcon(Color iconColor) => null;
diff --git a/frontend/appflowy_flutter/lib/plugins/database/grid/presentation/widgets/filter/filter_info.dart b/frontend/appflowy_flutter/lib/plugins/database/grid/presentation/widgets/filter/filter_info.dart
index 58d476763a..36c6ebf030 100644
--- a/frontend/appflowy_flutter/lib/plugins/database/grid/presentation/widgets/filter/filter_info.dart
+++ b/frontend/appflowy_flutter/lib/plugins/database/grid/presentation/widgets/filter/filter_info.dart
@@ -8,12 +8,12 @@ import 'package:appflowy_backend/protobuf/flowy-database2/text_filter.pb.dart';
import 'package:appflowy_backend/protobuf/flowy-database2/util.pb.dart';
class FilterInfo {
+ FilterInfo(this.viewId, this.filter, this.fieldInfo);
+
final String viewId;
final FilterPB filter;
final FieldInfo fieldInfo;
- FilterInfo(this.viewId, this.filter, this.fieldInfo);
-
FilterInfo copyWith({FilterPB? filter, FieldInfo? fieldInfo}) {
return FilterInfo(
viewId,
diff --git a/frontend/appflowy_flutter/lib/plugins/database/grid/presentation/widgets/filter/filter_menu.dart b/frontend/appflowy_flutter/lib/plugins/database/grid/presentation/widgets/filter/filter_menu.dart
index 67697448ee..a59e84dd47 100644
--- a/frontend/appflowy_flutter/lib/plugins/database/grid/presentation/widgets/filter/filter_menu.dart
+++ b/frontend/appflowy_flutter/lib/plugins/database/grid/presentation/widgets/filter/filter_menu.dart
@@ -14,12 +14,13 @@ import 'create_filter_list.dart';
import 'filter_menu_item.dart';
class FilterMenu extends StatelessWidget {
- final FieldController fieldController;
const FilterMenu({
- required this.fieldController,
super.key,
+ required this.fieldController,
});
+ final FieldController fieldController;
+
@override
Widget build(BuildContext context) {
return BlocProvider<GridFilterMenuBloc>(
@@ -62,9 +63,10 @@ class FilterMenu extends StatelessWidget {
}
class AddFilterButton extends StatefulWidget {
- final String viewId;
const AddFilterButton({required this.viewId, super.key});
+ final String viewId;
+
@override
State<AddFilterButton> createState() => _AddFilterButtonState();
}
diff --git a/frontend/appflowy_flutter/lib/plugins/database/grid/presentation/widgets/filter/filter_menu_item.dart b/frontend/appflowy_flutter/lib/plugins/database/grid/presentation/widgets/filter/filter_menu_item.dart
index baf2263e63..524a17cee4 100644
--- a/frontend/appflowy_flutter/lib/plugins/database/grid/presentation/widgets/filter/filter_menu_item.dart
+++ b/frontend/appflowy_flutter/lib/plugins/database/grid/presentation/widgets/filter/filter_menu_item.dart
@@ -11,9 +11,10 @@ import 'choicechip/url.dart';
import 'filter_info.dart';
class FilterMenuItem extends StatelessWidget {
- final FilterInfo filterInfo;
const FilterMenuItem({required this.filterInfo, super.key});
+ final FilterInfo filterInfo;
+
@override
Widget build(BuildContext context) {
return buildFilterChoicechip(filterInfo);
diff --git a/frontend/appflowy_flutter/lib/plugins/database/grid/presentation/widgets/header/desktop_field_cell.dart b/frontend/appflowy_flutter/lib/plugins/database/grid/presentation/widgets/header/desktop_field_cell.dart
index 9c43b86f0a..b8855cb721 100755
--- a/frontend/appflowy_flutter/lib/plugins/database/grid/presentation/widgets/header/desktop_field_cell.dart
+++ b/frontend/appflowy_flutter/lib/plugins/database/grid/presentation/widgets/header/desktop_field_cell.dart
@@ -126,18 +126,18 @@ class _GridFieldCellState extends State<GridFieldCell> {
}
class _GridHeaderCellContainer extends StatelessWidget {
- final Widget child;
- final double width;
const _GridHeaderCellContainer({
required this.child,
required this.width,
});
+ final Widget child;
+ final double width;
+
@override
Widget build(BuildContext context) {
final borderSide = BorderSide(
color: Theme.of(context).dividerColor,
- width: 1.0,
);
final decoration = BoxDecoration(
border: Border(
@@ -193,20 +193,21 @@ class _DragToExpandLine extends StatelessWidget {
}
class FieldCellButton extends StatelessWidget {
- final VoidCallback onTap;
- final FieldPB field;
- final int? maxLines;
- final BorderRadius? radius;
- final EdgeInsets? margin;
const FieldCellButton({
+ super.key,
required this.field,
required this.onTap,
this.maxLines = 1,
this.radius = BorderRadius.zero,
this.margin,
- super.key,
});
+ final FieldPB field;
+ final VoidCallback onTap;
+ final int? maxLines;
+ final BorderRadius? radius;
+ final EdgeInsets? margin;
+
@override
Widget build(BuildContext context) {
return FlowyButton(
diff --git a/frontend/appflowy_flutter/lib/plugins/database/grid/presentation/widgets/header/field_editor.dart b/frontend/appflowy_flutter/lib/plugins/database/grid/presentation/widgets/header/field_editor.dart
index 635754efc4..124bf4de20 100644
--- a/frontend/appflowy_flutter/lib/plugins/database/grid/presentation/widgets/header/field_editor.dart
+++ b/frontend/appflowy_flutter/lib/plugins/database/grid/presentation/widgets/header/field_editor.dart
@@ -27,12 +27,6 @@ enum FieldEditorPage {
}
class FieldEditor extends StatefulWidget {
- final String viewId;
- final FieldController fieldController;
- final FieldPB field;
- final FieldEditorPage initialPage;
- final void Function(String fieldId)? onFieldInserted;
-
const FieldEditor({
super.key,
required this.viewId,
@@ -42,6 +36,12 @@ class FieldEditor extends StatefulWidget {
this.onFieldInserted,
});
+ final String viewId;
+ final FieldPB field;
+ final FieldController fieldController;
+ final FieldEditorPage initialPage;
+ final void Function(String fieldId)? onFieldInserted;
+
@override
State<StatefulWidget> createState() => _FieldEditorState();
}
@@ -131,9 +131,10 @@ class _FieldEditorState extends State<FieldEditor> {
}
class _EditFieldButton extends StatelessWidget {
- final void Function()? onTap;
const _EditFieldButton({this.onTap});
+ final void Function()? onTap;
+
@override
Widget build(BuildContext context) {
return SizedBox(
@@ -150,11 +151,6 @@ class _EditFieldButton extends StatelessWidget {
}
class FieldActionCell extends StatelessWidget {
- final String viewId;
- final FieldInfo fieldInfo;
- final FieldAction action;
- final PopoverMutex? popoverMutex;
-
const FieldActionCell({
super.key,
required this.viewId,
@@ -163,6 +159,11 @@ class FieldActionCell extends StatelessWidget {
this.popoverMutex,
});
+ final String viewId;
+ final FieldInfo fieldInfo;
+ final FieldAction action;
+ final PopoverMutex? popoverMutex;
+
@override
Widget build(BuildContext context) {
bool enable = true;
@@ -288,10 +289,6 @@ enum FieldAction {
}
class FieldDetailsEditor extends StatefulWidget {
- final String viewId;
- final TextEditingController textEditingController;
- final Function()? onAction;
-
const FieldDetailsEditor({
super.key,
required this.viewId,
@@ -299,6 +296,10 @@ class FieldDetailsEditor extends StatefulWidget {
this.onAction,
});
+ final String viewId;
+ final TextEditingController textEditingController;
+ final Function()? onAction;
+
@override
State<StatefulWidget> createState() => _FieldDetailsEditorState();
}
@@ -405,15 +406,15 @@ class _FieldDetailsEditorState extends State<FieldDetailsEditor> {
}
class FieldTypeOptionEditor extends StatelessWidget {
- final String viewId;
- final PopoverMutex popoverMutex;
-
const FieldTypeOptionEditor({
super.key,
required this.viewId,
required this.popoverMutex,
});
+ final String viewId;
+ final PopoverMutex popoverMutex;
+
@override
Widget build(BuildContext context) {
return BlocBuilder<FieldEditorBloc, FieldEditorState>(
@@ -450,9 +451,6 @@ class FieldTypeOptionEditor extends StatelessWidget {
}
class FieldNameTextField extends StatefulWidget {
- final TextEditingController textEditingController;
- final PopoverMutex? popoverMutex;
- final EdgeInsets padding;
const FieldNameTextField({
super.key,
required this.textEditingController,
@@ -460,6 +458,10 @@ class FieldNameTextField extends StatefulWidget {
this.padding = EdgeInsets.zero,
});
+ final TextEditingController textEditingController;
+ final PopoverMutex? popoverMutex;
+ final EdgeInsets padding;
+
@override
State<FieldNameTextField> createState() => _FieldNameTextFieldState();
}
@@ -514,12 +516,13 @@ class _FieldNameTextFieldState extends State<FieldNameTextField> {
}
class SwitchFieldButton extends StatefulWidget {
- final PopoverMutex popoverMutex;
const SwitchFieldButton({
super.key,
required this.popoverMutex,
});
+ final PopoverMutex popoverMutex;
+
@override
State<SwitchFieldButton> createState() => _SwitchFieldButtonState();
}
diff --git a/frontend/appflowy_flutter/lib/plugins/database/grid/presentation/widgets/header/field_type_list.dart b/frontend/appflowy_flutter/lib/plugins/database/grid/presentation/widgets/header/field_type_list.dart
index 06920fa082..65040052a6 100644
--- a/frontend/appflowy_flutter/lib/plugins/database/grid/presentation/widgets/header/field_type_list.dart
+++ b/frontend/appflowy_flutter/lib/plugins/database/grid/presentation/widgets/header/field_type_list.dart
@@ -10,9 +10,10 @@ import 'field_type_extension.dart';
typedef SelectFieldCallback = void Function(FieldType);
class FieldTypeList extends StatelessWidget with FlowyOverlayDelegate {
- final SelectFieldCallback onSelectField;
const FieldTypeList({required this.onSelectField, super.key});
+ final SelectFieldCallback onSelectField;
+
@override
Widget build(BuildContext context) {
final cells = FieldType.values.map((fieldType) {
@@ -43,14 +44,15 @@ class FieldTypeList extends StatelessWidget with FlowyOverlayDelegate {
}
class FieldTypeCell extends StatelessWidget {
- final FieldType fieldType;
- final SelectFieldCallback onSelectField;
const FieldTypeCell({
+ super.key,
required this.fieldType,
required this.onSelectField,
- super.key,
});
+ final FieldType fieldType;
+ final SelectFieldCallback onSelectField;
+
@override
Widget build(BuildContext context) {
return SizedBox(
diff --git a/frontend/appflowy_flutter/lib/plugins/database/grid/presentation/widgets/header/grid_header.dart b/frontend/appflowy_flutter/lib/plugins/database/grid/presentation/widgets/header/grid_header.dart
index 12df85d06c..26eae515cf 100644
--- a/frontend/appflowy_flutter/lib/plugins/database/grid/presentation/widgets/header/grid_header.dart
+++ b/frontend/appflowy_flutter/lib/plugins/database/grid/presentation/widgets/header/grid_header.dart
@@ -17,15 +17,15 @@ import '../../layout/sizes.dart';
import 'desktop_field_cell.dart';
class GridHeaderSliverAdaptor extends StatefulWidget {
- final String viewId;
- final ScrollController anchorScrollController;
-
const GridHeaderSliverAdaptor({
+ super.key,
required this.viewId,
required this.anchorScrollController,
- super.key,
});
+ final String viewId;
+ final ScrollController anchorScrollController;
+
@override
State<GridHeaderSliverAdaptor> createState() =>
_GridHeaderSliverAdaptorState();
@@ -56,9 +56,10 @@ class _GridHeaderSliverAdaptorState extends State<GridHeaderSliverAdaptor> {
}
class _GridHeader extends StatefulWidget {
+ const _GridHeader({required this.viewId, required this.fieldController});
+
final String viewId;
final FieldController fieldController;
- const _GridHeader({required this.viewId, required this.fieldController});
@override
State<_GridHeader> createState() => _GridHeaderState();
@@ -152,7 +153,7 @@ class _CellTrailing extends StatelessWidget {
width: GridSize.trailHeaderPadding,
decoration: BoxDecoration(
border: Border(
- bottom: BorderSide(color: Theme.of(context).dividerColor, width: 1.0),
+ bottom: BorderSide(color: Theme.of(context).dividerColor),
),
),
padding: GridSize.headerContentInsets,
diff --git a/frontend/appflowy_flutter/lib/plugins/database/grid/presentation/widgets/header/mobile_field_button.dart b/frontend/appflowy_flutter/lib/plugins/database/grid/presentation/widgets/header/mobile_field_button.dart
index c89f5e5ffa..0333a19a9b 100755
--- a/frontend/appflowy_flutter/lib/plugins/database/grid/presentation/widgets/header/mobile_field_button.dart
+++ b/frontend/appflowy_flutter/lib/plugins/database/grid/presentation/widgets/header/mobile_field_button.dart
@@ -8,12 +8,14 @@ import 'package:flutter/material.dart';
import 'field_type_extension.dart';
class MobileFieldButton extends StatelessWidget {
- final String viewId;
- final int? index;
- final FieldController fieldController;
- final FieldInfo fieldInfo;
- final BorderRadius? radius;
- final EdgeInsets? margin;
+ const MobileFieldButton.first({
+ super.key,
+ required this.viewId,
+ required this.fieldController,
+ required this.fieldInfo,
+ }) : radius = const BorderRadius.only(topLeft: Radius.circular(24)),
+ margin = const EdgeInsets.symmetric(vertical: 14, horizontal: 18),
+ index = null;
const MobileFieldButton({
super.key,
@@ -24,14 +26,12 @@ class MobileFieldButton extends StatelessWidget {
}) : radius = BorderRadius.zero,
margin = const EdgeInsets.symmetric(vertical: 14, horizontal: 12);
- const MobileFieldButton.first({
- super.key,
- required this.viewId,
- required this.fieldController,
- required this.fieldInfo,
- }) : radius = const BorderRadius.only(topLeft: Radius.circular(24)),
- margin = const EdgeInsets.symmetric(vertical: 14, horizontal: 18),
- index = null;
+ final String viewId;
+ final int? index;
+ final FieldController fieldController;
+ final FieldInfo fieldInfo;
+ final BorderRadius? radius;
+ final EdgeInsets? margin;
@override
Widget build(BuildContext context) {
@@ -65,7 +65,6 @@ class MobileFieldButton extends StatelessWidget {
BoxDecoration? _getDecoration(BuildContext context) {
final borderSide = BorderSide(
color: Theme.of(context).dividerColor,
- width: 1.0,
);
if (index == null) {
diff --git a/frontend/appflowy_flutter/lib/plugins/database/grid/presentation/widgets/header/mobile_grid_header.dart b/frontend/appflowy_flutter/lib/plugins/database/grid/presentation/widgets/header/mobile_grid_header.dart
index f009acf750..462ba4d944 100644
--- a/frontend/appflowy_flutter/lib/plugins/database/grid/presentation/widgets/header/mobile_grid_header.dart
+++ b/frontend/appflowy_flutter/lib/plugins/database/grid/presentation/widgets/header/mobile_grid_header.dart
@@ -16,15 +16,15 @@ import '../../layout/sizes.dart';
import 'mobile_field_button.dart';
class MobileGridHeader extends StatefulWidget {
- final String viewId;
- final ScrollController anchorScrollController;
-
const MobileGridHeader({
+ super.key,
required this.viewId,
required this.anchorScrollController,
- super.key,
});
+ final String viewId;
+ final ScrollController anchorScrollController;
+
@override
State<MobileGridHeader> createState() => _MobileGridHeaderState();
}
@@ -78,14 +78,14 @@ class _MobileGridHeaderState extends State<MobileGridHeader> {
}
class _GridHeader extends StatefulWidget {
- final String viewId;
- final FieldController fieldController;
-
const _GridHeader({
required this.viewId,
required this.fieldController,
});
+ final String viewId;
+ final FieldController fieldController;
+
@override
State<_GridHeader> createState() => _GridHeaderState();
}
@@ -196,7 +196,6 @@ class _CreateFieldButtonState extends State<CreateFieldButton> {
BoxDecoration? _getDecoration(BuildContext context) {
final borderSide = BorderSide(
color: Theme.of(context).dividerColor,
- width: 1.0,
);
return BoxDecoration(
diff --git a/frontend/appflowy_flutter/lib/plugins/database/grid/presentation/widgets/header/type_option/builder.dart b/frontend/appflowy_flutter/lib/plugins/database/grid/presentation/widgets/header/type_option/builder.dart
index e8ad145f38..7b3389c834 100644
--- a/frontend/appflowy_flutter/lib/plugins/database/grid/presentation/widgets/header/type_option/builder.dart
+++ b/frontend/appflowy_flutter/lib/plugins/database/grid/presentation/widgets/header/type_option/builder.dart
@@ -17,14 +17,6 @@ import 'url.dart';
typedef TypeOptionDataCallback = void Function(Uint8List typeOptionData);
abstract class TypeOptionEditorFactory {
- Widget? build({
- required BuildContext context,
- required String viewId,
- required FieldPB field,
- required PopoverMutex popoverMutex,
- required TypeOptionDataCallback onTypeOptionUpdated,
- });
-
factory TypeOptionEditorFactory.makeBuilder(FieldType fieldType) {
return switch (fieldType) {
FieldType.RichText => const RichTextTypeOptionEditorFactory(),
@@ -40,6 +32,14 @@ abstract class TypeOptionEditorFactory {
_ => throw UnimplementedError(),
};
}
+
+ Widget? build({
+ required BuildContext context,
+ required String viewId,
+ required FieldPB field,
+ required PopoverMutex popoverMutex,
+ required TypeOptionDataCallback onTypeOptionUpdated,
+ });
}
Widget? makeTypeOptionEditor({
diff --git a/frontend/appflowy_flutter/lib/plugins/database/grid/presentation/widgets/header/type_option/date/date_time_format.dart b/frontend/appflowy_flutter/lib/plugins/database/grid/presentation/widgets/header/type_option/date/date_time_format.dart
index 968b6c6156..4c7dc73ae2 100644
--- a/frontend/appflowy_flutter/lib/plugins/database/grid/presentation/widgets/header/type_option/date/date_time_format.dart
+++ b/frontend/appflowy_flutter/lib/plugins/database/grid/presentation/widgets/header/type_option/date/date_time_format.dart
@@ -57,14 +57,15 @@ class TimeFormatButton extends StatelessWidget {
}
class DateFormatList extends StatelessWidget {
- final DateFormatPB selectedFormat;
- final Function(DateFormatPB format) onSelected;
const DateFormatList({
+ super.key,
required this.selectedFormat,
required this.onSelected,
- super.key,
});
+ final DateFormatPB selectedFormat;
+ final Function(DateFormatPB format) onSelected;
+
@override
Widget build(BuildContext context) {
final cells = DateFormatPB.values.map((format) {
@@ -92,16 +93,17 @@ class DateFormatList extends StatelessWidget {
}
class DateFormatCell extends StatelessWidget {
- final bool isSelected;
- final DateFormatPB dateFormat;
- final Function(DateFormatPB format) onSelected;
const DateFormatCell({
+ super.key,
required this.dateFormat,
required this.onSelected,
required this.isSelected,
- super.key,
});
+ final DateFormatPB dateFormat;
+ final Function(DateFormatPB format) onSelected;
+ final bool isSelected;
+
@override
Widget build(BuildContext context) {
Widget? checkmark;
@@ -140,14 +142,15 @@ extension DateFormatExtension on DateFormatPB {
}
class TimeFormatList extends StatelessWidget {
- final TimeFormatPB selectedFormat;
- final Function(TimeFormatPB format) onSelected;
const TimeFormatList({
+ super.key,
required this.selectedFormat,
required this.onSelected,
- super.key,
});
+ final TimeFormatPB selectedFormat;
+ final Function(TimeFormatPB format) onSelected;
+
@override
Widget build(BuildContext context) {
final cells = TimeFormatPB.values.map((format) {
@@ -175,16 +178,17 @@ class TimeFormatList extends StatelessWidget {
}
class TimeFormatCell extends StatelessWidget {
- final TimeFormatPB timeFormat;
- final bool isSelected;
- final Function(TimeFormatPB format) onSelected;
const TimeFormatCell({
+ super.key,
required this.timeFormat,
required this.onSelected,
required this.isSelected,
- super.key,
});
+ final TimeFormatPB timeFormat;
+ final bool isSelected;
+ final Function(TimeFormatPB format) onSelected;
+
@override
Widget build(BuildContext context) {
Widget? checkmark;
@@ -217,14 +221,15 @@ extension TimeFormatExtension on TimeFormatPB {
}
class IncludeTimeButton extends StatelessWidget {
- final bool value;
- final Function(bool value) onChanged;
const IncludeTimeButton({
super.key,
required this.onChanged,
required this.value,
});
+ final Function(bool value) onChanged;
+ final bool value;
+
@override
Widget build(BuildContext context) {
return SizedBox(
diff --git a/frontend/appflowy_flutter/lib/plugins/database/grid/presentation/widgets/header/type_option/number.dart b/frontend/appflowy_flutter/lib/plugins/database/grid/presentation/widgets/header/type_option/number.dart
index 45cbe0912d..fa980d0ab7 100644
--- a/frontend/appflowy_flutter/lib/plugins/database/grid/presentation/widgets/header/type_option/number.dart
+++ b/frontend/appflowy_flutter/lib/plugins/database/grid/presentation/widgets/header/type_option/number.dart
@@ -95,15 +95,15 @@ class NumberTypeOptionEditorFactory implements TypeOptionEditorFactory {
typedef SelectNumberFormatCallback = void Function(NumberFormatPB format);
class NumberFormatList extends StatelessWidget {
- final SelectNumberFormatCallback onSelected;
- final NumberFormatPB selectedFormat;
-
const NumberFormatList({
super.key,
required this.selectedFormat,
required this.onSelected,
});
+ final NumberFormatPB selectedFormat;
+ final SelectNumberFormatCallback onSelected;
+
@override
Widget build(BuildContext context) {
return BlocProvider(
@@ -149,16 +149,17 @@ class NumberFormatList extends StatelessWidget {
}
class NumberFormatCell extends StatelessWidget {
- final NumberFormatPB format;
- final bool isSelected;
- final SelectNumberFormatCallback onSelected;
const NumberFormatCell({
- required this.isSelected,
+ super.key,
required this.format,
+ required this.isSelected,
required this.onSelected,
- super.key,
});
+ final NumberFormatPB format;
+ final bool isSelected;
+ final SelectNumberFormatCallback onSelected;
+
@override
Widget build(BuildContext context) {
final checkmark = isSelected ? const FlowySvg(FlowySvgs.check_s) : null;
diff --git a/frontend/appflowy_flutter/lib/plugins/database/grid/presentation/widgets/header/type_option/select/select_option.dart b/frontend/appflowy_flutter/lib/plugins/database/grid/presentation/widgets/header/type_option/select/select_option.dart
index 093cf752bd..1b7ad57dfa 100644
--- a/frontend/appflowy_flutter/lib/plugins/database/grid/presentation/widgets/header/type_option/select/select_option.dart
+++ b/frontend/appflowy_flutter/lib/plugins/database/grid/presentation/widgets/header/type_option/select/select_option.dart
@@ -15,11 +15,6 @@ import 'package:appflowy/generated/locale_keys.g.dart';
import 'select_option_editor.dart';
class SelectOptionTypeOptionWidget extends StatelessWidget {
- final List<SelectOptionPB> options;
- final VoidCallback beginEdit;
- final ISelectOptionAction typeOptionAction;
- final PopoverMutex? popoverMutex;
-
const SelectOptionTypeOptionWidget({
super.key,
required this.options,
@@ -28,6 +23,11 @@ class SelectOptionTypeOptionWidget extends StatelessWidget {
this.popoverMutex,
});
+ final List<SelectOptionPB> options;
+ final VoidCallback beginEdit;
+ final ISelectOptionAction typeOptionAction;
+ final PopoverMutex? popoverMutex;
+
@override
Widget build(BuildContext context) {
return BlocProvider<SelectOptionTypeOptionBloc>(
@@ -89,9 +89,10 @@ class _OptionTitle extends StatelessWidget {
}
class _OptionCell extends StatefulWidget {
+ const _OptionCell({required this.option, this.popoverMutex});
+
final SelectOptionPB option;
final PopoverMutex? popoverMutex;
- const _OptionCell({required this.option, this.popoverMutex});
@override
State<_OptionCell> createState() => _OptionCellState();
@@ -185,12 +186,9 @@ class _AddOptionButton extends StatelessWidget {
}
class CreateOptionTextField extends StatefulWidget {
- final PopoverMutex? popoverMutex;
+ const CreateOptionTextField({super.key, this.popoverMutex});
- const CreateOptionTextField({
- super.key,
- this.popoverMutex,
- });
+ final PopoverMutex? popoverMutex;
@override
State<CreateOptionTextField> createState() => _CreateOptionTextFieldState();
diff --git a/frontend/appflowy_flutter/lib/plugins/database/grid/presentation/widgets/header/type_option/select/select_option_editor.dart b/frontend/appflowy_flutter/lib/plugins/database/grid/presentation/widgets/header/type_option/select/select_option_editor.dart
index 725ef65788..20558d3a62 100644
--- a/frontend/appflowy_flutter/lib/plugins/database/grid/presentation/widgets/header/type_option/select/select_option_editor.dart
+++ b/frontend/appflowy_flutter/lib/plugins/database/grid/presentation/widgets/header/type_option/select/select_option_editor.dart
@@ -17,20 +17,21 @@ import '../../../../layout/sizes.dart';
import '../../../common/type_option_separator.dart';
class SelectOptionTypeOptionEditor extends StatelessWidget {
- final SelectOptionPB option;
- final VoidCallback onDeleted;
- final Function(SelectOptionPB) onUpdated;
- final bool showOptions;
- final bool autoFocus;
const SelectOptionTypeOptionEditor({
+ super.key,
required this.option,
required this.onDeleted,
required this.onUpdated,
this.showOptions = true,
this.autoFocus = true,
- super.key,
});
+ final SelectOptionPB option;
+ final VoidCallback onDeleted;
+ final Function(SelectOptionPB) onUpdated;
+ final bool showOptions;
+ final bool autoFocus;
+
static String get identifier => (SelectOptionTypeOptionEditor).toString();
@override
@@ -118,13 +119,14 @@ class _DeleteTag extends StatelessWidget {
}
class _OptionNameTextField extends StatelessWidget {
- final String name;
- final bool autoFocus;
const _OptionNameTextField({
required this.name,
required this.autoFocus,
});
+ final String name;
+ final bool autoFocus;
+
@override
Widget build(BuildContext context) {
return FlowyTextField(
diff --git a/frontend/appflowy_flutter/lib/plugins/database/grid/presentation/widgets/row/mobile_row.dart b/frontend/appflowy_flutter/lib/plugins/database/grid/presentation/widgets/row/mobile_row.dart
index b75f8b8d72..f5ce1f9c40 100755
--- a/frontend/appflowy_flutter/lib/plugins/database/grid/presentation/widgets/row/mobile_row.dart
+++ b/frontend/appflowy_flutter/lib/plugins/database/grid/presentation/widgets/row/mobile_row.dart
@@ -18,11 +18,6 @@ import "package:appflowy/generated/locale_keys.g.dart";
import 'package:easy_localization/easy_localization.dart';
class MobileGridRow extends StatefulWidget {
- final DatabaseController databaseController;
- final RowId rowId;
- final void Function(BuildContext context) openDetailPage;
- final bool isDraggable;
-
const MobileGridRow({
super.key,
required this.rowId,
@@ -31,6 +26,11 @@ class MobileGridRow extends StatefulWidget {
this.isDraggable = false,
});
+ final RowId rowId;
+ final DatabaseController databaseController;
+ final void Function(BuildContext context) openDetailPage;
+ final bool isDraggable;
+
@override
State<MobileGridRow> createState() => _MobileGridRowState();
}
@@ -111,16 +111,17 @@ class InsertRowButton extends StatelessWidget {
}
class RowContent extends StatelessWidget {
- final FieldController fieldController;
- final VoidCallback onExpand;
- final EditableCellBuilder builder;
const RowContent({
super.key,
required this.fieldController,
- required this.builder,
required this.onExpand,
+ required this.builder,
});
+ final FieldController fieldController;
+ final VoidCallback onExpand;
+ final EditableCellBuilder builder;
+
@override
Widget build(BuildContext context) {
return BlocBuilder<RowBloc, RowState>(
diff --git a/frontend/appflowy_flutter/lib/plugins/database/grid/presentation/widgets/row/row.dart b/frontend/appflowy_flutter/lib/plugins/database/grid/presentation/widgets/row/row.dart
index d13bce5290..78d9a8f5f1 100755
--- a/frontend/appflowy_flutter/lib/plugins/database/grid/presentation/widgets/row/row.dart
+++ b/frontend/appflowy_flutter/lib/plugins/database/grid/presentation/widgets/row/row.dart
@@ -22,16 +22,6 @@ import '../../layout/sizes.dart';
import 'action.dart';
class GridRow extends StatefulWidget {
- final FieldController fieldController;
- final RowId viewId;
- final RowId rowId;
- final RowController rowController;
- final EditableCellBuilder cellBuilder;
- final void Function(BuildContext, EditableCellBuilder) openDetailPage;
-
- final int? index;
- final bool isDraggable;
-
const GridRow({
super.key,
required this.fieldController,
@@ -44,6 +34,15 @@ class GridRow extends StatefulWidget {
this.isDraggable = false,
});
+ final FieldController fieldController;
+ final RowId viewId;
+ final RowId rowId;
+ final RowController rowController;
+ final EditableCellBuilder cellBuilder;
+ final void Function(BuildContext, EditableCellBuilder) openDetailPage;
+ final int? index;
+ final bool isDraggable;
+
@override
State<GridRow> createState() => _GridRowState();
}
@@ -83,14 +82,14 @@ class _GridRowState extends State<GridRow> {
}
class _RowLeading extends StatefulWidget {
- final int? index;
- final bool isDraggable;
-
const _RowLeading({
this.index,
this.isDraggable = false,
});
+ final int? index;
+ final bool isDraggable;
+
@override
State<_RowLeading> createState() => _RowLeadingState();
}
@@ -310,9 +309,10 @@ class RegionStateNotifier extends ChangeNotifier {
}
class _RowEnterRegion extends StatefulWidget {
- final Widget child;
const _RowEnterRegion({required this.child});
+ final Widget child;
+
@override
State<_RowEnterRegion> createState() => _RowEnterRegionState();
}
diff --git a/frontend/appflowy_flutter/lib/plugins/database/grid/presentation/widgets/shortcuts.dart b/frontend/appflowy_flutter/lib/plugins/database/grid/presentation/widgets/shortcuts.dart
index 1dfcebee71..faf33c61ec 100644
--- a/frontend/appflowy_flutter/lib/plugins/database/grid/presentation/widgets/shortcuts.dart
+++ b/frontend/appflowy_flutter/lib/plugins/database/grid/presentation/widgets/shortcuts.dart
@@ -2,9 +2,10 @@ import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
class GridShortcuts extends StatelessWidget {
- final Widget child;
const GridShortcuts({required this.child, super.key});
+ final Widget child;
+
@override
Widget build(BuildContext context) {
return Shortcuts(
@@ -29,9 +30,9 @@ Map<Type, Action<Intent>> bindActions() {
}
class KeyboardKeyIdent extends Intent {
- final KeyboardKey key;
-
const KeyboardKeyIdent(this.key);
+
+ final KeyboardKey key;
}
class KeyboardBindingAction extends Action<KeyboardKeyIdent> {
diff --git a/frontend/appflowy_flutter/lib/plugins/database/grid/presentation/widgets/sort/create_sort_list.dart b/frontend/appflowy_flutter/lib/plugins/database/grid/presentation/widgets/sort/create_sort_list.dart
index 6e718d31c5..91ac4f02ca 100644
--- a/frontend/appflowy_flutter/lib/plugins/database/grid/presentation/widgets/sort/create_sort_list.dart
+++ b/frontend/appflowy_flutter/lib/plugins/database/grid/presentation/widgets/sort/create_sort_list.dart
@@ -16,19 +16,19 @@ import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
class GridCreateSortList extends StatefulWidget {
- final String viewId;
- final FieldController fieldController;
- final VoidCallback onClosed;
- final VoidCallback? onCreateSort;
-
const GridCreateSortList({
+ super.key,
required this.viewId,
required this.fieldController,
required this.onClosed,
this.onCreateSort,
- super.key,
});
+ final String viewId;
+ final FieldController fieldController;
+ final VoidCallback onClosed;
+ final VoidCallback? onCreateSort;
+
@override
State<StatefulWidget> createState() => _GridCreateSortListState();
}
@@ -147,14 +147,15 @@ class _SortTextFieldDelegate extends SliverPersistentHeaderDelegate {
}
class GridSortPropertyCell extends StatelessWidget {
- final FieldInfo fieldInfo;
- final Function(FieldInfo) onTap;
const GridSortPropertyCell({
+ super.key,
required this.fieldInfo,
required this.onTap,
- super.key,
});
+ final FieldInfo fieldInfo;
+ final Function(FieldInfo) onTap;
+
@override
Widget build(BuildContext context) {
return FlowyButton(
diff --git a/frontend/appflowy_flutter/lib/plugins/database/grid/presentation/widgets/sort/order_panel.dart b/frontend/appflowy_flutter/lib/plugins/database/grid/presentation/widgets/sort/order_panel.dart
index 3ec65da2b9..0d1a0fe1d0 100644
--- a/frontend/appflowy_flutter/lib/plugins/database/grid/presentation/widgets/sort/order_panel.dart
+++ b/frontend/appflowy_flutter/lib/plugins/database/grid/presentation/widgets/sort/order_panel.dart
@@ -6,9 +6,10 @@ import 'package:flowy_infra_ui/style_widget/text.dart';
import 'package:flutter/material.dart';
class OrderPanel extends StatelessWidget {
- final Function(SortConditionPB) onCondition;
const OrderPanel({required this.onCondition, super.key});
+ final Function(SortConditionPB) onCondition;
+
@override
Widget build(BuildContext context) {
final List<Widget> children = SortConditionPB.values.map((condition) {
@@ -32,14 +33,15 @@ class OrderPanel extends StatelessWidget {
}
class OrderPannelItem extends StatelessWidget {
- final SortConditionPB condition;
- final Function(SortConditionPB) onCondition;
const OrderPannelItem({
+ super.key,
required this.condition,
required this.onCondition,
- super.key,
});
+ final SortConditionPB condition;
+ final Function(SortConditionPB) onCondition;
+
@override
Widget build(BuildContext context) {
return SizedBox(
diff --git a/frontend/appflowy_flutter/lib/plugins/database/grid/presentation/widgets/sort/sort_choice_button.dart b/frontend/appflowy_flutter/lib/plugins/database/grid/presentation/widgets/sort/sort_choice_button.dart
index 07d24c0b0e..847c6daca7 100644
--- a/frontend/appflowy_flutter/lib/plugins/database/grid/presentation/widgets/sort/sort_choice_button.dart
+++ b/frontend/appflowy_flutter/lib/plugins/database/grid/presentation/widgets/sort/sort_choice_button.dart
@@ -4,23 +4,23 @@ import 'package:flowy_infra_ui/style_widget/text.dart';
import 'package:flutter/material.dart';
class SortChoiceButton extends StatelessWidget {
- final String text;
- final VoidCallback? onTap;
- final Widget? leftIcon;
- final Widget? rightIcon;
- final Radius radius;
- final bool editable;
-
const SortChoiceButton({
+ super.key,
required this.text,
this.onTap,
this.radius = const Radius.circular(14),
this.leftIcon,
this.rightIcon,
this.editable = true,
- super.key,
});
+ final String text;
+ final VoidCallback? onTap;
+ final Radius radius;
+ final Widget? leftIcon;
+ final Widget? rightIcon;
+ final bool editable;
+
@override
Widget build(BuildContext context) {
return FlowyButton(
@@ -29,7 +29,6 @@ class SortChoiceButton extends StatelessWidget {
border: Border.fromBorderSide(
BorderSide(
color: AFThemeExtension.of(context).toggleOffFill,
- width: 1.0,
),
),
borderRadius: const BorderRadius.all(Radius.circular(14)),
diff --git a/frontend/appflowy_flutter/lib/plugins/database/grid/presentation/widgets/sort/sort_editor.dart b/frontend/appflowy_flutter/lib/plugins/database/grid/presentation/widgets/sort/sort_editor.dart
index dafac28194..b3efb32b96 100644
--- a/frontend/appflowy_flutter/lib/plugins/database/grid/presentation/widgets/sort/sort_editor.dart
+++ b/frontend/appflowy_flutter/lib/plugins/database/grid/presentation/widgets/sort/sort_editor.dart
@@ -20,10 +20,6 @@ import 'sort_choice_button.dart';
import 'sort_info.dart';
class SortEditor extends StatefulWidget {
- final String viewId;
- final List<SortInfo> sortInfos;
- final FieldController fieldController;
-
const SortEditor({
super.key,
required this.viewId,
@@ -31,6 +27,10 @@ class SortEditor extends StatefulWidget {
required this.sortInfos,
});
+ final String viewId;
+ final FieldController fieldController;
+ final List<SortInfo> sortInfos;
+
@override
State<SortEditor> createState() => _SortEditorState();
}
@@ -83,15 +83,15 @@ class _SortEditorState extends State<SortEditor> {
}
class DatabaseSortItem extends StatelessWidget {
- final SortInfo sortInfo;
- final PopoverMutex popoverMutex;
-
const DatabaseSortItem({
super.key,
required this.popoverMutex,
required this.sortInfo,
});
+ final PopoverMutex popoverMutex;
+ final SortInfo sortInfo;
+
@override
Widget build(BuildContext context) {
final deleteButton = FlowyIconButton(
@@ -142,10 +142,6 @@ extension SortConditionExtension on SortConditionPB {
}
class DatabaseAddSortButton extends StatefulWidget {
- final String viewId;
- final FieldController fieldController;
- final PopoverMutex popoverMutex;
-
const DatabaseAddSortButton({
super.key,
required this.viewId,
@@ -153,6 +149,10 @@ class DatabaseAddSortButton extends StatefulWidget {
required this.popoverMutex,
});
+ final String viewId;
+ final FieldController fieldController;
+ final PopoverMutex popoverMutex;
+
@override
State<DatabaseAddSortButton> createState() => _DatabaseAddSortButtonState();
}
@@ -192,11 +192,9 @@ class _DatabaseAddSortButtonState extends State<DatabaseAddSortButton> {
}
class DatabaseDeleteSortButton extends StatelessWidget {
+ const DatabaseDeleteSortButton({super.key, required this.popoverMutex});
+
final PopoverMutex popoverMutex;
- const DatabaseDeleteSortButton({
- super.key,
- required this.popoverMutex,
- });
@override
Widget build(BuildContext context) {
@@ -221,14 +219,15 @@ class DatabaseDeleteSortButton extends StatelessWidget {
}
class DatabaseSortItemOrderButton extends StatefulWidget {
- final SortInfo sortInfo;
- final PopoverMutex popoverMutex;
const DatabaseSortItemOrderButton({
super.key,
required this.popoverMutex,
required this.sortInfo,
});
+ final PopoverMutex popoverMutex;
+ final SortInfo sortInfo;
+
@override
State<DatabaseSortItemOrderButton> createState() =>
_DatabaseSortItemOrderButtonState();
diff --git a/frontend/appflowy_flutter/lib/plugins/database/grid/presentation/widgets/sort/sort_info.dart b/frontend/appflowy_flutter/lib/plugins/database/grid/presentation/widgets/sort/sort_info.dart
index 9813514f82..eef8d700ba 100644
--- a/frontend/appflowy_flutter/lib/plugins/database/grid/presentation/widgets/sort/sort_info.dart
+++ b/frontend/appflowy_flutter/lib/plugins/database/grid/presentation/widgets/sort/sort_info.dart
@@ -2,11 +2,11 @@ import 'package:appflowy/plugins/database/application/field/field_info.dart';
import 'package:appflowy_backend/protobuf/flowy-database2/sort_entities.pb.dart';
class SortInfo {
+ SortInfo({required this.sortPB, required this.fieldInfo});
+
final SortPB sortPB;
final FieldInfo fieldInfo;
- SortInfo({required this.sortPB, required this.fieldInfo});
-
String get sortId => sortPB.id;
String get fieldId => sortPB.fieldId;
diff --git a/frontend/appflowy_flutter/lib/plugins/database/grid/presentation/widgets/sort/sort_menu.dart b/frontend/appflowy_flutter/lib/plugins/database/grid/presentation/widgets/sort/sort_menu.dart
index 7d1f668abf..f7663cf470 100644
--- a/frontend/appflowy_flutter/lib/plugins/database/grid/presentation/widgets/sort/sort_menu.dart
+++ b/frontend/appflowy_flutter/lib/plugins/database/grid/presentation/widgets/sort/sort_menu.dart
@@ -15,13 +15,13 @@ import 'sort_editor.dart';
import 'sort_info.dart';
class SortMenu extends StatelessWidget {
- final FieldController fieldController;
-
const SortMenu({
super.key,
required this.fieldController,
});
+ final FieldController fieldController;
+
@override
Widget build(BuildContext context) {
return BlocProvider<SortMenuBloc>(
@@ -59,15 +59,15 @@ class SortMenu extends StatelessWidget {
}
class SortChoiceChip extends StatelessWidget {
- final List<SortInfo> sortInfos;
- final VoidCallback? onTap;
-
const SortChoiceChip({
super.key,
required this.sortInfos,
this.onTap,
});
+ final List<SortInfo> sortInfos;
+ final VoidCallback? onTap;
+
@override
Widget build(BuildContext context) {
final arrow = Transform.rotate(
diff --git a/frontend/appflowy_flutter/lib/plugins/database/grid/presentation/widgets/toolbar/grid_setting_bar.dart b/frontend/appflowy_flutter/lib/plugins/database/grid/presentation/widgets/toolbar/grid_setting_bar.dart
index 1e3b23a2fc..347ada8883 100644
--- a/frontend/appflowy_flutter/lib/plugins/database/grid/presentation/widgets/toolbar/grid_setting_bar.dart
+++ b/frontend/appflowy_flutter/lib/plugins/database/grid/presentation/widgets/toolbar/grid_setting_bar.dart
@@ -11,14 +11,15 @@ import 'filter_button.dart';
import 'sort_button.dart';
class GridSettingBar extends StatelessWidget {
- final DatabaseController controller;
- final ToggleExtensionNotifier toggleExtension;
const GridSettingBar({
+ super.key,
required this.controller,
required this.toggleExtension,
- super.key,
});
+ final DatabaseController controller;
+ final ToggleExtensionNotifier toggleExtension;
+
@override
Widget build(BuildContext context) {
return MultiBlocProvider(
diff --git a/frontend/appflowy_flutter/lib/plugins/database/grid/presentation/widgets/toolbar/sort_button.dart b/frontend/appflowy_flutter/lib/plugins/database/grid/presentation/widgets/toolbar/sort_button.dart
index 47f7a203b3..585be21787 100644
--- a/frontend/appflowy_flutter/lib/plugins/database/grid/presentation/widgets/toolbar/sort_button.dart
+++ b/frontend/appflowy_flutter/lib/plugins/database/grid/presentation/widgets/toolbar/sort_button.dart
@@ -60,7 +60,6 @@ class _SortButtonState extends State<SortButton> {
direction: PopoverDirection.bottomWithLeftAligned,
constraints: BoxConstraints.loose(const Size(200, 300)),
offset: const Offset(0, 8),
- margin: const EdgeInsets.all(6),
triggerActions: PopoverTriggerFlags.none,
child: child,
popupBuilder: (BuildContext context) {
diff --git a/frontend/appflowy_flutter/lib/plugins/database/tab_bar/desktop/setting_menu.dart b/frontend/appflowy_flutter/lib/plugins/database/tab_bar/desktop/setting_menu.dart
index 257195c050..5ddc111bcf 100644
--- a/frontend/appflowy_flutter/lib/plugins/database/tab_bar/desktop/setting_menu.dart
+++ b/frontend/appflowy_flutter/lib/plugins/database/tab_bar/desktop/setting_menu.dart
@@ -11,16 +11,17 @@ import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:provider/provider.dart';
class DatabaseViewSettingExtension extends StatelessWidget {
- final String viewId;
- final DatabaseController databaseController;
- final ToggleExtensionNotifier toggleExtension;
const DatabaseViewSettingExtension({
+ super.key,
required this.viewId,
required this.databaseController,
required this.toggleExtension,
- super.key,
});
+ final String viewId;
+ final DatabaseController databaseController;
+ final ToggleExtensionNotifier toggleExtension;
+
@override
Widget build(BuildContext context) {
return ChangeNotifierProvider.value(
@@ -45,10 +46,9 @@ class DatabaseViewSettingExtension extends StatelessWidget {
}
class _DatabaseViewSettingContent extends StatelessWidget {
+ const _DatabaseViewSettingContent({required this.fieldController});
+
final FieldController fieldController;
- const _DatabaseViewSettingContent({
- required this.fieldController,
- });
@override
Widget build(BuildContext context) {
@@ -64,7 +64,6 @@ class _DatabaseViewSettingContent extends StatelessWidget {
border: Border(
bottom: BorderSide(
color: Theme.of(context).dividerColor,
- width: 1.0,
),
),
),
diff --git a/frontend/appflowy_flutter/lib/plugins/database/tab_bar/desktop/tab_bar_add_button.dart b/frontend/appflowy_flutter/lib/plugins/database/tab_bar/desktop/tab_bar_add_button.dart
index 1e358695d0..b928423310 100644
--- a/frontend/appflowy_flutter/lib/plugins/database/tab_bar/desktop/tab_bar_add_button.dart
+++ b/frontend/appflowy_flutter/lib/plugins/database/tab_bar/desktop/tab_bar_add_button.dart
@@ -12,11 +12,9 @@ import 'package:flowy_infra_ui/style_widget/extension.dart';
import 'package:flutter/material.dart';
class AddDatabaseViewButton extends StatefulWidget {
+ const AddDatabaseViewButton({super.key, required this.onTap});
+
final Function(DatabaseLayoutPB) onTap;
- const AddDatabaseViewButton({
- required this.onTap,
- super.key,
- });
@override
State<AddDatabaseViewButton> createState() => _AddDatabaseViewButtonState();
@@ -70,11 +68,9 @@ class _AddDatabaseViewButtonState extends State<AddDatabaseViewButton> {
}
class TabBarAddButtonAction extends StatelessWidget {
+ const TabBarAddButtonAction({super.key, required this.onTap});
+
final Function(DatabaseLayoutPB) onTap;
- const TabBarAddButtonAction({
- required this.onTap,
- super.key,
- });
@override
Widget build(BuildContext context) {
@@ -97,14 +93,15 @@ class TabBarAddButtonAction extends StatelessWidget {
}
class TabBarAddButtonActionCell extends StatelessWidget {
- final DatabaseLayoutPB action;
- final void Function(DatabaseLayoutPB) onTap;
const TabBarAddButtonActionCell({
+ super.key,
required this.action,
required this.onTap,
- super.key,
});
+ final DatabaseLayoutPB action;
+ final void Function(DatabaseLayoutPB) onTap;
+
@override
Widget build(BuildContext context) {
return SizedBox(
diff --git a/frontend/appflowy_flutter/lib/plugins/database/tab_bar/desktop/tab_bar_header.dart b/frontend/appflowy_flutter/lib/plugins/database/tab_bar/desktop/tab_bar_header.dart
index 331c6ccc20..08f77525d8 100644
--- a/frontend/appflowy_flutter/lib/plugins/database/tab_bar/desktop/tab_bar_header.dart
+++ b/frontend/appflowy_flutter/lib/plugins/database/tab_bar/desktop/tab_bar_header.dart
@@ -134,16 +134,17 @@ class _DatabaseTabBarState extends State<DatabaseTabBar> {
}
class DatabaseTabBarItem extends StatelessWidget {
- final bool isSelected;
- final ViewPB view;
- final Function(ViewPB) onTap;
const DatabaseTabBarItem({
+ super.key,
required this.view,
required this.isSelected,
required this.onTap,
- super.key,
});
+ final ViewPB view;
+ final bool isSelected;
+ final Function(ViewPB) onTap;
+
@override
Widget build(BuildContext context) {
return ConstrainedBox(
@@ -176,16 +177,17 @@ class DatabaseTabBarItem extends StatelessWidget {
}
class TabBarItemButton extends StatelessWidget {
- final ViewPB view;
- final bool isSelected;
- final VoidCallback onTap;
const TabBarItemButton({
- required this.view,
- required this.onTap,
super.key,
+ required this.view,
required this.isSelected,
+ required this.onTap,
});
+ final ViewPB view;
+ final bool isSelected;
+ final VoidCallback onTap;
+
@override
Widget build(BuildContext context) {
return PopoverActionList<TabBarViewAction>(
diff --git a/frontend/appflowy_flutter/lib/plugins/database/tab_bar/tab_bar_view.dart b/frontend/appflowy_flutter/lib/plugins/database/tab_bar/tab_bar_view.dart
index 7235d422e4..0da24d9e3d 100644
--- a/frontend/appflowy_flutter/lib/plugins/database/tab_bar/tab_bar_view.dart
+++ b/frontend/appflowy_flutter/lib/plugins/database/tab_bar/tab_bar_view.dart
@@ -44,13 +44,6 @@ abstract class DatabaseTabBarItemBuilder {
}
class DatabaseTabBarView extends StatefulWidget {
- final ViewPB view;
- final bool shrinkWrap;
-
- /// Used to open a Row on plugin load
- ///
- final String? initialRowId;
-
const DatabaseTabBarView({
super.key,
required this.view,
@@ -58,12 +51,19 @@ class DatabaseTabBarView extends StatefulWidget {
this.initialRowId,
});
+ final ViewPB view;
+ final bool shrinkWrap;
+
+ /// Used to open a Row on plugin load
+ ///
+ final String? initialRowId;
+
@override
State<DatabaseTabBarView> createState() => _DatabaseTabBarViewState();
}
class _DatabaseTabBarViewState extends State<DatabaseTabBarView> {
- final PageController _pageController = PageController(initialPage: 0);
+ final PageController _pageController = PageController();
late String? _initialRowId = widget.initialRowId;
@override
@@ -169,6 +169,13 @@ class _DatabaseTabBarViewState extends State<DatabaseTabBarView> {
}
class DatabaseTabBarViewPlugin extends Plugin {
+ DatabaseTabBarViewPlugin({
+ required ViewPB view,
+ required PluginType pluginType,
+ this.initialRowId,
+ }) : _pluginType = pluginType,
+ notifier = ViewPluginNotifier(view: view);
+
@override
final ViewPluginNotifier notifier;
final PluginType _pluginType;
@@ -177,13 +184,6 @@ class DatabaseTabBarViewPlugin extends Plugin {
///
final String? initialRowId;
- DatabaseTabBarViewPlugin({
- required ViewPB view,
- required PluginType pluginType,
- this.initialRowId,
- }) : _pluginType = pluginType,
- notifier = ViewPluginNotifier(view: view);
-
@override
PluginWidgetBuilder get widgetBuilder => DatabasePluginWidgetBuilder(
notifier: notifier,
@@ -198,18 +198,14 @@ class DatabaseTabBarViewPlugin extends Plugin {
}
class DatabasePluginWidgetBuilder extends PluginWidgetBuilder {
+ DatabasePluginWidgetBuilder({required this.notifier, this.initialRowId});
+
final ViewPluginNotifier notifier;
/// Used to open a Row on plugin load
///
final String? initialRowId;
- DatabasePluginWidgetBuilder({
- Key? key,
- required this.notifier,
- this.initialRowId,
- });
-
@override
Widget get leftBarItem => ViewTitleBar(view: notifier.view);
diff --git a/frontend/appflowy_flutter/lib/plugins/database/widgets/card/card.dart b/frontend/appflowy_flutter/lib/plugins/database/widgets/card/card.dart
index 9c920d86aa..b8666a681e 100644
--- a/frontend/appflowy_flutter/lib/plugins/database/widgets/card/card.dart
+++ b/frontend/appflowy_flutter/lib/plugins/database/widgets/card/card.dart
@@ -21,6 +21,22 @@ import 'container/card_container.dart';
/// Edit a database row with card style widget
class RowCard extends StatefulWidget {
+ const RowCard({
+ super.key,
+ required this.fieldController,
+ required this.rowMeta,
+ required this.viewId,
+ required this.isEditing,
+ required this.rowCache,
+ required this.cellBuilder,
+ required this.openCard,
+ required this.onStartEditing,
+ required this.onEndEditing,
+ required this.styleConfiguration,
+ this.groupingFieldId,
+ this.groupId,
+ });
+
final FieldController fieldController;
final RowMetaPB rowMeta;
final String viewId;
@@ -44,22 +60,6 @@ class RowCard extends StatefulWidget {
final RowCardStyleConfiguration styleConfiguration;
- const RowCard({
- super.key,
- required this.fieldController,
- required this.rowMeta,
- required this.viewId,
- required this.isEditing,
- required this.rowCache,
- required this.cellBuilder,
- required this.openCard,
- required this.onStartEditing,
- required this.onEndEditing,
- required this.styleConfiguration,
- this.groupingFieldId,
- this.groupId,
- });
-
@override
State<RowCard> createState() => _RowCardState();
}
@@ -250,11 +250,9 @@ class MoreCardOptionsAccessory extends StatelessWidget with CardAccessory {
}
class EditCardAccessory extends StatelessWidget with CardAccessory {
+ const EditCardAccessory({super.key, required this.rowNotifier});
+
final EditableRowNotifier rowNotifier;
- const EditCardAccessory({
- super.key,
- required this.rowNotifier,
- });
@override
Widget build(BuildContext context) {
@@ -275,15 +273,15 @@ class EditCardAccessory extends StatelessWidget with CardAccessory {
}
class RowCardStyleConfiguration {
- final CardCellStyleMap cellStyleMap;
- final bool showAccessory;
- final EdgeInsets cardPadding;
- final HoverStyle? hoverStyle;
-
const RowCardStyleConfiguration({
required this.cellStyleMap,
this.showAccessory = true,
this.cardPadding = const EdgeInsets.all(8),
this.hoverStyle,
});
+
+ final CardCellStyleMap cellStyleMap;
+ final bool showAccessory;
+ final EdgeInsets cardPadding;
+ final HoverStyle? hoverStyle;
}
diff --git a/frontend/appflowy_flutter/lib/plugins/database/widgets/card/card_bloc.dart b/frontend/appflowy_flutter/lib/plugins/database/widgets/card/card_bloc.dart
index 2ece69fdb8..51c4ec746d 100644
--- a/frontend/appflowy_flutter/lib/plugins/database/widgets/card/card_bloc.dart
+++ b/frontend/appflowy_flutter/lib/plugins/database/widgets/card/card_bloc.dart
@@ -1,27 +1,19 @@
import 'dart:async';
+import 'package:flutter/foundation.dart';
+
import 'package:appflowy/plugins/database/application/cell/cell_controller.dart';
import 'package:appflowy/plugins/database/application/field/field_controller.dart';
import 'package:appflowy/plugins/database/application/row/row_cache.dart';
import 'package:appflowy/plugins/database/application/row/row_listener.dart';
import 'package:appflowy/plugins/database/widgets/setting/field_visibility_extension.dart';
import 'package:appflowy_backend/protobuf/flowy-database2/row_entities.pb.dart';
-import 'package:flutter/foundation.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:freezed_annotation/freezed_annotation.dart';
part 'card_bloc.freezed.dart';
class CardBloc extends Bloc<CardEvent, CardState> {
- final FieldController fieldController;
- final String rowId;
- final String? groupFieldId;
- final RowCache _rowCache;
- final String viewId;
- final RowListener _rowListener;
-
- VoidCallback? _rowCallback;
-
CardBloc({
required this.fieldController,
required this.groupFieldId,
@@ -43,6 +35,19 @@ class CardBloc extends Bloc<CardEvent, CardState> {
isEditing,
),
) {
+ _dispatch();
+ }
+
+ final FieldController fieldController;
+ final String rowId;
+ final String? groupFieldId;
+ final RowCache _rowCache;
+ final String viewId;
+ final RowListener _rowListener;
+
+ VoidCallback? _rowCallback;
+
+ void _dispatch() {
on<CardEvent>(
(event, emit) async {
await event.when(
diff --git a/frontend/appflowy_flutter/lib/plugins/database/widgets/card/container/accessory.dart b/frontend/appflowy_flutter/lib/plugins/database/widgets/card/container/accessory.dart
index dd5025bd2c..129e17ca48 100644
--- a/frontend/appflowy_flutter/lib/plugins/database/widgets/card/container/accessory.dart
+++ b/frontend/appflowy_flutter/lib/plugins/database/widgets/card/container/accessory.dart
@@ -16,14 +16,15 @@ typedef CardAccessoryBuilder = List<CardAccessory> Function(
);
class CardAccessoryContainer extends StatelessWidget {
- final void Function(AccessoryType) onTapAccessory;
- final List<CardAccessory> accessories;
const CardAccessoryContainer({
+ super.key,
required this.accessories,
required this.onTapAccessory,
- super.key,
});
+ final List<CardAccessory> accessories;
+ final void Function(AccessoryType) onTapAccessory;
+
@override
Widget build(BuildContext context) {
final children = accessories.map<Widget>((accessory) {
@@ -77,13 +78,11 @@ class CardAccessoryContainer extends StatelessWidget {
color: Theme.of(context).brightness == Brightness.light
? const Color(0xFF1F2329).withOpacity(0.12)
: const Color(0xff59647a),
- width: 1.0,
),
),
boxShadow: [
BoxShadow(
blurRadius: 4,
- spreadRadius: 0,
color: const Color(0xFF1F2329).withOpacity(0.02),
),
BoxShadow(
diff --git a/frontend/appflowy_flutter/lib/plugins/database/widgets/card/container/card_container.dart b/frontend/appflowy_flutter/lib/plugins/database/widgets/card/container/card_container.dart
index af95357260..0cb0988bac 100644
--- a/frontend/appflowy_flutter/lib/plugins/database/widgets/card/container/card_container.dart
+++ b/frontend/appflowy_flutter/lib/plugins/database/widgets/card/container/card_container.dart
@@ -105,10 +105,10 @@ class _CardEnterRegion extends StatelessWidget {
}
class _CardContainerNotifier extends ChangeNotifier {
- bool _onEnter = false;
-
_CardContainerNotifier();
+ bool _onEnter = false;
+
set onEnter(bool value) {
if (_onEnter != value) {
_onEnter = value;
diff --git a/frontend/appflowy_flutter/lib/plugins/database/widgets/cell/card_cell_builder.dart b/frontend/appflowy_flutter/lib/plugins/database/widgets/cell/card_cell_builder.dart
index ecc6b7125a..9e4c4b3fd5 100644
--- a/frontend/appflowy_flutter/lib/plugins/database/widgets/cell/card_cell_builder.dart
+++ b/frontend/appflowy_flutter/lib/plugins/database/widgets/cell/card_cell_builder.dart
@@ -16,10 +16,10 @@ import 'card_cell_skeleton/url_card_cell.dart';
typedef CardCellStyleMap = Map<FieldType, CardCellStyle>;
class CardCellBuilder {
- final DatabaseController databaseController;
-
CardCellBuilder({required this.databaseController});
+ final DatabaseController databaseController;
+
Widget build({
required CellContext cellContext,
required CardCellStyleMap styleMap,
diff --git a/frontend/appflowy_flutter/lib/plugins/database/widgets/cell/card_cell_skeleton/card_cell.dart b/frontend/appflowy_flutter/lib/plugins/database/widgets/cell/card_cell_skeleton/card_cell.dart
index 0fb15ccbd5..4351e7dd2c 100644
--- a/frontend/appflowy_flutter/lib/plugins/database/widgets/cell/card_cell_skeleton/card_cell.dart
+++ b/frontend/appflowy_flutter/lib/plugins/database/widgets/cell/card_cell_skeleton/card_cell.dart
@@ -2,15 +2,15 @@ import 'package:appflowy/plugins/database/application/cell/cell_controller.dart'
import 'package:flutter/material.dart';
abstract class CardCell<T extends CardCellStyle> extends StatefulWidget {
- final T style;
-
const CardCell({super.key, required this.style});
+
+ final T style;
}
abstract class CardCellStyle {
- final EdgeInsetsGeometry padding;
-
const CardCellStyle({required this.padding});
+
+ final EdgeInsetsGeometry padding;
}
S? isStyleOrNull<S>(CardCellStyle? style) {
@@ -22,23 +22,23 @@ S? isStyleOrNull<S>(CardCellStyle? style) {
}
class EditableCardNotifier {
- final ValueNotifier<bool> isCellEditing;
-
EditableCardNotifier({bool isEditing = false})
: isCellEditing = ValueNotifier(isEditing);
+ final ValueNotifier<bool> isCellEditing;
+
void dispose() {
isCellEditing.dispose();
}
}
class EditableRowNotifier {
- final Map<CellContext, EditableCardNotifier> _cells = {};
- final ValueNotifier<bool> isEditing;
-
EditableRowNotifier({required bool isEditing})
: isEditing = ValueNotifier(isEditing);
+ final Map<CellContext, EditableCardNotifier> _cells = {};
+ final ValueNotifier<bool> isEditing;
+
void bindCell(
CellContext cellIdentifier,
EditableCardNotifier notifier,
diff --git a/frontend/appflowy_flutter/lib/plugins/database/widgets/cell/card_cell_skeleton/checkbox_card_cell.dart b/frontend/appflowy_flutter/lib/plugins/database/widgets/cell/card_cell_skeleton/checkbox_card_cell.dart
index f95840c83e..0237e92319 100644
--- a/frontend/appflowy_flutter/lib/plugins/database/widgets/cell/card_cell_skeleton/checkbox_card_cell.dart
+++ b/frontend/appflowy_flutter/lib/plugins/database/widgets/cell/card_cell_skeleton/checkbox_card_cell.dart
@@ -11,22 +11,19 @@ import 'package:flutter_bloc/flutter_bloc.dart';
import 'card_cell.dart';
class CheckboxCardCellStyle extends CardCellStyle {
- final Size iconSize;
- final bool showFieldName;
- final TextStyle? textStyle;
-
CheckboxCardCellStyle({
required super.padding,
required this.iconSize,
required this.showFieldName,
this.textStyle,
}) : assert(!showFieldName || showFieldName && textStyle != null);
+
+ final Size iconSize;
+ final bool showFieldName;
+ final TextStyle? textStyle;
}
class CheckboxCardCell extends CardCell<CheckboxCardCellStyle> {
- final DatabaseController databaseController;
- final CellContext cellContext;
-
const CheckboxCardCell({
super.key,
required super.style,
@@ -34,6 +31,9 @@ class CheckboxCardCell extends CardCell<CheckboxCardCellStyle> {
required this.cellContext,
});
+ final DatabaseController databaseController;
+ final CellContext cellContext;
+
@override
State<CheckboxCardCell> createState() => _CheckboxCellState();
}
@@ -58,7 +58,6 @@ class _CheckboxCellState extends State<CheckboxCardCell> {
child: Row(
children: [
FlowyIconButton(
- iconPadding: EdgeInsets.zero,
icon: FlowySvg(
state.isSelected
? FlowySvgs.check_filled_s
diff --git a/frontend/appflowy_flutter/lib/plugins/database/widgets/cell/card_cell_skeleton/checklist_card_cell.dart b/frontend/appflowy_flutter/lib/plugins/database/widgets/cell/card_cell_skeleton/checklist_card_cell.dart
index f78768ca01..d0e6c76b5c 100644
--- a/frontend/appflowy_flutter/lib/plugins/database/widgets/cell/card_cell_skeleton/checklist_card_cell.dart
+++ b/frontend/appflowy_flutter/lib/plugins/database/widgets/cell/card_cell_skeleton/checklist_card_cell.dart
@@ -9,18 +9,15 @@ import 'package:flutter_bloc/flutter_bloc.dart';
import 'card_cell.dart';
class ChecklistCardCellStyle extends CardCellStyle {
- final TextStyle textStyle;
-
ChecklistCardCellStyle({
required super.padding,
required this.textStyle,
});
+
+ final TextStyle textStyle;
}
class ChecklistCardCell extends CardCell<ChecklistCardCellStyle> {
- final DatabaseController databaseController;
- final CellContext cellContext;
-
const ChecklistCardCell({
super.key,
required super.style,
@@ -28,6 +25,9 @@ class ChecklistCardCell extends CardCell<ChecklistCardCellStyle> {
required this.cellContext,
});
+ final DatabaseController databaseController;
+ final CellContext cellContext;
+
@override
State<ChecklistCardCell> createState() => _ChecklistCellState();
}
diff --git a/frontend/appflowy_flutter/lib/plugins/database/widgets/cell/card_cell_skeleton/date_card_cell.dart b/frontend/appflowy_flutter/lib/plugins/database/widgets/cell/card_cell_skeleton/date_card_cell.dart
index 83824a77bf..bb1d866286 100644
--- a/frontend/appflowy_flutter/lib/plugins/database/widgets/cell/card_cell_skeleton/date_card_cell.dart
+++ b/frontend/appflowy_flutter/lib/plugins/database/widgets/cell/card_cell_skeleton/date_card_cell.dart
@@ -8,18 +8,15 @@ import 'package:flutter_bloc/flutter_bloc.dart';
import 'card_cell.dart';
class DateCardCellStyle extends CardCellStyle {
- final TextStyle textStyle;
-
DateCardCellStyle({
required super.padding,
required this.textStyle,
});
+
+ final TextStyle textStyle;
}
class DateCardCell extends CardCell<DateCardCellStyle> {
- final DatabaseController databaseController;
- final CellContext cellContext;
-
const DateCardCell({
super.key,
required super.style,
@@ -27,6 +24,9 @@ class DateCardCell extends CardCell<DateCardCellStyle> {
required this.cellContext,
});
+ final DatabaseController databaseController;
+ final CellContext cellContext;
+
@override
State<DateCardCell> createState() => _DateCellState();
}
diff --git a/frontend/appflowy_flutter/lib/plugins/database/widgets/cell/card_cell_skeleton/number_card_cell.dart b/frontend/appflowy_flutter/lib/plugins/database/widgets/cell/card_cell_skeleton/number_card_cell.dart
index c48922a694..8b6ec3cbe1 100644
--- a/frontend/appflowy_flutter/lib/plugins/database/widgets/cell/card_cell_skeleton/number_card_cell.dart
+++ b/frontend/appflowy_flutter/lib/plugins/database/widgets/cell/card_cell_skeleton/number_card_cell.dart
@@ -8,18 +8,15 @@ import 'package:flutter_bloc/flutter_bloc.dart';
import 'card_cell.dart';
class NumberCardCellStyle extends CardCellStyle {
- final TextStyle textStyle;
-
const NumberCardCellStyle({
required super.padding,
required this.textStyle,
});
+
+ final TextStyle textStyle;
}
class NumberCardCell extends CardCell<NumberCardCellStyle> {
- final DatabaseController databaseController;
- final CellContext cellContext;
-
const NumberCardCell({
super.key,
required super.style,
@@ -27,6 +24,9 @@ class NumberCardCell extends CardCell<NumberCardCellStyle> {
required this.cellContext,
});
+ final DatabaseController databaseController;
+ final CellContext cellContext;
+
@override
State<NumberCardCell> createState() => _NumberCellState();
}
diff --git a/frontend/appflowy_flutter/lib/plugins/database/widgets/cell/card_cell_skeleton/select_option_card_cell.dart b/frontend/appflowy_flutter/lib/plugins/database/widgets/cell/card_cell_skeleton/select_option_card_cell.dart
index 7f2ee32979..f32d9292c7 100644
--- a/frontend/appflowy_flutter/lib/plugins/database/widgets/cell/card_cell_skeleton/select_option_card_cell.dart
+++ b/frontend/appflowy_flutter/lib/plugins/database/widgets/cell/card_cell_skeleton/select_option_card_cell.dart
@@ -9,22 +9,19 @@ import 'package:flutter_bloc/flutter_bloc.dart';
import 'card_cell.dart';
class SelectOptionCardCellStyle extends CardCellStyle {
- final double tagFontSize;
- final bool wrap;
- final EdgeInsets tagPadding;
-
SelectOptionCardCellStyle({
required super.padding,
required this.tagFontSize,
required this.wrap,
required this.tagPadding,
});
+
+ final double tagFontSize;
+ final bool wrap;
+ final EdgeInsets tagPadding;
}
class SelectOptionCardCell extends CardCell<SelectOptionCardCellStyle> {
- final DatabaseController databaseController;
- final CellContext cellContext;
-
const SelectOptionCardCell({
super.key,
required super.style,
@@ -32,6 +29,9 @@ class SelectOptionCardCell extends CardCell<SelectOptionCardCellStyle> {
required this.cellContext,
});
+ final DatabaseController databaseController;
+ final CellContext cellContext;
+
@override
State<SelectOptionCardCell> createState() => _SelectOptionCellState();
}
diff --git a/frontend/appflowy_flutter/lib/plugins/database/widgets/cell/card_cell_skeleton/text_card_cell.dart b/frontend/appflowy_flutter/lib/plugins/database/widgets/cell/card_cell_skeleton/text_card_cell.dart
index 84a3382cb2..a8afea2322 100644
--- a/frontend/appflowy_flutter/lib/plugins/database/widgets/cell/card_cell_skeleton/text_card_cell.dart
+++ b/frontend/appflowy_flutter/lib/plugins/database/widgets/cell/card_cell_skeleton/text_card_cell.dart
@@ -13,33 +13,32 @@ import '../editable_cell_builder.dart';
import 'card_cell.dart';
class TextCardCellStyle extends CardCellStyle {
- final TextStyle textStyle;
- final TextStyle titleTextStyle;
- final int? maxLines;
-
TextCardCellStyle({
required super.padding,
required this.textStyle,
required this.titleTextStyle,
this.maxLines = 1,
});
+
+ final TextStyle textStyle;
+ final TextStyle titleTextStyle;
+ final int? maxLines;
}
class TextCardCell extends CardCell<TextCardCellStyle> with EditableCell {
- final DatabaseController databaseController;
- final CellContext cellContext;
-
- final bool showNotes;
-
const TextCardCell({
super.key,
required super.style,
required this.databaseController,
required this.cellContext,
- this.editableNotifier,
this.showNotes = false,
+ this.editableNotifier,
});
+ final DatabaseController databaseController;
+ final CellContext cellContext;
+ final bool showNotes;
+
@override
final EditableCardNotifier? editableNotifier;
@@ -134,7 +133,6 @@ class _TextCellState extends State<TextCardCell> {
: _buildText(state, isTitle);
return Row(
- crossAxisAlignment: CrossAxisAlignment.center,
children: [
if (isTitle && widget.showNotes)
FlowyTooltip(
diff --git a/frontend/appflowy_flutter/lib/plugins/database/widgets/cell/card_cell_skeleton/timestamp_card_cell.dart b/frontend/appflowy_flutter/lib/plugins/database/widgets/cell/card_cell_skeleton/timestamp_card_cell.dart
index 605eb7e671..bb2fa24186 100644
--- a/frontend/appflowy_flutter/lib/plugins/database/widgets/cell/card_cell_skeleton/timestamp_card_cell.dart
+++ b/frontend/appflowy_flutter/lib/plugins/database/widgets/cell/card_cell_skeleton/timestamp_card_cell.dart
@@ -8,18 +8,15 @@ import 'package:flutter_bloc/flutter_bloc.dart';
import 'card_cell.dart';
class TimestampCardCellStyle extends CardCellStyle {
- final TextStyle textStyle;
-
TimestampCardCellStyle({
required super.padding,
required this.textStyle,
});
+
+ final TextStyle textStyle;
}
class TimestampCardCell extends CardCell<TimestampCardCellStyle> {
- final DatabaseController databaseController;
- final CellContext cellContext;
-
const TimestampCardCell({
super.key,
required super.style,
@@ -27,6 +24,9 @@ class TimestampCardCell extends CardCell<TimestampCardCellStyle> {
required this.cellContext,
});
+ final DatabaseController databaseController;
+ final CellContext cellContext;
+
@override
State<TimestampCardCell> createState() => _TimestampCellState();
}
diff --git a/frontend/appflowy_flutter/lib/plugins/database/widgets/cell/card_cell_skeleton/url_card_cell.dart b/frontend/appflowy_flutter/lib/plugins/database/widgets/cell/card_cell_skeleton/url_card_cell.dart
index 8e503edebb..1459fe826f 100644
--- a/frontend/appflowy_flutter/lib/plugins/database/widgets/cell/card_cell_skeleton/url_card_cell.dart
+++ b/frontend/appflowy_flutter/lib/plugins/database/widgets/cell/card_cell_skeleton/url_card_cell.dart
@@ -8,18 +8,15 @@ import 'package:flutter_bloc/flutter_bloc.dart';
import 'card_cell.dart';
class URLCardCellStyle extends CardCellStyle {
- final TextStyle textStyle;
-
URLCardCellStyle({
required super.padding,
required this.textStyle,
});
+
+ final TextStyle textStyle;
}
class URLCardCell extends CardCell<URLCardCellStyle> {
- final DatabaseController databaseController;
- final CellContext cellContext;
-
const URLCardCell({
super.key,
required super.style,
@@ -27,6 +24,9 @@ class URLCardCell extends CardCell<URLCardCellStyle> {
required this.cellContext,
});
+ final DatabaseController databaseController;
+ final CellContext cellContext;
+
@override
State<URLCardCell> createState() => _URLCellState();
}
diff --git a/frontend/appflowy_flutter/lib/plugins/database/widgets/cell/desktop_grid/desktop_grid_url_cell.dart b/frontend/appflowy_flutter/lib/plugins/database/widgets/cell/desktop_grid/desktop_grid_url_cell.dart
index 6b612dfa23..8c765af976 100644
--- a/frontend/appflowy_flutter/lib/plugins/database/widgets/cell/desktop_grid/desktop_grid_url_cell.dart
+++ b/frontend/appflowy_flutter/lib/plugins/database/widgets/cell/desktop_grid/desktop_grid_url_cell.dart
@@ -32,7 +32,6 @@ class DesktopGridURLSkin extends IEditableURLCellSkin {
color: Theme.of(context).colorScheme.primary,
decoration: TextDecoration.underline,
),
- autofocus: false,
decoration: InputDecoration(
contentPadding: GridSize.cellContentInsets,
border: InputBorder.none,
diff --git a/frontend/appflowy_flutter/lib/plugins/database/widgets/cell/desktop_row_detail/desktop_row_detail_url_cell.dart b/frontend/appflowy_flutter/lib/plugins/database/widgets/cell/desktop_row_detail/desktop_row_detail_url_cell.dart
index 75273ecb9e..b61827ab61 100644
--- a/frontend/appflowy_flutter/lib/plugins/database/widgets/cell/desktop_row_detail/desktop_row_detail_url_cell.dart
+++ b/frontend/appflowy_flutter/lib/plugins/database/widgets/cell/desktop_row_detail/desktop_row_detail_url_cell.dart
@@ -25,7 +25,6 @@ class DesktopRowDetailURLSkin extends IEditableURLCellSkin {
color: Theme.of(context).colorScheme.primary,
decoration: TextDecoration.underline,
),
- autofocus: false,
decoration: InputDecoration(
contentPadding: const EdgeInsets.symmetric(horizontal: 8, vertical: 9),
border: InputBorder.none,
diff --git a/frontend/appflowy_flutter/lib/plugins/database/widgets/cell/editable_cell_builder.dart b/frontend/appflowy_flutter/lib/plugins/database/widgets/cell/editable_cell_builder.dart
index af6114de61..a5e190400e 100755
--- a/frontend/appflowy_flutter/lib/plugins/database/widgets/cell/editable_cell_builder.dart
+++ b/frontend/appflowy_flutter/lib/plugins/database/widgets/cell/editable_cell_builder.dart
@@ -26,11 +26,9 @@ enum EditableCellStyle {
/// Build an editable cell widget
class EditableCellBuilder {
- final DatabaseController databaseController;
+ EditableCellBuilder({required this.databaseController});
- EditableCellBuilder({
- required this.databaseController,
- });
+ final DatabaseController databaseController;
EditableCellWidget buildStyled(
CellContext cellContext,
diff --git a/frontend/appflowy_flutter/lib/plugins/database/widgets/cell/editable_cell_skeleton/checkbox.dart b/frontend/appflowy_flutter/lib/plugins/database/widgets/cell/editable_cell_skeleton/checkbox.dart
index 64d231e9e0..bab2de93e0 100644
--- a/frontend/appflowy_flutter/lib/plugins/database/widgets/cell/editable_cell_skeleton/checkbox.dart
+++ b/frontend/appflowy_flutter/lib/plugins/database/widgets/cell/editable_cell_skeleton/checkbox.dart
@@ -15,13 +15,6 @@ import '../mobile_row_detail/mobile_row_detail_checkbox_cell.dart';
abstract class IEditableCheckboxCellSkin {
const IEditableCheckboxCellSkin();
- Widget build(
- BuildContext context,
- CellContainerNotifier cellContainerNotifier,
- CheckboxCellBloc bloc,
- CheckboxCellState state,
- );
-
factory IEditableCheckboxCellSkin.fromStyle(EditableCellStyle style) {
return switch (style) {
EditableCellStyle.desktopGrid => DesktopGridCheckboxCellSkin(),
@@ -30,13 +23,16 @@ abstract class IEditableCheckboxCellSkin {
EditableCellStyle.mobileRowDetail => MobileRowDetailCheckboxCellSkin(),
};
}
+
+ Widget build(
+ BuildContext context,
+ CellContainerNotifier cellContainerNotifier,
+ CheckboxCellBloc bloc,
+ CheckboxCellState state,
+ );
}
class EditableCheckboxCell extends EditableCellWidget {
- final DatabaseController databaseController;
- final CellContext cellContext;
- final IEditableCheckboxCellSkin skin;
-
EditableCheckboxCell({
super.key,
required this.databaseController,
@@ -44,6 +40,10 @@ class EditableCheckboxCell extends EditableCellWidget {
required this.skin,
});
+ final DatabaseController databaseController;
+ final CellContext cellContext;
+ final IEditableCheckboxCellSkin skin;
+
@override
GridCellState<EditableCheckboxCell> createState() => _CheckboxCellState();
}
diff --git a/frontend/appflowy_flutter/lib/plugins/database/widgets/cell/editable_cell_skeleton/checklist.dart b/frontend/appflowy_flutter/lib/plugins/database/widgets/cell/editable_cell_skeleton/checklist.dart
index 35c172a14c..22d2330ab1 100644
--- a/frontend/appflowy_flutter/lib/plugins/database/widgets/cell/editable_cell_skeleton/checklist.dart
+++ b/frontend/appflowy_flutter/lib/plugins/database/widgets/cell/editable_cell_skeleton/checklist.dart
@@ -16,14 +16,6 @@ import '../mobile_row_detail/mobile_row_detail_checklist_cell.dart';
abstract class IEditableChecklistCellSkin {
const IEditableChecklistCellSkin();
- Widget build(
- BuildContext context,
- CellContainerNotifier cellContainerNotifier,
- ChecklistCellBloc bloc,
- ChecklistCellState state,
- PopoverController popoverController,
- );
-
factory IEditableChecklistCellSkin.fromStyle(EditableCellStyle style) {
return switch (style) {
EditableCellStyle.desktopGrid => DesktopGridChecklistCellSkin(),
@@ -32,13 +24,17 @@ abstract class IEditableChecklistCellSkin {
EditableCellStyle.mobileRowDetail => MobileRowDetailChecklistCellSkin(),
};
}
+
+ Widget build(
+ BuildContext context,
+ CellContainerNotifier cellContainerNotifier,
+ ChecklistCellBloc bloc,
+ ChecklistCellState state,
+ PopoverController popoverController,
+ );
}
class EditableChecklistCell extends EditableCellWidget {
- final DatabaseController databaseController;
- final CellContext cellContext;
- final IEditableChecklistCellSkin skin;
-
EditableChecklistCell({
super.key,
required this.databaseController,
@@ -46,6 +42,10 @@ class EditableChecklistCell extends EditableCellWidget {
required this.skin,
});
+ final DatabaseController databaseController;
+ final CellContext cellContext;
+ final IEditableChecklistCellSkin skin;
+
@override
GridCellState<EditableChecklistCell> createState() =>
GridChecklistCellState();
diff --git a/frontend/appflowy_flutter/lib/plugins/database/widgets/cell/editable_cell_skeleton/date.dart b/frontend/appflowy_flutter/lib/plugins/database/widgets/cell/editable_cell_skeleton/date.dart
index 5913eaa53d..dbcbaf9d90 100644
--- a/frontend/appflowy_flutter/lib/plugins/database/widgets/cell/editable_cell_skeleton/date.dart
+++ b/frontend/appflowy_flutter/lib/plugins/database/widgets/cell/editable_cell_skeleton/date.dart
@@ -16,14 +16,6 @@ import '../mobile_row_detail/mobile_row_detail_date_cell.dart';
abstract class IEditableDateCellSkin {
const IEditableDateCellSkin();
- Widget build(
- BuildContext context,
- CellContainerNotifier cellContainerNotifier,
- DateCellBloc bloc,
- DateCellState state,
- PopoverController popoverController,
- );
-
factory IEditableDateCellSkin.fromStyle(EditableCellStyle style) {
return switch (style) {
EditableCellStyle.desktopGrid => DesktopGridDateCellSkin(),
@@ -32,13 +24,17 @@ abstract class IEditableDateCellSkin {
EditableCellStyle.mobileRowDetail => MobileRowDetailDateCellSkin(),
};
}
+
+ Widget build(
+ BuildContext context,
+ CellContainerNotifier cellContainerNotifier,
+ DateCellBloc bloc,
+ DateCellState state,
+ PopoverController popoverController,
+ );
}
class EditableDateCell extends EditableCellWidget {
- final DatabaseController databaseController;
- final CellContext cellContext;
- final IEditableDateCellSkin skin;
-
EditableDateCell({
super.key,
required this.databaseController,
@@ -46,6 +42,10 @@ class EditableDateCell extends EditableCellWidget {
required this.skin,
});
+ final DatabaseController databaseController;
+ final CellContext cellContext;
+ final IEditableDateCellSkin skin;
+
@override
GridCellState<EditableDateCell> createState() => _DateCellState();
}
diff --git a/frontend/appflowy_flutter/lib/plugins/database/widgets/cell/editable_cell_skeleton/number.dart b/frontend/appflowy_flutter/lib/plugins/database/widgets/cell/editable_cell_skeleton/number.dart
index 9bff95c289..8c1da5bb79 100644
--- a/frontend/appflowy_flutter/lib/plugins/database/widgets/cell/editable_cell_skeleton/number.dart
+++ b/frontend/appflowy_flutter/lib/plugins/database/widgets/cell/editable_cell_skeleton/number.dart
@@ -17,14 +17,6 @@ import '../mobile_row_detail/mobile_row_detail_number_cell.dart';
abstract class IEditableNumberCellSkin {
const IEditableNumberCellSkin();
- Widget build(
- BuildContext context,
- CellContainerNotifier cellContainerNotifier,
- NumberCellBloc bloc,
- FocusNode focusNode,
- TextEditingController textEditingController,
- );
-
factory IEditableNumberCellSkin.fromStyle(EditableCellStyle style) {
return switch (style) {
EditableCellStyle.desktopGrid => DesktopGridNumberCellSkin(),
@@ -33,13 +25,17 @@ abstract class IEditableNumberCellSkin {
EditableCellStyle.mobileRowDetail => MobileRowDetailNumberCellSkin(),
};
}
+
+ Widget build(
+ BuildContext context,
+ CellContainerNotifier cellContainerNotifier,
+ NumberCellBloc bloc,
+ FocusNode focusNode,
+ TextEditingController textEditingController,
+ );
}
class EditableNumberCell extends EditableCellWidget {
- final DatabaseController databaseController;
- final CellContext cellContext;
- final IEditableNumberCellSkin skin;
-
EditableNumberCell({
super.key,
required this.databaseController,
@@ -47,6 +43,10 @@ class EditableNumberCell extends EditableCellWidget {
required this.skin,
});
+ final DatabaseController databaseController;
+ final CellContext cellContext;
+ final IEditableNumberCellSkin skin;
+
@override
GridEditableTextCell<EditableNumberCell> createState() => _NumberCellState();
}
diff --git a/frontend/appflowy_flutter/lib/plugins/database/widgets/cell/editable_cell_skeleton/select_option.dart b/frontend/appflowy_flutter/lib/plugins/database/widgets/cell/editable_cell_skeleton/select_option.dart
index 3d8fabe19a..71a5b124d8 100644
--- a/frontend/appflowy_flutter/lib/plugins/database/widgets/cell/editable_cell_skeleton/select_option.dart
+++ b/frontend/appflowy_flutter/lib/plugins/database/widgets/cell/editable_cell_skeleton/select_option.dart
@@ -17,14 +17,6 @@ import '../mobile_row_detail/mobile_row_detail_select_cell_option.dart';
abstract class IEditableSelectOptionCellSkin {
const IEditableSelectOptionCellSkin();
- Widget build(
- BuildContext context,
- CellContainerNotifier cellContainerNotifier,
- SelectOptionCellBloc bloc,
- SelectOptionCellState state,
- PopoverController popoverController,
- );
-
factory IEditableSelectOptionCellSkin.fromStyle(EditableCellStyle style) {
return switch (style) {
EditableCellStyle.desktopGrid => DesktopGridSelectOptionCellSkin(),
@@ -35,15 +27,17 @@ abstract class IEditableSelectOptionCellSkin {
MobileRowDetailSelectOptionCellSkin(),
};
}
+
+ Widget build(
+ BuildContext context,
+ CellContainerNotifier cellContainerNotifier,
+ SelectOptionCellBloc bloc,
+ SelectOptionCellState state,
+ PopoverController popoverController,
+ );
}
class EditableSelectOptionCell extends EditableCellWidget {
- final DatabaseController databaseController;
- final CellContext cellContext;
- final IEditableSelectOptionCellSkin skin;
-
- final FieldType fieldType;
-
EditableSelectOptionCell({
super.key,
required this.databaseController,
@@ -52,6 +46,12 @@ class EditableSelectOptionCell extends EditableCellWidget {
required this.fieldType,
});
+ final DatabaseController databaseController;
+ final CellContext cellContext;
+ final IEditableSelectOptionCellSkin skin;
+
+ final FieldType fieldType;
+
@override
GridCellState<EditableSelectOptionCell> createState() =>
_SelectOptionCellState();
diff --git a/frontend/appflowy_flutter/lib/plugins/database/widgets/cell/editable_cell_skeleton/text.dart b/frontend/appflowy_flutter/lib/plugins/database/widgets/cell/editable_cell_skeleton/text.dart
index 98b33cc0ae..3468143e45 100644
--- a/frontend/appflowy_flutter/lib/plugins/database/widgets/cell/editable_cell_skeleton/text.dart
+++ b/frontend/appflowy_flutter/lib/plugins/database/widgets/cell/editable_cell_skeleton/text.dart
@@ -15,14 +15,6 @@ import '../mobile_row_detail/mobile_row_detail_text_cell.dart';
abstract class IEditableTextCellSkin {
const IEditableTextCellSkin();
- Widget build(
- BuildContext context,
- CellContainerNotifier cellContainerNotifier,
- TextCellBloc bloc,
- FocusNode focusNode,
- TextEditingController textEditingController,
- );
-
factory IEditableTextCellSkin.fromStyle(EditableCellStyle style) {
return switch (style) {
EditableCellStyle.desktopGrid => DesktopGridTextCellSkin(),
@@ -31,13 +23,17 @@ abstract class IEditableTextCellSkin {
EditableCellStyle.mobileRowDetail => MobileRowDetailTextCellSkin(),
};
}
+
+ Widget build(
+ BuildContext context,
+ CellContainerNotifier cellContainerNotifier,
+ TextCellBloc bloc,
+ FocusNode focusNode,
+ TextEditingController textEditingController,
+ );
}
class EditableTextCell extends EditableCellWidget {
- final DatabaseController databaseController;
- final CellContext cellContext;
- final IEditableTextCellSkin skin;
-
EditableTextCell({
super.key,
required this.databaseController,
@@ -45,6 +41,10 @@ class EditableTextCell extends EditableCellWidget {
required this.skin,
});
+ final DatabaseController databaseController;
+ final CellContext cellContext;
+ final IEditableTextCellSkin skin;
+
@override
GridEditableTextCell<EditableTextCell> createState() => _TextCellState();
}
diff --git a/frontend/appflowy_flutter/lib/plugins/database/widgets/cell/editable_cell_skeleton/timestamp.dart b/frontend/appflowy_flutter/lib/plugins/database/widgets/cell/editable_cell_skeleton/timestamp.dart
index 6f3fa620cc..2bbc67eb1b 100644
--- a/frontend/appflowy_flutter/lib/plugins/database/widgets/cell/editable_cell_skeleton/timestamp.dart
+++ b/frontend/appflowy_flutter/lib/plugins/database/widgets/cell/editable_cell_skeleton/timestamp.dart
@@ -16,13 +16,6 @@ import '../mobile_row_detail/mobile_row_detail_timestamp_cell.dart';
abstract class IEditableTimestampCellSkin {
const IEditableTimestampCellSkin();
- Widget build(
- BuildContext context,
- CellContainerNotifier cellContainerNotifier,
- TimestampCellBloc bloc,
- TimestampCellState state,
- );
-
factory IEditableTimestampCellSkin.fromStyle(EditableCellStyle style) {
return switch (style) {
EditableCellStyle.desktopGrid => DesktopGridTimestampCellSkin(),
@@ -31,15 +24,16 @@ abstract class IEditableTimestampCellSkin {
EditableCellStyle.mobileRowDetail => MobileRowDetailTimestampCellSkin(),
};
}
+
+ Widget build(
+ BuildContext context,
+ CellContainerNotifier cellContainerNotifier,
+ TimestampCellBloc bloc,
+ TimestampCellState state,
+ );
}
class EditableTimestampCell extends EditableCellWidget {
- final DatabaseController databaseController;
- final CellContext cellContext;
- final IEditableTimestampCellSkin skin;
-
- final FieldType fieldType;
-
EditableTimestampCell({
super.key,
required this.databaseController,
@@ -48,6 +42,11 @@ class EditableTimestampCell extends EditableCellWidget {
required this.fieldType,
});
+ final DatabaseController databaseController;
+ final CellContext cellContext;
+ final IEditableTimestampCellSkin skin;
+ final FieldType fieldType;
+
@override
GridCellState<EditableTimestampCell> createState() => _TimestampCellState();
}
diff --git a/frontend/appflowy_flutter/lib/plugins/database/widgets/cell/editable_cell_skeleton/url.dart b/frontend/appflowy_flutter/lib/plugins/database/widgets/cell/editable_cell_skeleton/url.dart
index a35285d9e4..9f40029c6e 100644
--- a/frontend/appflowy_flutter/lib/plugins/database/widgets/cell/editable_cell_skeleton/url.dart
+++ b/frontend/appflowy_flutter/lib/plugins/database/widgets/cell/editable_cell_skeleton/url.dart
@@ -18,6 +18,15 @@ import '../mobile_row_detail/mobile_row_detail_url_cell.dart';
abstract class IEditableURLCellSkin {
const IEditableURLCellSkin();
+ factory IEditableURLCellSkin.fromStyle(EditableCellStyle style) {
+ return switch (style) {
+ EditableCellStyle.desktopGrid => DesktopGridURLSkin(),
+ EditableCellStyle.desktopRowDetail => DesktopRowDetailURLSkin(),
+ EditableCellStyle.mobileGrid => MobileGridURLCellSkin(),
+ EditableCellStyle.mobileRowDetail => MobileRowDetailURLCellSkin(),
+ };
+ }
+
Widget build(
BuildContext context,
CellContainerNotifier cellContainerNotifier,
@@ -31,25 +40,11 @@ abstract class IEditableURLCellSkin {
GridCellAccessoryBuildContext context,
URLCellDataNotifier cellDataNotifier,
);
-
- factory IEditableURLCellSkin.fromStyle(EditableCellStyle style) {
- return switch (style) {
- EditableCellStyle.desktopGrid => DesktopGridURLSkin(),
- EditableCellStyle.desktopRowDetail => DesktopRowDetailURLSkin(),
- EditableCellStyle.mobileGrid => MobileGridURLCellSkin(),
- EditableCellStyle.mobileRowDetail => MobileRowDetailURLCellSkin(),
- };
- }
}
typedef URLCellDataNotifier = CellDataNotifier<String>;
class EditableURLCell extends EditableCellWidget {
- final DatabaseController databaseController;
- final CellContext cellContext;
- final IEditableURLCellSkin skin;
- final URLCellDataNotifier _cellDataNotifier;
-
EditableURLCell({
super.key,
required this.databaseController,
@@ -57,6 +52,11 @@ class EditableURLCell extends EditableCellWidget {
required this.skin,
}) : _cellDataNotifier = CellDataNotifier(value: '');
+ final DatabaseController databaseController;
+ final CellContext cellContext;
+ final IEditableURLCellSkin skin;
+ final URLCellDataNotifier _cellDataNotifier;
+
@override
List<GridCellAccessoryBuilder> Function(
GridCellAccessoryBuildContext buildContext,
diff --git a/frontend/appflowy_flutter/lib/plugins/database/widgets/cell/mobile_grid/mobile_grid_number_cell.dart b/frontend/appflowy_flutter/lib/plugins/database/widgets/cell/mobile_grid/mobile_grid_number_cell.dart
index 6b45672e73..b76de5b797 100644
--- a/frontend/appflowy_flutter/lib/plugins/database/widgets/cell/mobile_grid/mobile_grid_number_cell.dart
+++ b/frontend/appflowy_flutter/lib/plugins/database/widgets/cell/mobile_grid/mobile_grid_number_cell.dart
@@ -17,7 +17,6 @@ class MobileGridNumberCellSkin extends IEditableNumberCellSkin {
controller: textEditingController,
focusNode: focusNode,
style: Theme.of(context).textTheme.bodyMedium?.copyWith(fontSize: 15),
- maxLines: 1,
decoration: const InputDecoration(
enabledBorder: InputBorder.none,
focusedBorder: InputBorder.none,
diff --git a/frontend/appflowy_flutter/lib/plugins/database/widgets/cell/mobile_grid/mobile_grid_text_cell.dart b/frontend/appflowy_flutter/lib/plugins/database/widgets/cell/mobile_grid/mobile_grid_text_cell.dart
index 9f191822db..3fda94b3e2 100644
--- a/frontend/appflowy_flutter/lib/plugins/database/widgets/cell/mobile_grid/mobile_grid_text_cell.dart
+++ b/frontend/appflowy_flutter/lib/plugins/database/widgets/cell/mobile_grid/mobile_grid_text_cell.dart
@@ -33,7 +33,6 @@ class MobileGridTextCellSkin extends IEditableTextCellSkin {
focusNode: focusNode,
style:
Theme.of(context).textTheme.bodyMedium?.copyWith(fontSize: 15),
- maxLines: 1,
decoration: const InputDecoration(
enabledBorder: InputBorder.none,
focusedBorder: InputBorder.none,
diff --git a/frontend/appflowy_flutter/lib/plugins/database/widgets/cell/mobile_grid/mobile_grid_timestamp_cell.dart b/frontend/appflowy_flutter/lib/plugins/database/widgets/cell/mobile_grid/mobile_grid_timestamp_cell.dart
index 95568c3b37..92484697a5 100644
--- a/frontend/appflowy_flutter/lib/plugins/database/widgets/cell/mobile_grid/mobile_grid_timestamp_cell.dart
+++ b/frontend/appflowy_flutter/lib/plugins/database/widgets/cell/mobile_grid/mobile_grid_timestamp_cell.dart
@@ -20,7 +20,6 @@ class MobileGridTimestampCellSkin extends IEditableTimestampCellSkin {
child: FlowyText(
state.dateStr,
fontSize: 15,
- maxLines: 1,
),
),
);
diff --git a/frontend/appflowy_flutter/lib/plugins/database/widgets/cell/mobile_grid/mobile_grid_url_cell.dart b/frontend/appflowy_flutter/lib/plugins/database/widgets/cell/mobile_grid/mobile_grid_url_cell.dart
index 94471b6596..0ddbcaac21 100644
--- a/frontend/appflowy_flutter/lib/plugins/database/widgets/cell/mobile_grid/mobile_grid_url_cell.dart
+++ b/frontend/appflowy_flutter/lib/plugins/database/widgets/cell/mobile_grid/mobile_grid_url_cell.dart
@@ -28,7 +28,6 @@ class MobileGridURLCellSkin extends IEditableURLCellSkin {
return TextField(
focusNode: focusNode,
keyboardType: TextInputType.url,
- maxLines: 1,
decoration: const InputDecoration(
enabledBorder: InputBorder.none,
focusedBorder: InputBorder.none,
diff --git a/frontend/appflowy_flutter/lib/plugins/database/widgets/database_view_widget.dart b/frontend/appflowy_flutter/lib/plugins/database/widgets/database_view_widget.dart
index 46e866308b..f3a023b3da 100644
--- a/frontend/appflowy_flutter/lib/plugins/database/widgets/database_view_widget.dart
+++ b/frontend/appflowy_flutter/lib/plugins/database/widgets/database_view_widget.dart
@@ -4,15 +4,15 @@ import 'package:appflowy_backend/protobuf/flowy-folder/view.pb.dart';
import 'package:flutter/material.dart';
class DatabaseViewWidget extends StatefulWidget {
- final ViewPB view;
- final bool shrinkWrap;
-
const DatabaseViewWidget({
super.key,
required this.view,
this.shrinkWrap = true,
});
+ final ViewPB view;
+ final bool shrinkWrap;
+
@override
State<DatabaseViewWidget> createState() => _DatabaseViewWidgetState();
}
diff --git a/frontend/appflowy_flutter/lib/plugins/database/widgets/group/database_group.dart b/frontend/appflowy_flutter/lib/plugins/database/widgets/group/database_group.dart
index 9fb2da7b00..593bc9bc71 100644
--- a/frontend/appflowy_flutter/lib/plugins/database/widgets/group/database_group.dart
+++ b/frontend/appflowy_flutter/lib/plugins/database/widgets/group/database_group.dart
@@ -124,14 +124,15 @@ class DatabaseGroupList extends StatelessWidget {
}
class _GridGroupCell extends StatelessWidget {
- final VoidCallback onSelected;
- final FieldInfo fieldInfo;
const _GridGroupCell({
+ super.key,
required this.fieldInfo,
required this.onSelected,
- super.key,
});
+ final FieldInfo fieldInfo;
+ final VoidCallback onSelected;
+
@override
Widget build(BuildContext context) {
Widget? rightIcon;
diff --git a/frontend/appflowy_flutter/lib/plugins/database/widgets/row/accessory/cell_accessory.dart b/frontend/appflowy_flutter/lib/plugins/database/widgets/row/accessory/cell_accessory.dart
index 17888f8f05..74a3eb8ba9 100644
--- a/frontend/appflowy_flutter/lib/plugins/database/widgets/row/accessory/cell_accessory.dart
+++ b/frontend/appflowy_flutter/lib/plugins/database/widgets/row/accessory/cell_accessory.dart
@@ -13,23 +13,23 @@ import 'package:styled_widget/styled_widget.dart';
import '../../cell/editable_cell_builder.dart';
class GridCellAccessoryBuildContext {
- final BuildContext anchorContext;
- final bool isCellEditing;
-
GridCellAccessoryBuildContext({
required this.anchorContext,
required this.isCellEditing,
});
+
+ final BuildContext anchorContext;
+ final bool isCellEditing;
}
class GridCellAccessoryBuilder<T extends State<StatefulWidget>> {
+ GridCellAccessoryBuilder({required Widget Function(Key key) builder})
+ : _builder = builder;
+
final GlobalKey<T> _key = GlobalKey();
final Widget Function(Key key) _builder;
- GridCellAccessoryBuilder({required Widget Function(Key key) builder})
- : _builder = builder;
-
Widget build() => _builder(_key);
void onTap() {
@@ -93,14 +93,15 @@ class _PrimaryCellAccessoryState extends State<PrimaryCellAccessory>
}
class AccessoryHover extends StatefulWidget {
- final CellAccessory child;
- final FieldType fieldType;
const AccessoryHover({
super.key,
required this.child,
required this.fieldType,
});
+ final CellAccessory child;
+ final FieldType fieldType;
+
@override
State<AccessoryHover> createState() => _AccessoryHoverState();
}
@@ -125,10 +126,10 @@ class _AccessoryHoverState extends State<AccessoryHover> {
final accessoryBuilder = widget.child.accessoryBuilder;
if (accessoryBuilder != null && _isHover) {
final accessories = accessoryBuilder(
- (GridCellAccessoryBuildContext(
+ GridCellAccessoryBuildContext(
anchorContext: context,
isCellEditing: false,
- )),
+ ),
);
children.add(
Padding(
@@ -144,7 +145,6 @@ class _AccessoryHoverState extends State<AccessoryHover> {
onEnter: (p) => setState(() => _isHover = true),
onExit: (p) => setState(() => _isHover = false),
child: Stack(
- fit: StackFit.loose,
alignment: AlignmentDirectional.center,
children: children,
),
@@ -153,9 +153,10 @@ class _AccessoryHoverState extends State<AccessoryHover> {
}
class CellAccessoryContainer extends StatelessWidget {
- final List<GridCellAccessoryBuilder> accessories;
const CellAccessoryContainer({required this.accessories, super.key});
+ final List<GridCellAccessoryBuilder> accessories;
+
@override
Widget build(BuildContext context) {
final children =
diff --git a/frontend/appflowy_flutter/lib/plugins/database/widgets/row/accessory/cell_shortcuts.dart b/frontend/appflowy_flutter/lib/plugins/database/widgets/row/accessory/cell_shortcuts.dart
index 27ade02c9a..582e5fccd0 100644
--- a/frontend/appflowy_flutter/lib/plugins/database/widgets/row/accessory/cell_shortcuts.dart
+++ b/frontend/appflowy_flutter/lib/plugins/database/widgets/row/accessory/cell_shortcuts.dart
@@ -18,9 +18,10 @@ abstract class CellShortcuts extends Widget {
}
class GridCellShortcuts extends StatelessWidget {
- final CellShortcuts child;
const GridCellShortcuts({required this.child, super.key});
+ final CellShortcuts child;
+
@override
Widget build(BuildContext context) {
return Shortcuts(
@@ -60,9 +61,10 @@ class GridCellEnterIdent extends Intent {
}
class GridCellEnterAction extends Action<GridCellEnterIdent> {
- final CellShortcuts child;
GridCellEnterAction({required this.child});
+ final CellShortcuts child;
+
@override
void invoke(covariant GridCellEnterIdent intent) {
final callback = child.shortcutHandlers[CellKeyboardKey.onEnter];
@@ -77,9 +79,10 @@ class GridCellCopyIntent extends Intent {
}
class GridCellCopyAction extends Action<GridCellCopyIntent> {
- final CellShortcuts child;
GridCellCopyAction({required this.child});
+ final CellShortcuts child;
+
@override
void invoke(covariant GridCellCopyIntent intent) {
final callback = child.shortcutHandlers[CellKeyboardKey.onCopy];
@@ -99,9 +102,10 @@ class GridCellPasteIntent extends Intent {
}
class GridCellPasteAction extends Action<GridCellPasteIntent> {
- final CellShortcuts child;
GridCellPasteAction({required this.child});
+ final CellShortcuts child;
+
@override
void invoke(covariant GridCellPasteIntent intent) {
final callback = child.shortcutHandlers[CellKeyboardKey.onInsert];
diff --git a/frontend/appflowy_flutter/lib/plugins/database/widgets/row/cells/cell_container.dart b/frontend/appflowy_flutter/lib/plugins/database/widgets/row/cells/cell_container.dart
index b6788eebc8..82ff1cce08 100644
--- a/frontend/appflowy_flutter/lib/plugins/database/widgets/row/cells/cell_container.dart
+++ b/frontend/appflowy_flutter/lib/plugins/database/widgets/row/cells/cell_container.dart
@@ -9,11 +9,6 @@ import '../accessory/cell_shortcuts.dart';
import '../../cell/editable_cell_builder.dart';
class CellContainer extends StatelessWidget {
- final EditableCellWidget child;
- final AccessoryBuilder? accessoryBuilder;
- final double width;
- final bool isPrimary;
-
const CellContainer({
super.key,
required this.child,
@@ -22,6 +17,11 @@ class CellContainer extends StatelessWidget {
this.accessoryBuilder,
});
+ final EditableCellWidget child;
+ final AccessoryBuilder? accessoryBuilder;
+ final double width;
+ final bool isPrimary;
+
@override
Widget build(BuildContext context) {
return ChangeNotifierProvider.value(
diff --git a/frontend/appflowy_flutter/lib/plugins/database/widgets/row/cells/checkbox_cell/checkbox_cell_bloc.dart b/frontend/appflowy_flutter/lib/plugins/database/widgets/row/cells/checkbox_cell/checkbox_cell_bloc.dart
index f289404bbc..0d3b1d37ee 100644
--- a/frontend/appflowy_flutter/lib/plugins/database/widgets/row/cells/checkbox_cell/checkbox_cell_bloc.dart
+++ b/frontend/appflowy_flutter/lib/plugins/database/widgets/row/cells/checkbox_cell/checkbox_cell_bloc.dart
@@ -7,12 +7,16 @@ import 'package:freezed_annotation/freezed_annotation.dart';
part 'checkbox_cell_bloc.freezed.dart';
class CheckboxCellBloc extends Bloc<CheckboxCellEvent, CheckboxCellState> {
- final CheckboxCellController cellController;
- void Function()? _onCellChangedFn;
-
CheckboxCellBloc({
required this.cellController,
}) : super(CheckboxCellState.initial(cellController)) {
+ _dispatch();
+ }
+
+ final CheckboxCellController cellController;
+ void Function()? _onCellChangedFn;
+
+ void _dispatch() {
on<CheckboxCellEvent>(
(event, emit) {
event.when(
diff --git a/frontend/appflowy_flutter/lib/plugins/database/widgets/row/cells/checklist_cell/checklist_cell_bloc.dart b/frontend/appflowy_flutter/lib/plugins/database/widgets/row/cells/checklist_cell/checklist_cell_bloc.dart
index b939b1096b..b6f81a43fe 100644
--- a/frontend/appflowy_flutter/lib/plugins/database/widgets/row/cells/checklist_cell/checklist_cell_bloc.dart
+++ b/frontend/appflowy_flutter/lib/plugins/database/widgets/row/cells/checklist_cell/checklist_cell_bloc.dart
@@ -1,3 +1,5 @@
+import 'dart:async';
+
import 'package:appflowy/plugins/database/application/cell/cell_controller_builder.dart';
import 'package:appflowy/plugins/database/application/cell/checklist_cell_service.dart';
import 'package:appflowy_backend/log.dart';
@@ -5,28 +7,31 @@ import 'package:appflowy_backend/protobuf/flowy-database2/checklist_entities.pb.
import 'package:appflowy_backend/protobuf/flowy-database2/select_option_entities.pb.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:freezed_annotation/freezed_annotation.dart';
-import 'dart:async';
part 'checklist_cell_bloc.freezed.dart';
class ChecklistSelectOption {
+ ChecklistSelectOption(this.isSelected, this.data);
+
final bool isSelected;
final SelectOptionPB data;
-
- ChecklistSelectOption(this.isSelected, this.data);
}
class ChecklistCellBloc extends Bloc<ChecklistCellEvent, ChecklistCellState> {
- final ChecklistCellController cellController;
- final ChecklistCellBackendService _checklistCellService;
- void Function()? _onCellChangedFn;
- ChecklistCellBloc({
- required this.cellController,
- }) : _checklistCellService = ChecklistCellBackendService(
+ ChecklistCellBloc({required this.cellController})
+ : _checklistCellService = ChecklistCellBackendService(
viewId: cellController.viewId,
fieldId: cellController.fieldId,
rowId: cellController.rowId,
),
super(ChecklistCellState.initial(cellController)) {
+ _dispatch();
+ }
+
+ final ChecklistCellController cellController;
+ final ChecklistCellBackendService _checklistCellService;
+ void Function()? _onCellChangedFn;
+
+ void _dispatch() {
on<ChecklistCellEvent>(
(event, emit) async {
await event.when(
diff --git a/frontend/appflowy_flutter/lib/plugins/database/widgets/row/cells/checklist_cell/checklist_cell_editor.dart b/frontend/appflowy_flutter/lib/plugins/database/widgets/row/cells/checklist_cell/checklist_cell_editor.dart
index 6b34473421..e016c526a9 100644
--- a/frontend/appflowy_flutter/lib/plugins/database/widgets/row/cells/checklist_cell/checklist_cell_editor.dart
+++ b/frontend/appflowy_flutter/lib/plugins/database/widgets/row/cells/checklist_cell/checklist_cell_editor.dart
@@ -18,9 +18,10 @@ import 'checklist_cell_bloc.dart';
import 'checklist_progress_bar.dart';
class ChecklistCellEditor extends StatefulWidget {
- final ChecklistCellController cellController;
const ChecklistCellEditor({required this.cellController, super.key});
+ final ChecklistCellController cellController;
+
@override
State<ChecklistCellEditor> createState() => _GridChecklistCellState();
}
@@ -93,15 +94,15 @@ class _GridChecklistCellState extends State<ChecklistCellEditor> {
/// Displays the a list of all the exisiting tasks and an input field to create
/// a new task if `isAddingNewTask` is true
class ChecklistItemList extends StatefulWidget {
- final List<ChecklistSelectOption> options;
- final VoidCallback onUpdateTask;
-
const ChecklistItemList({
super.key,
required this.options,
required this.onUpdateTask,
});
+ final List<ChecklistSelectOption> options;
+ final VoidCallback onUpdateTask;
+
@override
State<ChecklistItemList> createState() => _ChecklistItemListState();
}
@@ -143,9 +144,6 @@ class _ChecklistItemListState extends State<ChecklistItemList> {
/// Represents an existing task
@visibleForTesting
class ChecklistItem extends StatefulWidget {
- final ChecklistSelectOption task;
- final VoidCallback? onSubmitted;
- final bool autofocus;
const ChecklistItem({
super.key,
required this.task,
@@ -153,6 +151,10 @@ class ChecklistItem extends StatefulWidget {
this.autofocus = false,
});
+ final ChecklistSelectOption task;
+ final VoidCallback? onSubmitted;
+ final bool autofocus;
+
@override
State<ChecklistItem> createState() => _ChecklistItemState();
}
@@ -209,7 +211,6 @@ class _ChecklistItemState extends State<ChecklistItem> {
borderRadius: Corners.s6Border,
),
child: Row(
- crossAxisAlignment: CrossAxisAlignment.center,
children: [
FlowyIconButton(
width: 32,
@@ -224,7 +225,6 @@ class _ChecklistItemState extends State<ChecklistItem> {
controller: _textController,
focusNode: _focusNode,
style: Theme.of(context).textTheme.bodyMedium,
- maxLines: 1,
decoration: InputDecoration(
border: InputBorder.none,
isCollapsed: true,
@@ -280,9 +280,10 @@ class _ChecklistItemState extends State<ChecklistItem> {
/// This can be cancelled by pressing escape
@visibleForTesting
class NewTaskItem extends StatefulWidget {
- final FocusNode focusNode;
const NewTaskItem({super.key, required this.focusNode});
+ final FocusNode focusNode;
+
@override
State<NewTaskItem> createState() => _NewTaskItemState();
}
@@ -305,7 +306,6 @@ class _NewTaskItemState extends State<NewTaskItem> {
padding: const EdgeInsets.symmetric(horizontal: 8),
constraints: BoxConstraints(minHeight: GridSize.popoverItemHeight),
child: Row(
- crossAxisAlignment: CrossAxisAlignment.center,
children: [
const HSpace(8),
Expanded(
@@ -313,7 +313,6 @@ class _NewTaskItemState extends State<NewTaskItem> {
focusNode: widget.focusNode,
controller: _textEditingController,
style: Theme.of(context).textTheme.bodyMedium,
- maxLines: 1,
decoration: InputDecoration(
border: InputBorder.none,
isCollapsed: true,
diff --git a/frontend/appflowy_flutter/lib/plugins/database/widgets/row/cells/checklist_cell/checklist_progress_bar.dart b/frontend/appflowy_flutter/lib/plugins/database/widgets/row/cells/checklist_cell/checklist_progress_bar.dart
index 983a06dce2..da5e01c69d 100644
--- a/frontend/appflowy_flutter/lib/plugins/database/widgets/row/cells/checklist_cell/checklist_progress_bar.dart
+++ b/frontend/appflowy_flutter/lib/plugins/database/widgets/row/cells/checklist_cell/checklist_progress_bar.dart
@@ -5,11 +5,6 @@ import 'package:percent_indicator/percent_indicator.dart';
import 'checklist_cell_bloc.dart';
class ChecklistProgressBar extends StatefulWidget {
- final List<ChecklistSelectOption> tasks;
- final double percent;
- final int segmentLimit = 5;
- final TextStyle? textStyle;
-
const ChecklistProgressBar({
super.key,
required this.tasks,
@@ -17,6 +12,11 @@ class ChecklistProgressBar extends StatefulWidget {
this.textStyle,
});
+ final List<ChecklistSelectOption> tasks;
+ final double percent;
+ final TextStyle? textStyle;
+ final int segmentLimit = 5;
+
@override
State<ChecklistProgressBar> createState() => _ChecklistProgressBarState();
}
diff --git a/frontend/appflowy_flutter/lib/plugins/database/widgets/row/cells/checklist_cell/mobile_checklist_cell_editor.dart b/frontend/appflowy_flutter/lib/plugins/database/widgets/row/cells/checklist_cell/mobile_checklist_cell_editor.dart
index f2d992ce43..d206a2ee80 100644
--- a/frontend/appflowy_flutter/lib/plugins/database/widgets/row/cells/checklist_cell/mobile_checklist_cell_editor.dart
+++ b/frontend/appflowy_flutter/lib/plugins/database/widgets/row/cells/checklist_cell/mobile_checklist_cell_editor.dart
@@ -60,14 +60,12 @@ class _MobileChecklistCellEditScreenState
size: Size.square(iconWidth),
),
width: iconWidth,
- iconPadding: EdgeInsets.zero,
onPressed: () => context.pop(),
),
),
SizedBox(
height: 44.0,
child: Align(
- alignment: Alignment.center,
child: FlowyText.medium(
LocaleKeys.grid_field_checklistFieldName.tr(),
fontSize: 18,
@@ -156,7 +154,6 @@ class _ChecklistItemState extends State<_ChecklistItem> {
padding: const EdgeInsets.symmetric(horizontal: 5),
height: 44,
child: Row(
- crossAxisAlignment: CrossAxisAlignment.center,
children: [
InkWell(
borderRadius: BorderRadius.circular(22),
@@ -181,7 +178,6 @@ class _ChecklistItemState extends State<_ChecklistItem> {
controller: _textController,
focusNode: _focusNode,
style: Theme.of(context).textTheme.bodyMedium,
- maxLines: 1,
decoration: InputDecoration(
border: InputBorder.none,
enabledBorder: InputBorder.none,
diff --git a/frontend/appflowy_flutter/lib/plugins/database/widgets/row/cells/date_cell/date_cell_bloc.dart b/frontend/appflowy_flutter/lib/plugins/database/widgets/row/cells/date_cell/date_cell_bloc.dart
index 719204c276..409ae12576 100644
--- a/frontend/appflowy_flutter/lib/plugins/database/widgets/row/cells/date_cell/date_cell_bloc.dart
+++ b/frontend/appflowy_flutter/lib/plugins/database/widgets/row/cells/date_cell/date_cell_bloc.dart
@@ -9,11 +9,15 @@ import 'package:freezed_annotation/freezed_annotation.dart';
part 'date_cell_bloc.freezed.dart';
class DateCellBloc extends Bloc<DateCellEvent, DateCellState> {
+ DateCellBloc({required this.cellController})
+ : super(DateCellState.initial(cellController)) {
+ _dispatch();
+ }
+
final DateCellController cellController;
void Function()? _onCellChangedFn;
- DateCellBloc({required this.cellController})
- : super(DateCellState.initial(cellController)) {
+ void _dispatch() {
on<DateCellEvent>(
(event, emit) async {
event.when(
@@ -42,11 +46,11 @@ class DateCellBloc extends Bloc<DateCellEvent, DateCellState> {
void _startListening() {
_onCellChangedFn = cellController.addListener(
- onCellChanged: ((data) {
+ onCellChanged: (data) {
if (!isClosed) {
add(DateCellEvent.didReceiveCellUpdate(data));
}
- }),
+ },
);
}
}
diff --git a/frontend/appflowy_flutter/lib/plugins/database/widgets/row/cells/date_cell/date_cell_editor_bloc.dart b/frontend/appflowy_flutter/lib/plugins/database/widgets/row/cells/date_cell/date_cell_editor_bloc.dart
index f2aafbfc25..a83a4635f9 100644
--- a/frontend/appflowy_flutter/lib/plugins/database/widgets/row/cells/date_cell/date_cell_editor_bloc.dart
+++ b/frontend/appflowy_flutter/lib/plugins/database/widgets/row/cells/date_cell/date_cell_editor_bloc.dart
@@ -27,11 +27,6 @@ part 'date_cell_editor_bloc.freezed.dart';
class DateCellEditorBloc
extends Bloc<DateCellEditorEvent, DateCellEditorState> {
- final DateCellBackendService _dateCellBackendService;
- final DateCellController cellController;
- final ReminderBloc _reminderBloc;
- void Function()? _onCellChangedFn;
-
DateCellEditorBloc({
required this.cellController,
required ReminderBloc reminderBloc,
@@ -42,6 +37,15 @@ class DateCellEditorBloc
rowId: cellController.rowId,
),
super(DateCellEditorState.initial(cellController, reminderBloc)) {
+ _dispatch();
+ }
+
+ final DateCellBackendService _dateCellBackendService;
+ final DateCellController cellController;
+ final ReminderBloc _reminderBloc;
+ void Function()? _onCellChangedFn;
+
+ void _dispatch() {
on<DateCellEditorEvent>(
(event, emit) async {
await event.when(
@@ -120,9 +124,8 @@ class DateCellEditorBloc
}
},
setIncludeTime: (includeTime) async =>
- await _updateDateData(includeTime: includeTime),
- setIsRange: (isRange) async =>
- await _updateDateData(isRange: isRange),
+ _updateDateData(includeTime: includeTime),
+ setIsRange: (isRange) async => _updateDateData(isRange: isRange),
setTime: (timeStr) async {
emit(state.copyWith(timeStr: timeStr));
await _updateDateData(timeStr: timeStr);
@@ -213,7 +216,7 @@ class DateCellEditorBloc
}
},
// Empty String signifies no reminder
- removeReminder: () async => await _updateDateData(reminderId: ""),
+ removeReminder: () async => _updateDateData(reminderId: ""),
);
},
);
@@ -578,16 +581,6 @@ _DateCellData _dateDataFromCellData(
}
class _DateCellData {
- final DateTime? dateTime;
- final DateTime? endDateTime;
- final String? timeStr;
- final String? endTimeStr;
- final bool includeTime;
- final bool isRange;
- final String? dateStr;
- final String? endDateStr;
- final String? reminderId;
-
_DateCellData({
required this.dateTime,
required this.endDateTime,
@@ -599,4 +592,14 @@ class _DateCellData {
required this.endDateStr,
required this.reminderId,
});
+
+ final DateTime? dateTime;
+ final DateTime? endDateTime;
+ final String? timeStr;
+ final String? endTimeStr;
+ final bool includeTime;
+ final bool isRange;
+ final String? dateStr;
+ final String? endDateStr;
+ final String? reminderId;
}
diff --git a/frontend/appflowy_flutter/lib/plugins/database/widgets/row/cells/mobile_cell_container.dart b/frontend/appflowy_flutter/lib/plugins/database/widgets/row/cells/mobile_cell_container.dart
index 399432d452..cdc984e4b7 100644
--- a/frontend/appflowy_flutter/lib/plugins/database/widgets/row/cells/mobile_cell_container.dart
+++ b/frontend/appflowy_flutter/lib/plugins/database/widgets/row/cells/mobile_cell_container.dart
@@ -6,10 +6,6 @@ import '../../cell/editable_cell_builder.dart';
import 'cell_container.dart';
class MobileCellContainer extends StatelessWidget {
- final EditableCellWidget child;
- final bool isPrimary;
- final VoidCallback? onPrimaryFieldCellTap;
-
const MobileCellContainer({
super.key,
required this.child,
@@ -17,6 +13,10 @@ class MobileCellContainer extends StatelessWidget {
this.onPrimaryFieldCellTap,
});
+ final EditableCellWidget child;
+ final bool isPrimary;
+ final VoidCallback? onPrimaryFieldCellTap;
+
@override
Widget build(BuildContext context) {
return ChangeNotifierProvider.value(
diff --git a/frontend/appflowy_flutter/lib/plugins/database/widgets/row/cells/number_cell/number_cell_bloc.dart b/frontend/appflowy_flutter/lib/plugins/database/widgets/row/cells/number_cell/number_cell_bloc.dart
index 7691d6ce22..214e88177a 100644
--- a/frontend/appflowy_flutter/lib/plugins/database/widgets/row/cells/number_cell/number_cell_bloc.dart
+++ b/frontend/appflowy_flutter/lib/plugins/database/widgets/row/cells/number_cell/number_cell_bloc.dart
@@ -1,17 +1,21 @@
+import 'dart:async';
+
import 'package:appflowy/plugins/database/application/cell/cell_controller_builder.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:freezed_annotation/freezed_annotation.dart';
-import 'dart:async';
part 'number_cell_bloc.freezed.dart';
class NumberCellBloc extends Bloc<NumberCellEvent, NumberCellState> {
+ NumberCellBloc({required this.cellController})
+ : super(NumberCellState.initial(cellController)) {
+ _dispatch();
+ }
+
final NumberCellController cellController;
void Function()? _onCellChangedFn;
- NumberCellBloc({
- required this.cellController,
- }) : super(NumberCellState.initial(cellController)) {
+ void _dispatch() {
on<NumberCellEvent>(
(event, emit) async {
event.when(
@@ -53,11 +57,11 @@ class NumberCellBloc extends Bloc<NumberCellEvent, NumberCellState> {
void _startListening() {
_onCellChangedFn = cellController.addListener(
- onCellChanged: ((cellContent) {
+ onCellChanged: (cellContent) {
if (!isClosed) {
add(NumberCellEvent.didReceiveCellUpdate(cellContent));
}
- }),
+ },
);
}
}
diff --git a/frontend/appflowy_flutter/lib/plugins/database/widgets/row/cells/select_option_cell/extension.dart b/frontend/appflowy_flutter/lib/plugins/database/widgets/row/cells/select_option_cell/extension.dart
index acd2cca6a0..a5efce1fc7 100644
--- a/frontend/appflowy_flutter/lib/plugins/database/widgets/row/cells/select_option_cell/extension.dart
+++ b/frontend/appflowy_flutter/lib/plugins/database/widgets/row/cells/select_option_cell/extension.dart
@@ -60,14 +60,6 @@ extension SelectOptionColorExtension on SelectOptionColorPB {
}
class SelectOptionTag extends StatelessWidget {
- final SelectOptionPB? option;
- final String? name;
- final double? fontSize;
- final Color? color;
- final TextStyle? textStyle;
- final EdgeInsets padding;
- final void Function(String)? onRemove;
-
const SelectOptionTag({
super.key,
this.option,
@@ -79,6 +71,14 @@ class SelectOptionTag extends StatelessWidget {
required this.padding,
}) : assert(option != null || name != null && color != null);
+ final SelectOptionPB? option;
+ final String? name;
+ final double? fontSize;
+ final Color? color;
+ final TextStyle? textStyle;
+ final void Function(String)? onRemove;
+ final EdgeInsets padding;
+
@override
Widget build(BuildContext context) {
final optionName = option?.name ?? name!;
diff --git a/frontend/appflowy_flutter/lib/plugins/database/widgets/row/cells/select_option_cell/mobile_select_option_editor.dart b/frontend/appflowy_flutter/lib/plugins/database/widgets/row/cells/select_option_cell/mobile_select_option_editor.dart
index f78b46b6bb..c2d9ff4c3b 100644
--- a/frontend/appflowy_flutter/lib/plugins/database/widgets/row/cells/select_option_cell/mobile_select_option_editor.dart
+++ b/frontend/appflowy_flutter/lib/plugins/database/widgets/row/cells/select_option_cell/mobile_select_option_editor.dart
@@ -94,14 +94,12 @@ class _MobileSelectOptionEditorState extends State<MobileSelectOptionEditor> {
size: const Size.square(iconWidth),
),
width: iconWidth,
- iconPadding: EdgeInsets.zero,
onPressed: () => _popOrBack(),
),
),
SizedBox(
height: 44.0,
child: Align(
- alignment: Alignment.center,
child: FlowyText.medium(
_headerTitle(),
fontSize: 18,
@@ -335,7 +333,6 @@ class _SelectOption extends StatelessWidget {
behavior: HitTestBehavior.translucent,
onTap: () => onCheck(!checked),
child: Row(
- crossAxisAlignment: CrossAxisAlignment.center,
children: [
// check icon
FlowySvg(
@@ -450,8 +447,6 @@ class _MoreOptionsState extends State<_MoreOptions> {
),
const VSpace(4.0),
FlowyOptionDecorateBox(
- showTopBorder: true,
- showBottomBorder: true,
child: Padding(
padding: const EdgeInsets.only(
top: 12.0,
diff --git a/frontend/appflowy_flutter/lib/plugins/database/widgets/row/cells/select_option_cell/select_option_cell_bloc.dart b/frontend/appflowy_flutter/lib/plugins/database/widgets/row/cells/select_option_cell/select_option_cell_bloc.dart
index 45100be17b..392db0492c 100644
--- a/frontend/appflowy_flutter/lib/plugins/database/widgets/row/cells/select_option_cell/select_option_cell_bloc.dart
+++ b/frontend/appflowy_flutter/lib/plugins/database/widgets/row/cells/select_option_cell/select_option_cell_bloc.dart
@@ -9,12 +9,15 @@ part 'select_option_cell_bloc.freezed.dart';
class SelectOptionCellBloc
extends Bloc<SelectOptionCellEvent, SelectOptionCellState> {
+ SelectOptionCellBloc({required this.cellController})
+ : super(SelectOptionCellState.initial(cellController)) {
+ _dispatch();
+ }
+
final SelectOptionCellController cellController;
void Function()? _onCellChangedFn;
- SelectOptionCellBloc({
- required this.cellController,
- }) : super(SelectOptionCellState.initial(cellController)) {
+ void _dispatch() {
on<SelectOptionCellEvent>(
(event, emit) async {
await event.when(
diff --git a/frontend/appflowy_flutter/lib/plugins/database/widgets/row/cells/select_option_cell/select_option_editor.dart b/frontend/appflowy_flutter/lib/plugins/database/widgets/row/cells/select_option_cell/select_option_editor.dart
index 836ba4ff89..d7d3c5bb70 100644
--- a/frontend/appflowy_flutter/lib/plugins/database/widgets/row/cells/select_option_cell/select_option_editor.dart
+++ b/frontend/appflowy_flutter/lib/plugins/database/widgets/row/cells/select_option_cell/select_option_editor.dart
@@ -22,10 +22,10 @@ import 'text_field.dart';
const double _editorPanelWidth = 300;
class SelectOptionCellEditor extends StatefulWidget {
- final SelectOptionCellController cellController;
-
const SelectOptionCellEditor({super.key, required this.cellController});
+ final SelectOptionCellController cellController;
+
@override
State<SelectOptionCellEditor> createState() => _SelectOptionCellEditorState();
}
@@ -71,14 +71,14 @@ class _SelectOptionCellEditorState extends State<SelectOptionCellEditor> {
}
class _OptionList extends StatelessWidget {
- final TextEditingController textEditingController;
- final PopoverMutex popoverMutex;
-
const _OptionList({
required this.textEditingController,
required this.popoverMutex,
});
+ final TextEditingController textEditingController;
+ final PopoverMutex popoverMutex;
+
@override
Widget build(BuildContext context) {
return BlocBuilder<SelectOptionCellEditorBloc, SelectOptionEditorState>(
@@ -126,14 +126,14 @@ class _OptionList extends StatelessWidget {
}
class _TextField extends StatelessWidget {
- final TextEditingController textEditingController;
- final PopoverMutex popoverMutex;
-
const _TextField({
required this.textEditingController,
required this.popoverMutex,
});
+ final TextEditingController textEditingController;
+ final PopoverMutex popoverMutex;
+
@override
Widget build(BuildContext context) {
return BlocBuilder<SelectOptionCellEditorBloc, SelectOptionEditorState>(
@@ -199,7 +199,6 @@ class _Title extends StatelessWidget {
child: SizedBox(
height: GridSize.popoverItemHeight,
child: Row(
- crossAxisAlignment: CrossAxisAlignment.center,
children: [
Flexible(
child: FlowyText.medium(
@@ -275,16 +274,16 @@ class _CreateOptionCell extends StatelessWidget {
}
class _SelectOptionCell extends StatefulWidget {
- final SelectOptionPB option;
- final PopoverMutex popoverMutex;
- final bool isSelected;
-
const _SelectOptionCell({
required this.option,
required this.isSelected,
required this.popoverMutex,
});
+ final SelectOptionPB option;
+ final bool isSelected;
+ final PopoverMutex popoverMutex;
+
@override
State<_SelectOptionCell> createState() => _SelectOptionCellState();
}
@@ -317,7 +316,6 @@ class _SelectOptionCellState extends State<_SelectOptionCell> {
),
),
FlowyIconButton(
- width: 30,
onPressed: () => _popoverController.show(),
iconPadding: const EdgeInsets.symmetric(horizontal: 6.0),
hoverColor: Colors.transparent,
diff --git a/frontend/appflowy_flutter/lib/plugins/database/widgets/row/cells/select_option_cell/select_option_editor_bloc.dart b/frontend/appflowy_flutter/lib/plugins/database/widgets/row/cells/select_option_cell/select_option_editor_bloc.dart
index 571fe28351..ab879b7d8b 100644
--- a/frontend/appflowy_flutter/lib/plugins/database/widgets/row/cells/select_option_cell/select_option_editor_bloc.dart
+++ b/frontend/appflowy_flutter/lib/plugins/database/widgets/row/cells/select_option_cell/select_option_editor_bloc.dart
@@ -1,11 +1,12 @@
import 'dart:async';
+import 'package:flutter/widgets.dart';
+
import 'package:appflowy/plugins/database/application/cell/cell_controller_builder.dart';
import 'package:appflowy/plugins/database/application/cell/select_option_cell_service.dart';
import 'package:appflowy_backend/log.dart';
import 'package:appflowy_backend/protobuf/flowy-database2/select_option_entities.pb.dart';
import 'package:dartz/dartz.dart';
-import 'package:flutter/widgets.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:freezed_annotation/freezed_annotation.dart';
@@ -13,19 +14,22 @@ part 'select_option_editor_bloc.freezed.dart';
class SelectOptionCellEditorBloc
extends Bloc<SelectOptionEditorEvent, SelectOptionEditorState> {
- final SelectOptionCellBackendService _selectOptionService;
- final SelectOptionCellController cellController;
-
- VoidCallback? _onCellChangedFn;
-
- SelectOptionCellEditorBloc({
- required this.cellController,
- }) : _selectOptionService = SelectOptionCellBackendService(
+ SelectOptionCellEditorBloc({required this.cellController})
+ : _selectOptionService = SelectOptionCellBackendService(
viewId: cellController.viewId,
fieldId: cellController.fieldId,
rowId: cellController.rowId,
),
super(SelectOptionEditorState.initial(cellController)) {
+ _dispatch();
+ }
+
+ final SelectOptionCellBackendService _selectOptionService;
+ final SelectOptionCellController cellController;
+
+ VoidCallback? _onCellChangedFn;
+
+ void _dispatch() {
on<SelectOptionEditorEvent>(
(event, emit) async {
await event.when(
@@ -247,9 +251,9 @@ class SelectOptionCellEditorBloc
void _startListening() {
_onCellChangedFn = cellController.addListener(
- onCellChanged: ((selectOptionContext) {
+ onCellChanged: (selectOptionContext) {
_loadOptions();
- }),
+ },
onCellFieldChanged: (field) {
_loadOptions();
},
@@ -308,11 +312,11 @@ class SelectOptionEditorState with _$SelectOptionEditorState {
}
class _MakeOptionResult {
- List<SelectOptionPB> options;
- Option<String> createOption;
-
_MakeOptionResult({
required this.options,
required this.createOption,
});
+
+ List<SelectOptionPB> options;
+ Option<String> createOption;
}
diff --git a/frontend/appflowy_flutter/lib/plugins/database/widgets/row/cells/select_option_cell/text_field.dart b/frontend/appflowy_flutter/lib/plugins/database/widgets/row/cells/select_option_cell/text_field.dart
index 1a65446d8d..0e4c8a944a 100644
--- a/frontend/appflowy_flutter/lib/plugins/database/widgets/row/cells/select_option_cell/text_field.dart
+++ b/frontend/appflowy_flutter/lib/plugins/database/widgets/row/cells/select_option_cell/text_field.dart
@@ -11,6 +11,20 @@ import 'package:flutter/services.dart';
import 'extension.dart';
class SelectOptionTextField extends StatefulWidget {
+ const SelectOptionTextField({
+ super.key,
+ required this.options,
+ required this.selectedOptionMap,
+ required this.distanceToText,
+ required this.textSeparators,
+ required this.textController,
+ required this.onSubmitted,
+ required this.newText,
+ required this.onPaste,
+ required this.onRemove,
+ this.onClick,
+ });
+
final List<SelectOptionPB> options;
final LinkedHashMap<String, SelectOptionPB> selectedOptionMap;
final double distanceToText;
@@ -23,20 +37,6 @@ class SelectOptionTextField extends StatefulWidget {
final Function(String) onRemove;
final VoidCallback? onClick;
- const SelectOptionTextField({
- super.key,
- required this.options,
- required this.selectedOptionMap,
- required this.distanceToText,
- required this.onSubmitted,
- required this.onPaste,
- required this.onRemove,
- required this.newText,
- required this.textSeparators,
- required this.textController,
- this.onClick,
- });
-
@override
State<SelectOptionTextField> createState() => _SelectOptionTextFieldState();
}
@@ -59,7 +59,6 @@ class _SelectOptionTextFieldState extends State<SelectOptionTextField> {
widget.textController.value = TextEditingValue(
text: "${text.substring(0, start)}${text.substring(end)}",
selection: TextSelection(baseOffset: start, extentOffset: start),
- composing: const TextRange(start: -1, end: -1),
);
return KeyEventResult.handled;
}
@@ -92,14 +91,10 @@ class _SelectOptionTextFieldState extends State<SelectOptionTextField> {
widget.textController.clear();
}
},
- maxLines: 1,
style: Theme.of(context).textTheme.bodyMedium,
decoration: InputDecoration(
enabledBorder: OutlineInputBorder(
- borderSide: BorderSide(
- color: Theme.of(context).colorScheme.outline,
- width: 1.0,
- ),
+ borderSide: BorderSide(color: Theme.of(context).colorScheme.outline),
borderRadius: Corners.s10Border,
),
isDense: true,
@@ -111,10 +106,7 @@ class _SelectOptionTextFieldState extends State<SelectOptionTextField> {
.copyWith(color: Theme.of(context).hintColor),
prefixIconConstraints: BoxConstraints(maxWidth: widget.distanceToText),
focusedBorder: OutlineInputBorder(
- borderSide: BorderSide(
- color: Theme.of(context).colorScheme.primary,
- width: 1.0,
- ),
+ borderSide: BorderSide(color: Theme.of(context).colorScheme.primary),
borderRadius: Corners.s10Border,
),
),
@@ -154,6 +146,7 @@ class _SelectOptionTextFieldState extends State<SelectOptionTextField> {
),
)
.toList();
+
return MouseRegion(
cursor: SystemMouseCursors.basic,
child: Padding(
diff --git a/frontend/appflowy_flutter/lib/plugins/database/widgets/row/cells/text_cell/text_cell_bloc.dart b/frontend/appflowy_flutter/lib/plugins/database/widgets/row/cells/text_cell/text_cell_bloc.dart
index 89ca22b165..3c57f04749 100644
--- a/frontend/appflowy_flutter/lib/plugins/database/widgets/row/cells/text_cell/text_cell_bloc.dart
+++ b/frontend/appflowy_flutter/lib/plugins/database/widgets/row/cells/text_cell/text_cell_bloc.dart
@@ -7,12 +7,15 @@ import 'package:freezed_annotation/freezed_annotation.dart';
part 'text_cell_bloc.freezed.dart';
class TextCellBloc extends Bloc<TextCellEvent, TextCellState> {
+ TextCellBloc({required this.cellController})
+ : super(TextCellState.initial(cellController)) {
+ _dispatch();
+ }
+
final TextCellController cellController;
void Function()? _onCellChangedFn;
- TextCellBloc({
- required this.cellController,
- }) : super(TextCellState.initial(cellController)) {
+ void _dispatch() {
on<TextCellEvent>(
(event, emit) {
event.when(
@@ -50,11 +53,11 @@ class TextCellBloc extends Bloc<TextCellEvent, TextCellState> {
void _startListening() {
_onCellChangedFn = cellController.addListener(
- onCellChanged: ((cellContent) {
+ onCellChanged: (cellContent) {
if (!isClosed) {
add(TextCellEvent.didReceiveCellUpdate(cellContent ?? ""));
}
- }),
+ },
onRowMetaChanged: () {
if (!isClosed && cellController.fieldInfo.isPrimary) {
add(TextCellEvent.didUpdateEmoji(cellController.icon ?? ""));
diff --git a/frontend/appflowy_flutter/lib/plugins/database/widgets/row/cells/timestamp_cell/timestamp_cell_bloc.dart b/frontend/appflowy_flutter/lib/plugins/database/widgets/row/cells/timestamp_cell/timestamp_cell_bloc.dart
index 0a14354616..c757b44efa 100644
--- a/frontend/appflowy_flutter/lib/plugins/database/widgets/row/cells/timestamp_cell/timestamp_cell_bloc.dart
+++ b/frontend/appflowy_flutter/lib/plugins/database/widgets/row/cells/timestamp_cell/timestamp_cell_bloc.dart
@@ -9,11 +9,15 @@ import 'package:freezed_annotation/freezed_annotation.dart';
part 'timestamp_cell_bloc.freezed.dart';
class TimestampCellBloc extends Bloc<TimestampCellEvent, TimestampCellState> {
+ TimestampCellBloc({required this.cellController})
+ : super(TimestampCellState.initial(cellController)) {
+ _dispatch();
+ }
+
final TimestampCellController cellController;
void Function()? _onCellChangedFn;
- TimestampCellBloc({required this.cellController})
- : super(TimestampCellState.initial(cellController)) {
+ void _dispatch() {
on<TimestampCellEvent>(
(event, emit) async {
event.when(
@@ -43,11 +47,11 @@ class TimestampCellBloc extends Bloc<TimestampCellEvent, TimestampCellState> {
void _startListening() {
_onCellChangedFn = cellController.addListener(
- onCellChanged: ((data) {
+ onCellChanged: (data) {
if (!isClosed) {
add(TimestampCellEvent.didReceiveCellUpdate(data));
}
- }),
+ },
);
}
}
diff --git a/frontend/appflowy_flutter/lib/plugins/database/widgets/row/cells/url_cell/cell_editor.dart b/frontend/appflowy_flutter/lib/plugins/database/widgets/row/cells/url_cell/cell_editor.dart
index 5748dbb31e..2e69b056b6 100644
--- a/frontend/appflowy_flutter/lib/plugins/database/widgets/row/cells/url_cell/cell_editor.dart
+++ b/frontend/appflowy_flutter/lib/plugins/database/widgets/row/cells/url_cell/cell_editor.dart
@@ -6,14 +6,15 @@ import 'package:flutter_bloc/flutter_bloc.dart';
import 'url_cell_editor_bloc.dart';
class URLCellEditor extends StatefulWidget {
- final VoidCallback onExit;
- final URLCellController cellController;
const URLCellEditor({
+ super.key,
required this.cellController,
required this.onExit,
- super.key,
});
+ final URLCellController cellController;
+ final VoidCallback onExit;
+
@override
State<URLCellEditor> createState() => _URLCellEditorState();
}
@@ -50,7 +51,6 @@ class _URLCellEditorState extends State<URLCellEditor> {
controller: _controller,
onSubmitted: (value) => focusChanged(),
onEditingComplete: () => focusChanged(),
- maxLines: 1,
style: Theme.of(context).textTheme.bodyMedium,
decoration: const InputDecoration(
contentPadding: EdgeInsets.zero,
@@ -80,14 +80,15 @@ class _URLCellEditorState extends State<URLCellEditor> {
}
class URLEditorPopover extends StatelessWidget {
- final VoidCallback onExit;
- final URLCellController cellController;
const URLEditorPopover({
+ super.key,
required this.cellController,
required this.onExit,
- super.key,
});
+ final URLCellController cellController;
+ final VoidCallback onExit;
+
@override
Widget build(BuildContext context) {
return Container(
diff --git a/frontend/appflowy_flutter/lib/plugins/database/widgets/row/cells/url_cell/url_cell_bloc.dart b/frontend/appflowy_flutter/lib/plugins/database/widgets/row/cells/url_cell/url_cell_bloc.dart
index 5194b2d471..6ab0086e26 100644
--- a/frontend/appflowy_flutter/lib/plugins/database/widgets/row/cells/url_cell/url_cell_bloc.dart
+++ b/frontend/appflowy_flutter/lib/plugins/database/widgets/row/cells/url_cell/url_cell_bloc.dart
@@ -1,17 +1,22 @@
+import 'dart:async';
+
import 'package:appflowy/plugins/database/application/cell/cell_controller_builder.dart';
import 'package:appflowy_backend/protobuf/flowy-database2/url_entities.pb.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:freezed_annotation/freezed_annotation.dart';
-import 'dart:async';
part 'url_cell_bloc.freezed.dart';
class URLCellBloc extends Bloc<URLCellEvent, URLCellState> {
+ URLCellBloc({required this.cellController})
+ : super(URLCellState.initial(cellController)) {
+ _dispatch();
+ }
+
final URLCellController cellController;
void Function()? _onCellChangedFn;
- URLCellBloc({
- required this.cellController,
- }) : super(URLCellState.initial(cellController)) {
+
+ void _dispatch() {
on<URLCellEvent>(
(event, emit) async {
event.when(
@@ -46,11 +51,11 @@ class URLCellBloc extends Bloc<URLCellEvent, URLCellState> {
void _startListening() {
_onCellChangedFn = cellController.addListener(
- onCellChanged: ((cellData) {
+ onCellChanged: (cellData) {
if (!isClosed) {
add(URLCellEvent.didReceiveCellUpdate(cellData));
}
- }),
+ },
);
}
}
diff --git a/frontend/appflowy_flutter/lib/plugins/database/widgets/row/cells/url_cell/url_cell_editor_bloc.dart b/frontend/appflowy_flutter/lib/plugins/database/widgets/row/cells/url_cell/url_cell_editor_bloc.dart
index 3308f6cfac..1ee86a97b7 100644
--- a/frontend/appflowy_flutter/lib/plugins/database/widgets/row/cells/url_cell/url_cell_editor_bloc.dart
+++ b/frontend/appflowy_flutter/lib/plugins/database/widgets/row/cells/url_cell/url_cell_editor_bloc.dart
@@ -1,17 +1,22 @@
+import 'dart:async';
+
import 'package:appflowy/plugins/database/application/cell/cell_controller_builder.dart';
import 'package:appflowy_backend/protobuf/flowy-database2/url_entities.pb.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:freezed_annotation/freezed_annotation.dart';
-import 'dart:async';
part 'url_cell_editor_bloc.freezed.dart';
class URLCellEditorBloc extends Bloc<URLCellEditorEvent, URLCellEditorState> {
+ URLCellEditorBloc({required this.cellController})
+ : super(URLCellEditorState.initial(cellController)) {
+ _dispatch();
+ }
+
final URLCellController cellController;
void Function()? _onCellChangedFn;
- URLCellEditorBloc({
- required this.cellController,
- }) : super(URLCellEditorState.initial(cellController)) {
+
+ void _dispatch() {
on<URLCellEditorEvent>(
(event, emit) async {
await event.when(
@@ -47,11 +52,11 @@ class URLCellEditorBloc extends Bloc<URLCellEditorEvent, URLCellEditorState> {
void _startListening() {
_onCellChangedFn = cellController.addListener(
- onCellChanged: ((cellData) {
+ onCellChanged: (cellData) {
if (!isClosed) {
add(URLCellEditorEvent.didReceiveCellUpdate(cellData));
}
- }),
+ },
);
}
}
diff --git a/frontend/appflowy_flutter/lib/plugins/database/widgets/row/row_action.dart b/frontend/appflowy_flutter/lib/plugins/database/widgets/row/row_action.dart
index 1933dee544..fee92600c6 100644
--- a/frontend/appflowy_flutter/lib/plugins/database/widgets/row/row_action.dart
+++ b/frontend/appflowy_flutter/lib/plugins/database/widgets/row/row_action.dart
@@ -9,11 +9,9 @@ import 'package:flowy_infra_ui/flowy_infra_ui.dart';
import 'package:flutter/material.dart';
class RowActionList extends StatelessWidget {
+ const RowActionList({super.key, required this.rowController});
+
final RowController rowController;
- const RowActionList({
- required this.rowController,
- super.key,
- });
@override
Widget build(BuildContext context) {
diff --git a/frontend/appflowy_flutter/lib/plugins/database/widgets/row/row_banner.dart b/frontend/appflowy_flutter/lib/plugins/database/widgets/row/row_banner.dart
index 3da1c03963..57fcef2e32 100644
--- a/frontend/appflowy_flutter/lib/plugins/database/widgets/row/row_banner.dart
+++ b/frontend/appflowy_flutter/lib/plugins/database/widgets/row/row_banner.dart
@@ -19,15 +19,15 @@ typedef OnSubmittedEmoji = void Function(String emoji);
const _kBannerActionHeight = 40.0;
class RowBanner extends StatefulWidget {
- final RowController rowController;
- final EditableCellBuilder cellBuilder;
-
const RowBanner({
+ super.key,
required this.rowController,
required this.cellBuilder,
- super.key,
});
+ final RowController rowController;
+ final EditableCellBuilder cellBuilder;
+
@override
State<RowBanner> createState() => _RowBannerState();
}
@@ -88,14 +88,14 @@ class _RowBannerState extends State<RowBanner> {
}
class _BannerAction extends StatelessWidget {
- final ValueNotifier<bool> isHovering;
- final PopoverController popoverController;
-
const _BannerAction({
required this.isHovering,
required this.popoverController,
});
+ final ValueNotifier<bool> isHovering;
+ final PopoverController popoverController;
+
@override
Widget build(BuildContext context) {
return SizedBox(
@@ -111,7 +111,6 @@ class _BannerAction extends StatelessWidget {
builder: (context, state) {
return Row(
mainAxisSize: MainAxisSize.min,
- crossAxisAlignment: CrossAxisAlignment.center,
children: [
if (state.rowMeta.icon.isEmpty)
AddEmojiButton(
@@ -134,16 +133,16 @@ class _BannerAction extends StatelessWidget {
}
class _BannerTitle extends StatelessWidget {
- final EditableCellBuilder cellBuilder;
- final PopoverController popoverController;
- final RowController rowController;
-
const _BannerTitle({
required this.cellBuilder,
required this.popoverController,
required this.rowController,
});
+ final EditableCellBuilder cellBuilder;
+ final PopoverController popoverController;
+ final RowController rowController;
+
@override
Widget build(BuildContext context) {
return BlocBuilder<RowBannerBloc, RowBannerState>(
@@ -187,15 +186,15 @@ class _BannerTitle extends StatelessWidget {
}
class EmojiButton extends StatelessWidget {
- final String emoji;
- final VoidCallback showEmojiPicker;
-
const EmojiButton({
+ super.key,
required this.emoji,
required this.showEmojiPicker,
- super.key,
});
+ final String emoji;
+ final VoidCallback showEmojiPicker;
+
@override
Widget build(BuildContext context) {
return SizedBox(
@@ -214,11 +213,9 @@ class EmojiButton extends StatelessWidget {
}
class AddEmojiButton extends StatelessWidget {
+ const AddEmojiButton({super.key, required this.onTap});
+
final VoidCallback onTap;
- const AddEmojiButton({
- super.key,
- required this.onTap,
- });
@override
Widget build(BuildContext context) {
@@ -238,11 +235,9 @@ class AddEmojiButton extends StatelessWidget {
}
class RemoveEmojiButton extends StatelessWidget {
+ const RemoveEmojiButton({super.key, required this.onTap});
+
final VoidCallback onTap;
- const RemoveEmojiButton({
- super.key,
- required this.onTap,
- });
@override
Widget build(BuildContext context) {
@@ -262,9 +257,10 @@ class RemoveEmojiButton extends StatelessWidget {
}
class RowActionButton extends StatelessWidget {
- final RowController rowController;
const RowActionButton({super.key, required this.rowController});
+ final RowController rowController;
+
@override
Widget build(BuildContext context) {
return AppFlowyPopover(
diff --git a/frontend/appflowy_flutter/lib/plugins/database/widgets/row/row_detail.dart b/frontend/appflowy_flutter/lib/plugins/database/widgets/row/row_detail.dart
index d92df79c8d..37adcbe0b3 100644
--- a/frontend/appflowy_flutter/lib/plugins/database/widgets/row/row_detail.dart
+++ b/frontend/appflowy_flutter/lib/plugins/database/widgets/row/row_detail.dart
@@ -13,15 +13,15 @@ import 'row_banner.dart';
import 'row_property.dart';
class RowDetailPage extends StatefulWidget with FlowyOverlayDelegate {
- final DatabaseController databaseController;
- final RowController rowController;
-
const RowDetailPage({
super.key,
required this.rowController,
required this.databaseController,
});
+ final RowController rowController;
+ final DatabaseController databaseController;
+
@override
State<RowDetailPage> createState() => _RowDetailPageState();
}
diff --git a/frontend/appflowy_flutter/lib/plugins/database/widgets/row/row_property.dart b/frontend/appflowy_flutter/lib/plugins/database/widgets/row/row_property.dart
index e0e99c6194..1718d3a67e 100644
--- a/frontend/appflowy_flutter/lib/plugins/database/widgets/row/row_property.dart
+++ b/frontend/appflowy_flutter/lib/plugins/database/widgets/row/row_property.dart
@@ -27,10 +27,6 @@ import '../cell/editable_cell_builder.dart';
/// Display the row properties in a list. Only used in [RowDetailPage].
class RowPropertyList extends StatelessWidget {
- final String viewId;
- final FieldController fieldController;
- final EditableCellBuilder cellBuilder;
-
const RowPropertyList({
super.key,
required this.viewId,
@@ -38,6 +34,10 @@ class RowPropertyList extends StatelessWidget {
required this.cellBuilder,
});
+ final String viewId;
+ final FieldController fieldController;
+ final EditableCellBuilder cellBuilder;
+
@override
Widget build(BuildContext context) {
return BlocBuilder<RowDetailBloc, RowDetailState>(
@@ -109,11 +109,6 @@ class RowPropertyList extends StatelessWidget {
}
class _PropertyCell extends StatefulWidget {
- final CellContext cellContext;
- final EditableCellBuilder cellBuilder;
- final FieldController fieldController;
- final int index;
-
const _PropertyCell({
super.key,
required this.cellContext,
@@ -122,6 +117,11 @@ class _PropertyCell extends StatefulWidget {
required this.index,
});
+ final CellContext cellContext;
+ final EditableCellBuilder cellBuilder;
+ final FieldController fieldController;
+ final int index;
+
@override
State<StatefulWidget> createState() => _PropertyCellState();
}
@@ -193,7 +193,6 @@ class _PropertyCellState extends State<_PropertyCell> {
onExit: (event) => _isFieldHover.value = false,
child: Row(
crossAxisAlignment: CrossAxisAlignment.start,
- mainAxisAlignment: MainAxisAlignment.start,
children: [
ValueListenableBuilder(
valueListenable: _isFieldHover,
@@ -312,7 +311,6 @@ class ToggleHiddenFieldsVisibilityButton extends StatelessWidget {
shape: MaterialStateProperty.all<RoundedRectangleBorder>(
RoundedRectangleBorder(
borderRadius: BorderRadius.circular(12.0),
- side: BorderSide.none,
),
),
overlayColor: MaterialStateProperty.all<Color>(
@@ -345,15 +343,15 @@ class ToggleHiddenFieldsVisibilityButton extends StatelessWidget {
}
class CreateRowFieldButton extends StatefulWidget {
- final String viewId;
- final FieldController fieldController;
-
const CreateRowFieldButton({
super.key,
required this.viewId,
required this.fieldController,
});
+ final String viewId;
+ final FieldController fieldController;
+
@override
State<CreateRowFieldButton> createState() => _CreateRowFieldButtonState();
}
diff --git a/frontend/appflowy_flutter/lib/plugins/database/widgets/setting/database_setting_action.dart b/frontend/appflowy_flutter/lib/plugins/database/widgets/setting/database_setting_action.dart
index 497624ff11..4d01970406 100644
--- a/frontend/appflowy_flutter/lib/plugins/database/widgets/setting/database_setting_action.dart
+++ b/frontend/appflowy_flutter/lib/plugins/database/widgets/setting/database_setting_action.dart
@@ -79,7 +79,6 @@ extension DatabaseSettingActionExtension on DatabaseSettingAction {
child: SizedBox(
height: GridSize.popoverItemHeight,
child: FlowyButton(
- onTap: null,
hoverColor: AFThemeExtension.of(context).lightGreyHover,
text: FlowyText.medium(
title(),
diff --git a/frontend/appflowy_flutter/lib/plugins/database/widgets/setting/setting_property_list.dart b/frontend/appflowy_flutter/lib/plugins/database/widgets/setting/setting_property_list.dart
index 2333550721..a63b4f38c3 100644
--- a/frontend/appflowy_flutter/lib/plugins/database/widgets/setting/setting_property_list.dart
+++ b/frontend/appflowy_flutter/lib/plugins/database/widgets/setting/setting_property_list.dart
@@ -18,15 +18,15 @@ import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:styled_widget/styled_widget.dart';
class DatabasePropertyList extends StatefulWidget {
- final String viewId;
- final FieldController fieldController;
-
const DatabasePropertyList({
super.key,
required this.viewId,
required this.fieldController,
});
+ final String viewId;
+ final FieldController fieldController;
+
@override
State<StatefulWidget> createState() => _DatabasePropertyListState();
}
diff --git a/frontend/appflowy_flutter/lib/plugins/database/widgets/share_button.dart b/frontend/appflowy_flutter/lib/plugins/database/widgets/share_button.dart
index 604112f080..76aae97580 100644
--- a/frontend/appflowy_flutter/lib/plugins/database/widgets/share_button.dart
+++ b/frontend/appflowy_flutter/lib/plugins/database/widgets/share_button.dart
@@ -140,10 +140,10 @@ enum ShareAction {
}
class ShareActionWrapper extends ActionCell {
- final ShareAction inner;
-
ShareActionWrapper(this.inner);
+ final ShareAction inner;
+
Widget? icon(Color iconColor) => null;
@override
diff --git a/frontend/appflowy_flutter/lib/plugins/document/application/doc_bloc.dart b/frontend/appflowy_flutter/lib/plugins/document/application/doc_bloc.dart
index 7a478ea169..294098e2b4 100644
--- a/frontend/appflowy_flutter/lib/plugins/document/application/doc_bloc.dart
+++ b/frontend/appflowy_flutter/lib/plugins/document/application/doc_bloc.dart
@@ -1,5 +1,7 @@
import 'dart:async';
+import 'package:flutter/foundation.dart';
+
import 'package:appflowy/plugins/document/application/doc_service.dart';
import 'package:appflowy/plugins/document/application/document_data_pb_extension.dart';
import 'package:appflowy/plugins/document/application/editor_transaction_adapter.dart';
@@ -22,7 +24,6 @@ import 'package:appflowy_editor/appflowy_editor.dart'
Position,
paragraphNode;
import 'package:dartz/dartz.dart';
-import 'package:flutter/foundation.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:freezed_annotation/freezed_annotation.dart';
@@ -225,7 +226,7 @@ class DocumentBloc extends Bloc<DocumentEvent, DocumentState> {
final transaction = editorState.transaction;
transaction.insertNode([0], paragraphNode());
transaction.afterSelection = Selection.collapsed(
- Position(path: [0], offset: 0),
+ Position(path: [0]),
);
await editorState.apply(transaction);
}
@@ -277,10 +278,6 @@ class DocumentState with _$DocumentState {
factory DocumentState.initial() => const DocumentState(
isDeleted: false,
forceClose: false,
- isDocumentEmpty: null,
- userProfilePB: null,
- editorState: null,
- error: null,
isLoading: true,
isSyncing: false,
);
diff --git a/frontend/appflowy_flutter/lib/plugins/document/application/share_bloc.dart b/frontend/appflowy_flutter/lib/plugins/document/application/share_bloc.dart
index c58f6622f4..2a9f881073 100644
--- a/frontend/appflowy_flutter/lib/plugins/document/application/share_bloc.dart
+++ b/frontend/appflowy_flutter/lib/plugins/document/application/share_bloc.dart
@@ -11,9 +11,7 @@ import 'package:freezed_annotation/freezed_annotation.dart';
part 'share_bloc.freezed.dart';
class DocShareBloc extends Bloc<DocShareEvent, DocShareState> {
- DocShareBloc({
- required this.view,
- }) : super(const DocShareState.initial()) {
+ DocShareBloc({required this.view}) : super(const DocShareState.initial()) {
on<ShareMarkdown>(_onShareMarkdown);
}
diff --git a/frontend/appflowy_flutter/lib/plugins/document/document.dart b/frontend/appflowy_flutter/lib/plugins/document/document.dart
index 752cd0fdbe..c9cc4f2ef8 100644
--- a/frontend/appflowy_flutter/lib/plugins/document/document.dart
+++ b/frontend/appflowy_flutter/lib/plugins/document/document.dart
@@ -44,10 +44,8 @@ class DocumentPluginBuilder extends PluginBuilder {
class DocumentPlugin extends Plugin<int> {
DocumentPlugin({
- Key? key,
required ViewPB view,
required PluginType pluginType,
- bool listenOnViewChanged = false,
this.initialSelection,
}) : notifier = ViewPluginNotifier(view: view) {
_pluginType = pluginType;
@@ -76,7 +74,6 @@ class DocumentPlugin extends Plugin<int> {
class DocumentPluginWidgetBuilder extends PluginWidgetBuilder
with NavigationItem {
DocumentPluginWidgetBuilder({
- Key? key,
required this.notifier,
this.initialSelection,
});
diff --git a/frontend/appflowy_flutter/lib/plugins/document/document_page.dart b/frontend/appflowy_flutter/lib/plugins/document/document_page.dart
index 85ecb54c61..47ebcb5034 100644
--- a/frontend/appflowy_flutter/lib/plugins/document/document_page.dart
+++ b/frontend/appflowy_flutter/lib/plugins/document/document_page.dart
@@ -175,7 +175,6 @@ class _DocumentPageState extends State<DocumentPage> {
if (editorState != null && widget.view.id == state.action?.objectId) {
editorState.updateSelectionWithReason(
Selection.collapsed(Position(path: [path])),
- reason: SelectionUpdateReason.transaction,
);
}
}
diff --git a/frontend/appflowy_flutter/lib/plugins/document/presentation/banner.dart b/frontend/appflowy_flutter/lib/plugins/document/presentation/banner.dart
index a8cc1c06be..3936bf6968 100644
--- a/frontend/appflowy_flutter/lib/plugins/document/presentation/banner.dart
+++ b/frontend/appflowy_flutter/lib/plugins/document/presentation/banner.dart
@@ -7,14 +7,15 @@ import 'package:flutter/material.dart';
import 'package:appflowy/generated/locale_keys.g.dart';
class DocumentBanner extends StatelessWidget {
- final void Function() onRestore;
- final void Function() onDelete;
const DocumentBanner({
+ super.key,
required this.onRestore,
required this.onDelete,
- super.key,
});
+ final void Function() onRestore;
+ final void Function() onDelete;
+
@override
Widget build(BuildContext context) {
final colorScheme = Theme.of(context).colorScheme;
@@ -24,7 +25,6 @@ class DocumentBanner extends StatelessWidget {
width: double.infinity,
color: colorScheme.surfaceVariant,
child: FittedBox(
- alignment: Alignment.center,
fit: BoxFit.scaleDown,
child: Row(
children: [
diff --git a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_page.dart b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_page.dart
index 5ddadecec0..eb8ad38ef2 100644
--- a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_page.dart
+++ b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_page.dart
@@ -175,7 +175,7 @@ class _AppFlowyEditorPageState extends State<AppFlowyEditorPage> {
late final EditorScrollController editorScrollController;
- Future<bool> showSlashMenu(editorState) async => await customSlashCommand(
+ Future<bool> showSlashMenu(editorState) async => customSlashCommand(
slashMenuItems,
shouldInsertSlash: false,
style: styleCustomizer.selectionMenuStyleBuilder(),
@@ -216,7 +216,6 @@ class _AppFlowyEditorPageState extends State<AppFlowyEditorPage> {
WidgetsBinding.instance.addPostFrameCallback((_) {
widget.editorState.updateSelectionWithReason(
widget.initialSelection,
- reason: SelectionUpdateReason.transaction,
);
});
}
@@ -251,7 +250,6 @@ class _AppFlowyEditorPageState extends State<AppFlowyEditorPage> {
textDirection: textDirection,
child: AppFlowyEditor(
editorState: widget.editorState,
- editable: true,
editorScrollController: editorScrollController,
// setup the auto focus parameters
autoFocus: widget.autoFocus ?? autoFocus,
@@ -375,7 +373,7 @@ class _AppFlowyEditorPageState extends State<AppFlowyEditorPage> {
if (widget.editorState.document.isEmpty) {
return (
true,
- Selection.collapsed(Position(path: [0], offset: 0)),
+ Selection.collapsed(Position(path: [0])),
);
}
final nodes = widget.editorState.document.root.children
@@ -383,10 +381,7 @@ class _AppFlowyEditorPageState extends State<AppFlowyEditorPage> {
final isAllEmpty =
nodes.isNotEmpty && nodes.every((element) => element.delta!.isEmpty);
if (isAllEmpty) {
- return (
- true,
- Selection.collapsed(Position(path: nodes.first.path, offset: 0))
- );
+ return (true, Selection.collapsed(Position(path: nodes.first.path)));
}
return const (false, null);
}
diff --git a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/actions/block_action_add_button.dart b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/actions/block_action_add_button.dart
index 31c1f03857..70b5066c94 100644
--- a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/actions/block_action_add_button.dart
+++ b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/actions/block_action_add_button.dart
@@ -59,11 +59,11 @@ class BlockAddButton extends StatelessWidget {
transaction.insertNode(path, paragraphNode());
transaction.afterSelection = Selection.collapsed(
- Position(path: path, offset: 0),
+ Position(path: path),
);
} else {
transaction.afterSelection = Selection.collapsed(
- Position(path: node.path, offset: 0),
+ Position(path: node.path),
);
}
diff --git a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/actions/block_action_button.dart b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/actions/block_action_button.dart
index d2aae24512..e6a88bc4a8 100644
--- a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/actions/block_action_button.dart
+++ b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/actions/block_action_button.dart
@@ -20,7 +20,6 @@ class BlockActionButton extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Align(
- alignment: Alignment.center,
child: FlowyTooltip(
preferBelow: false,
richMessage: richMessage,
diff --git a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/actions/block_action_option_button.dart b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/actions/block_action_option_button.dart
index 5096c1c300..bc2a04e96d 100644
--- a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/actions/block_action_option_button.dart
+++ b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/actions/block_action_option_button.dart
@@ -98,7 +98,7 @@ class BlockOptionButton extends StatelessWidget {
endNode = endNode.children.last;
}
- final start = Position(path: startNode.path, offset: 0);
+ final start = Position(path: startNode.path);
final end = endNode.selectable?.end() ??
Position(
path: endNode.path,
diff --git a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/actions/option_action.dart b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/actions/option_action.dart
index 75fff9846c..9de7d16483 100644
--- a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/actions/option_action.dart
+++ b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/actions/option_action.dart
@@ -270,7 +270,6 @@ class ColorOptionAction extends PopoverActionCell {
selected: selectedColor,
border: Border.all(
color: Theme.of(context).colorScheme.onBackground,
- width: 1,
),
onTap: (option, index) async {
final transaction = editorState.transaction;
diff --git a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/actions/option_action_button.dart b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/actions/option_action_button.dart
index 4d15e4514c..bf8dfdde43 100644
--- a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/actions/option_action_button.dart
+++ b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/actions/option_action_button.dart
@@ -67,7 +67,7 @@ class OptionActionList extends StatelessWidget {
endNode = endNode.children.last;
}
- final start = Position(path: startNode.path, offset: 0);
+ final start = Position(path: startNode.path);
final end = endNode.selectable?.end() ??
Position(
path: endNode.path,
@@ -122,7 +122,6 @@ class OptionActionButton extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Align(
- alignment: Alignment.center,
child: MouseRegion(
cursor: SystemMouseCursors.grab,
child: IgnoreParentGestureWidget(
diff --git a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/base/built_in_page_widget.dart b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/base/built_in_page_widget.dart
index 00c7ad8bb4..037705b017 100644
--- a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/base/built_in_page_widget.dart
+++ b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/base/built_in_page_widget.dart
@@ -93,7 +93,6 @@ class _BuiltInPageWidgetState extends State<BuiltInPageWidget> {
child: SizedBox(
height: viewPB.pluginType == PluginType.calendar ? 700 : 400,
child: Column(
- mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
_buildMenu(context, viewPB),
@@ -188,10 +187,10 @@ enum _ActionType {
}
class _ActionWrapper extends ActionCell {
- final _ActionType inner;
-
_ActionWrapper(this.inner);
+ final _ActionType inner;
+
Widget? icon(Color iconColor) => null;
@override
diff --git a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/base/emoji_picker_button.dart b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/base/emoji_picker_button.dart
index cbad5317d5..48eb53c32f 100644
--- a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/base/emoji_picker_button.dart
+++ b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/base/emoji_picker_button.dart
@@ -35,7 +35,6 @@ class EmojiPickerButton extends StatelessWidget {
if (PlatformExtension.isDesktopOrWeb) {
return AppFlowyPopover(
controller: popoverController,
- triggerActions: PopoverTriggerFlags.click,
constraints: BoxConstraints.expand(
width: emojiPickerSize.width,
height: emojiPickerSize.height,
diff --git a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/callout/callout_block_component.dart b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/callout/callout_block_component.dart
index 1977469965..33f5151220 100644
--- a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/callout/callout_block_component.dart
+++ b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/callout/callout_block_component.dart
@@ -175,7 +175,6 @@ class _CalloutBlockComponentWidgetState
alignment: alignment,
child: Row(
crossAxisAlignment: CrossAxisAlignment.start,
- mainAxisAlignment: MainAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
textDirection: textDirection,
children: [
diff --git a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/code_block/code_block_component.dart b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/code_block/code_block_component.dart
index 081d87b1c1..f0e2039300 100644
--- a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/code_block/code_block_component.dart
+++ b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/code_block/code_block_component.dart
@@ -301,14 +301,9 @@ class _CodeBlockComponentWidgetState extends State<CodeBlockComponentWidget>
),
child: FlowyTextButton(
'${language?.capitalize() ?? 'Auto'} ',
- padding: const EdgeInsets.symmetric(
- horizontal: 8.0,
- vertical: 6.0,
- ),
constraints: const BoxConstraints(maxWidth: maxWidth),
fontColor: Theme.of(context).colorScheme.onBackground,
fillColor: Colors.transparent,
- mainAxisAlignment: MainAxisAlignment.start,
onPressed: () async {
if (PlatformExtension.isMobile) {
final language = await context.push<String>(
diff --git a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/code_block/code_block_shortcut_event.dart b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/code_block/code_block_shortcut_event.dart
index 15fe53297f..cea457bdd7 100644
--- a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/code_block/code_block_shortcut_event.dart
+++ b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/code_block/code_block_shortcut_event.dart
@@ -175,7 +175,7 @@ CommandShortcutEventHandler _insertNewParagraphNextToCodeBlockCommandHandler =
),
)
..afterSelection = Selection.collapsed(
- Position(path: selection.end.path.next, offset: 0),
+ Position(path: selection.end.path.next),
);
editorState.apply(transaction);
return KeyEventResult.handled;
diff --git a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/code_block/code_language_screen.dart b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/code_block/code_language_screen.dart
index 2d3cc543ca..d655a1d2bd 100644
--- a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/code_block/code_language_screen.dart
+++ b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/code_block/code_language_screen.dart
@@ -8,11 +8,9 @@ import 'package:flutter/material.dart';
import 'package:go_router/go_router.dart';
class MobileCodeLanguagePickerScreen extends StatelessWidget {
- static const routeName = '/code_language_picker';
+ const MobileCodeLanguagePickerScreen({super.key});
- const MobileCodeLanguagePickerScreen({
- super.key,
- });
+ static const routeName = '/code_language_picker';
@override
Widget build(BuildContext context) {
diff --git a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/copy_and_paste/custom_copy_command.dart b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/copy_and_paste/custom_copy_command.dart
index 26e70ec279..945505e926 100644
--- a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/copy_and_paste/custom_copy_command.dart
+++ b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/copy_and_paste/custom_copy_command.dart
@@ -43,7 +43,6 @@ CommandShortcutEventHandler _copyCommandHandler = (editorState) {
plainText: text,
html: html,
inAppJson: inAppJson,
- image: null,
),
);
}();
diff --git a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/copy_and_paste/editor_state_paste_node_extension.dart b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/copy_and_paste/editor_state_paste_node_extension.dart
index a925182a36..e6c5faeec7 100644
--- a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/copy_and_paste/editor_state_paste_node_extension.dart
+++ b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/copy_and_paste/editor_state_paste_node_extension.dart
@@ -59,7 +59,6 @@ extension PasteNodes on EditorState {
nodes.last.insertDelta(
delta.slice(selection.endIndex),
- insertAfter: true,
);
}
diff --git a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/database/database_view_block_component.dart b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/database/database_view_block_component.dart
index 13b9397505..d780a1260e 100644
--- a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/database/database_view_block_component.dart
+++ b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/database/database_view_block_component.dart
@@ -75,7 +75,6 @@ class _DatabaseBlockComponentWidgetState
return DatabaseViewWidget(
key: ValueKey(viewPB.id),
view: viewPB,
- shrinkWrap: true,
);
},
);
diff --git a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/database/inline_database_menu_item.dart b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/database/inline_database_menu_item.dart
index 60524ea95c..8328fee9b8 100644
--- a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/database/inline_database_menu_item.dart
+++ b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/database/inline_database_menu_item.dart
@@ -22,7 +22,6 @@ SelectionMenuItem inlineGridMenuItem(DocumentBloc documentBloc) =>
final parentViewId = documentBloc.view.id;
ViewBackendService.createView(
parentViewId: parentViewId,
- openAfterCreate: false,
name: LocaleKeys.menuAppHeader_defaultNewPageName.tr(),
layoutType: ViewLayoutPB.Grid,
).then(
diff --git a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/find_and_replace/find_and_replace_menu.dart b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/find_and_replace/find_and_replace_menu.dart
index cd85509179..12a1961446 100644
--- a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/find_and_replace/find_and_replace_menu.dart
+++ b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/find_and_replace/find_and_replace_menu.dart
@@ -31,7 +31,6 @@ class _FindAndReplaceMenuWidgetState extends State<FindAndReplaceMenuWidget> {
@override
Widget build(BuildContext context) {
return Column(
- mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Padding(
diff --git a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/font/customize_font_toolbar_item.dart b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/font/customize_font_toolbar_item.dart
index 3c7fae3aa0..c98f6ede38 100644
--- a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/font/customize_font_toolbar_item.dart
+++ b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/font/customize_font_toolbar_item.dart
@@ -34,7 +34,7 @@ final customizeFontToolbarItem = ToolbarItem(
Log.error('Failed to set font family: $e');
}
},
- onResetFont: () async => await editorState.formatDelta(selection, {
+ onResetFont: () async => editorState.formatDelta(selection, {
AppFlowyRichTextKeys.fontFamily: null,
}),
child: Padding(
diff --git a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/header/cover_editor.dart b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/header/cover_editor.dart
index fd8bb419f2..26b22e97ac 100644
--- a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/header/cover_editor.dart
+++ b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/header/cover_editor.dart
@@ -23,6 +23,13 @@ List<String> get builtInAssetImages => [
];
class ChangeCoverPopover extends StatefulWidget {
+ const ChangeCoverPopover({
+ super.key,
+ required this.editorState,
+ required this.node,
+ required this.onCoverChanged,
+ });
+
final EditorState editorState;
final Node node;
final Function(
@@ -30,13 +37,6 @@ class ChangeCoverPopover extends StatefulWidget {
String selection,
) onCoverChanged;
- const ChangeCoverPopover({
- super.key,
- required this.editorState,
- required this.onCoverChanged,
- required this.node,
- });
-
@override
State<ChangeCoverPopover> createState() => _ChangeCoverPopoverState();
}
@@ -293,10 +293,10 @@ class _ChangeCoverPopoverState extends State<ChangeCoverPopover> {
@visibleForTesting
class NewCustomCoverButton extends StatelessWidget {
- final VoidCallback onPressed;
-
const NewCustomCoverButton({super.key, required this.onPressed});
+ final VoidCallback onPressed;
+
@override
Widget build(BuildContext context) {
return DecoratedBox(
@@ -319,22 +319,16 @@ class NewCustomCoverButton extends StatelessWidget {
}
class ColorOption {
- final String colorHex;
-
- final String name;
const ColorOption({
required this.colorHex,
required this.name,
});
+
+ final String colorHex;
+ final String name;
}
class CoverColorPicker extends StatefulWidget {
- final String? selectedBackgroundColorHex;
-
- final Color pickerBackgroundColor;
- final Color pickerItemHoverColor;
- final void Function(String color) onSubmittedBackgroundColorHex;
- final List<ColorOption> backgroundColorOptions;
const CoverColorPicker({
super.key,
this.selectedBackgroundColorHex,
@@ -344,6 +338,12 @@ class CoverColorPicker extends StatefulWidget {
required this.onSubmittedBackgroundColorHex,
});
+ final String? selectedBackgroundColorHex;
+ final Color pickerBackgroundColor;
+ final List<ColorOption> backgroundColorOptions;
+ final Color pickerItemHoverColor;
+ final void Function(String color) onSubmittedBackgroundColorHex;
+
@override
State<CoverColorPicker> createState() => _CoverColorPickerState();
}
@@ -516,18 +516,19 @@ class _ImageGridItemState extends State<ImageGridItem> {
@visibleForTesting
class ColorItem extends StatelessWidget {
- final ColorOption option;
- final bool isChecked;
- final Color hoverColor;
- final void Function(String) onTap;
const ColorItem({
+ super.key,
required this.option,
required this.isChecked,
required this.hoverColor,
required this.onTap,
- super.key,
});
+ final ColorOption option;
+ final bool isChecked;
+ final Color hoverColor;
+ final void Function(String) onTap;
+
@override
Widget build(BuildContext context) {
return Padding(
diff --git a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/header/cover_editor_bloc.dart b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/header/cover_editor_bloc.dart
index c6c6fcc6e3..58f08fca68 100644
--- a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/header/cover_editor_bloc.dart
+++ b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/header/cover_editor_bloc.dart
@@ -12,20 +12,22 @@ part 'cover_editor_bloc.freezed.dart';
class ChangeCoverPopoverBloc
extends Bloc<ChangeCoverPopoverEvent, ChangeCoverPopoverState> {
- final EditorState editorState;
- final Node node;
- late final SharedPreferences _prefs;
- final _initCompleter = Completer<void>();
-
- ChangeCoverPopoverBloc({
- required this.editorState,
- required this.node,
- }) : super(const ChangeCoverPopoverState.initial()) {
+ ChangeCoverPopoverBloc({required this.editorState, required this.node})
+ : super(const ChangeCoverPopoverState.initial()) {
SharedPreferences.getInstance().then((prefs) {
_prefs = prefs;
_initCompleter.complete();
});
+ _dispatch();
+ }
+
+ final EditorState editorState;
+ final Node node;
+ final _initCompleter = Completer<void>();
+ late final SharedPreferences _prefs;
+
+ void _dispatch() {
on<ChangeCoverPopoverEvent>((event, emit) async {
await event.map(
fetchPickedImagePaths:
diff --git a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/header/custom_cover_picker.dart b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/header/custom_cover_picker.dart
index d358330233..85767a5220 100644
--- a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/header/custom_cover_picker.dart
+++ b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/header/custom_cover_picker.dart
@@ -15,15 +15,15 @@ import 'package:flowy_infra_ui/widget/rounded_button.dart';
import 'package:flutter/material.dart';
class CoverImagePicker extends StatefulWidget {
- final VoidCallback onBackPressed;
- final Function(List<String> paths) onFileSubmit;
-
const CoverImagePicker({
super.key,
required this.onBackPressed,
required this.onFileSubmit,
});
+ final VoidCallback onBackPressed;
+ final Function(List<String> paths) onFileSubmit;
+
@override
State<CoverImagePicker> createState() => _CoverImagePickerState();
}
@@ -95,12 +95,9 @@ class _CoverImagePickerState extends State<CoverImagePicker> {
}
class NetworkImageUrlInput extends StatefulWidget {
- final void Function(String color) onAdd;
+ const NetworkImageUrlInput({super.key, required this.onAdd});
- const NetworkImageUrlInput({
- super.key,
- required this.onAdd,
- });
+ final void Function(String color) onAdd;
@override
State<NetworkImageUrlInput> createState() => _NetworkImageUrlInputState();
@@ -133,7 +130,6 @@ class _NetworkImageUrlInputState extends State<NetworkImageUrlInput> {
width: 5,
),
Expanded(
- flex: 1,
child: RoundedTextButton(
onPressed: () {
urlController.text.isNotEmpty
@@ -155,15 +151,15 @@ class _NetworkImageUrlInputState extends State<NetworkImageUrlInput> {
}
class ImagePickerActionButtons extends StatelessWidget {
- final VoidCallback onBackPressed;
- final VoidCallback onSave;
-
const ImagePickerActionButtons({
super.key,
required this.onBackPressed,
required this.onSave,
});
+ final VoidCallback onBackPressed;
+ final VoidCallback onSave;
+
@override
Widget build(BuildContext context) {
return Row(
@@ -190,10 +186,10 @@ class ImagePickerActionButtons extends StatelessWidget {
}
class CoverImagePreviewWidget extends StatefulWidget {
- final dynamic state;
-
const CoverImagePreviewWidget({super.key, required this.state});
+ final dynamic state;
+
@override
State<CoverImagePreviewWidget> createState() =>
_CoverImagePreviewWidgetState();
@@ -208,7 +204,6 @@ class _CoverImagePreviewWidgetState extends State<CoverImagePreviewWidget> {
border: Border.fromBorderSide(
BorderSide(
color: Theme.of(context).colorScheme.primary,
- width: 1,
),
),
),
@@ -320,9 +315,9 @@ class _CoverImagePreviewWidgetState extends State<CoverImagePreviewWidget> {
: (widget.state is NetworkImagePicked)
? widget.state.successOrFail.fold(
(l) => _buildImageDeleteButton(context),
- (r) => Container(),
+ (r) => const SizedBox.shrink(),
)
- : Container(),
+ : const SizedBox.shrink(),
],
);
}
diff --git a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/header/custom_cover_picker_bloc.dart b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/header/custom_cover_picker_bloc.dart
index 94659d3e04..72147e49c2 100644
--- a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/header/custom_cover_picker_bloc.dart
+++ b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/header/custom_cover_picker_bloc.dart
@@ -1,17 +1,17 @@
import 'dart:io';
+
import 'package:appflowy/generated/locale_keys.g.dart';
import 'package:appflowy/startup/startup.dart';
import 'package:appflowy/workspace/application/settings/prelude.dart';
-import 'package:easy_localization/easy_localization.dart';
-
import 'package:appflowy_backend/protobuf/flowy-error/errors.pb.dart';
+import 'package:dartz/dartz.dart';
+import 'package:easy_localization/easy_localization.dart';
import 'package:flowy_infra/file_picker/file_picker_service.dart';
-import 'package:freezed_annotation/freezed_annotation.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
-import 'package:dartz/dartz.dart';
+import 'package:freezed_annotation/freezed_annotation.dart';
import 'package:http/http.dart' as http;
-import 'package:shared_preferences/shared_preferences.dart';
import 'package:path/path.dart' as p;
+import 'package:shared_preferences/shared_preferences.dart';
import 'cover_editor.dart';
@@ -19,9 +19,13 @@ part 'custom_cover_picker_bloc.freezed.dart';
class CoverImagePickerBloc
extends Bloc<CoverImagePickerEvent, CoverImagePickerState> {
+ CoverImagePickerBloc() : super(const CoverImagePickerState.initial()) {
+ _dispatch();
+ }
+
static const allowedExtensions = ['jpg', 'png', 'jpeg'];
- CoverImagePickerBloc() : super(const CoverImagePickerState.initial()) {
+ void _dispatch() {
on<CoverImagePickerEvent>(
(event, emit) async {
await event.map(
@@ -119,7 +123,6 @@ class CoverImagePickerBloc
Future<String?> _pickImages() async {
final result = await getIt<FilePickerService>().pickFiles(
dialogTitle: LocaleKeys.document_plugins_cover_addLocalImage.tr(),
- allowMultiple: false,
type: FileType.image,
allowedExtensions: allowedExtensions,
);
diff --git a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/header/document_header_node_widget.dart b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/header/document_header_node_widget.dart
index e207a685a7..c3d8ab950b 100644
--- a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/header/document_header_node_widget.dart
+++ b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/header/document_header_node_widget.dart
@@ -196,22 +196,22 @@ class _DocumentHeaderNodeWidgetState extends State<DocumentHeaderNodeWidget> {
@visibleForTesting
class DocumentHeaderToolbar extends StatefulWidget {
- final Node node;
- final EditorState editorState;
- final bool hasCover;
- final bool hasIcon;
- final Future<void> Function({(CoverType, String?)? cover, String? icon})
- onCoverChanged;
-
const DocumentHeaderToolbar({
+ super.key,
required this.node,
required this.editorState,
required this.hasCover,
required this.hasIcon,
required this.onCoverChanged,
- super.key,
});
+ final Node node;
+ final EditorState editorState;
+ final bool hasCover;
+ final bool hasIcon;
+ final Future<void> Function({(CoverType, String?)? cover, String? icon})
+ onCoverChanged;
+
@override
State<DocumentHeaderToolbar> createState() => _DocumentHeaderToolbarState();
}
@@ -364,21 +364,21 @@ class _DocumentHeaderToolbarState extends State<DocumentHeaderToolbar> {
@visibleForTesting
class DocumentCover extends StatefulWidget {
- final Node node;
- final EditorState editorState;
- final CoverType coverType;
- final String? coverDetails;
- final Future<void> Function(CoverType type, String? details) onCoverChanged;
-
const DocumentCover({
- required this.editorState,
+ super.key,
required this.node,
+ required this.editorState,
required this.coverType,
- required this.onCoverChanged,
this.coverDetails,
- super.key,
+ required this.onCoverChanged,
});
+ final Node node;
+ final EditorState editorState;
+ final CoverType coverType;
+ final String? coverDetails;
+ final Future<void> Function(CoverType type, String? details) onCoverChanged;
+
@override
State<DocumentCover> createState() => DocumentCoverState();
}
@@ -630,9 +630,10 @@ class DocumentCoverState extends State<DocumentCover> {
@visibleForTesting
class DeleteCoverButton extends StatelessWidget {
- final VoidCallback onTap;
const DeleteCoverButton({required this.onTap, super.key});
+ final VoidCallback onTap;
+
@override
Widget build(BuildContext context) {
final fillColor = PlatformExtension.isDesktopOrWeb
@@ -657,19 +658,19 @@ class DeleteCoverButton extends StatelessWidget {
@visibleForTesting
class DocumentIcon extends StatefulWidget {
- final Node node;
- final EditorState editorState;
- final String icon;
- final Future<void> Function(String icon) onIconChanged;
-
const DocumentIcon({
+ super.key,
required this.node,
required this.editorState,
required this.icon,
required this.onIconChanged,
- super.key,
});
+ final Node node;
+ final EditorState editorState;
+ final String icon;
+ final Future<void> Function(String icon) onIconChanged;
+
@override
State<DocumentIcon> createState() => _DocumentIconState();
}
diff --git a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/image/custom_image_block_component.dart b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/image/custom_image_block_component.dart
index be1ad90039..dc87fc7542 100644
--- a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/image/custom_image_block_component.dart
+++ b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/image/custom_image_block_component.dart
@@ -290,7 +290,7 @@ class CustomImageBlockComponentState extends State<CustomImageBlockComponent>
}
@override
- Position start() => Position(path: widget.node.path, offset: 0);
+ Position start() => Position(path: widget.node.path);
@override
Position end() => Position(path: widget.node.path, offset: 1);
diff --git a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/image/embed_image_url_widget.dart b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/image/embed_image_url_widget.dart
index 2ef9227fa1..34400597ac 100644
--- a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/image/embed_image_url_widget.dart
+++ b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/image/embed_image_url_widget.dart
@@ -23,7 +23,6 @@ class _EmbedImageUrlWidgetState extends State<EmbedImageUrlWidget> {
return Column(
children: [
FlowyTextField(
- autoFocus: true,
hintText: LocaleKeys.document_imageBlock_embedLink_placeholder.tr(),
onChanged: (value) => inputText = value,
onEditingComplete: () => widget.onSubmit(inputText),
diff --git a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/image/image_picker_screen.dart b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/image/image_picker_screen.dart
index 0aa10412bf..5ea7a56c40 100644
--- a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/image/image_picker_screen.dart
+++ b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/image/image_picker_screen.dart
@@ -2,11 +2,9 @@ import 'package:appflowy/plugins/document/presentation/editor_plugins/image/flow
import 'package:flutter/material.dart';
class MobileImagePickerScreen extends StatelessWidget {
- static const routeName = '/image_picker';
+ const MobileImagePickerScreen({super.key});
- const MobileImagePickerScreen({
- super.key,
- });
+ static const routeName = '/image_picker';
@override
Widget build(BuildContext context) {
diff --git a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/image/image_selection_menu.dart b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/image/image_selection_menu.dart
index 261f00af89..4d57879451 100644
--- a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/image/image_selection_menu.dart
+++ b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/image/image_selection_menu.dart
@@ -56,7 +56,6 @@ extension InsertImage on EditorState {
transaction.afterSelection = Selection.collapsed(
Position(
path: node.path.next,
- offset: 0,
),
);
transaction.selectionExtraInfo = {};
diff --git a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/image/open_ai_image_widget.dart b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/image/open_ai_image_widget.dart
index 37a2a06946..775b6f273d 100644
--- a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/image/open_ai_image_widget.dart
+++ b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/image/open_ai_image_widget.dart
@@ -35,7 +35,6 @@ class _OpenAIImageWidgetState extends State<OpenAIImageWidget> {
children: [
Expanded(
child: FlowyTextField(
- autoFocus: true,
hintText: LocaleKeys.document_imageBlock_ai_placeholder.tr(),
onChanged: (value) => query = value,
onEditingComplete: _search,
diff --git a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/image/resizeable_image.dart b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/image/resizeable_image.dart
index 2de8449d38..7b04ca3119 100644
--- a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/image/resizeable_image.dart
+++ b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/image/resizeable_image.dart
@@ -168,7 +168,7 @@ class _ResizableImageState extends State<ResizableImage> {
padding: const EdgeInsets.only(top: 8.0, bottom: 8.0),
decoration: BoxDecoration(
borderRadius: const BorderRadius.all(Radius.circular(4.0)),
- border: Border.all(width: 1, color: Colors.black),
+ border: Border.all(),
),
child: Column(
mainAxisSize: MainAxisSize.min,
@@ -206,7 +206,7 @@ class _ResizableImageState extends State<ResizableImage> {
},
onHorizontalDragUpdate: (details) {
if (onUpdate != null) {
- var offset = (details.globalPosition.dx - initialOffset);
+ var offset = details.globalPosition.dx - initialOffset;
if (widget.alignment == Alignment.center) {
offset *= 2.0;
}
@@ -232,7 +232,7 @@ class _ResizableImageState extends State<ResizableImage> {
borderRadius: const BorderRadius.all(
Radius.circular(5.0),
),
- border: Border.all(width: 1, color: Colors.white),
+ border: Border.all(color: Colors.white),
),
),
)
diff --git a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/image/stability_ai_image_widget.dart b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/image/stability_ai_image_widget.dart
index d0d589d206..d1764a76ac 100644
--- a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/image/stability_ai_image_widget.dart
+++ b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/image/stability_ai_image_widget.dart
@@ -40,7 +40,6 @@ class _StabilityAIImageWidgetState extends State<StabilityAIImageWidget> {
children: [
Expanded(
child: FlowyTextField(
- autoFocus: true,
hintText: LocaleKeys
.document_imageBlock_stability_ai_placeholder
.tr(),
diff --git a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/image/unsplash_image_widget.dart b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/image/unsplash_image_widget.dart
index 93157eae33..a9ab87b6cb 100644
--- a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/image/unsplash_image_widget.dart
+++ b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/image/unsplash_image_widget.dart
@@ -57,7 +57,6 @@ class _UnsplashImageWidgetState extends State<UnsplashImageWidget> {
children: [
Expanded(
child: FlowyTextField(
- autoFocus: true,
hintText: LocaleKeys.document_imageBlock_searchForAnImage.tr(),
onChanged: (value) => query = value,
onEditingComplete: _search,
diff --git a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/image/upload_image_file_widget.dart b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/image/upload_image_file_widget.dart
index 71c95ac445..7f6324531c 100644
--- a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/image/upload_image_file_widget.dart
+++ b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/image/upload_image_file_widget.dart
@@ -40,7 +40,6 @@ class UploadImageFileWidget extends StatelessWidget {
// on desktop, the users can pick a image file from folder
final result = await getIt<FilePickerService>().pickFiles(
dialogTitle: '',
- allowMultiple: false,
type: FileType.image,
allowedExtensions: allowedExtensions,
);
diff --git a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/infra/svg.dart b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/infra/svg.dart
index 06b7c9cd47..7c5f0b4548 100644
--- a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/infra/svg.dart
+++ b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/infra/svg.dart
@@ -50,6 +50,6 @@ class Svg extends StatelessWidget {
height: height ?? _defaultHeight,
);
}
- return Container();
+ return const SizedBox.shrink();
}
}
diff --git a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/math_equation/math_equation_block_component.dart b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/math_equation/math_equation_block_component.dart
index a3071ccef5..de0438a056 100644
--- a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/math_equation/math_equation_block_component.dart
+++ b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/math_equation/math_equation_block_component.dart
@@ -182,7 +182,6 @@ class MathEquationBlockComponentWidgetState
child: Math.tex(
formula,
textStyle: const TextStyle(fontSize: 20),
- mathStyle: MathStyle.display,
),
);
}
diff --git a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/mention/mention_date_block.dart b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/mention/mention_date_block.dart
index ebfce9c443..6b10756b9e 100644
--- a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/mention/mention_date_block.dart
+++ b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/mention/mention_date_block.dart
@@ -104,7 +104,6 @@ class _MentionDateBlockState extends State<MentionDateBlock> {
includeTime: _includeTime,
dateFormat: appearance.dateFormat,
timeFormat: appearance.timeFormat,
- enableRanges: true,
selectedReminderOption: widget.reminderOption,
onIncludeTimeChanged: (includeTime) {
_includeTime = includeTime;
@@ -311,7 +310,6 @@ class _MentionDateBlockState extends State<MentionDateBlock> {
// the cursor with the new block render
widget.editorState.updateSelectionWithReason(
widget.editorState.selection,
- reason: SelectionUpdateReason.transaction,
);
}
diff --git a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/mention/mention_page_block.dart b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/mention/mention_page_block.dart
index 120901324a..8d6457c650 100644
--- a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/mention/mention_page_block.dart
+++ b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/mention/mention_page_block.dart
@@ -7,8 +7,7 @@ import 'package:appflowy/workspace/application/view/prelude.dart';
import 'package:appflowy/workspace/application/view/view_ext.dart';
import 'package:appflowy_backend/log.dart';
import 'package:appflowy_backend/protobuf/flowy-folder/protobuf.dart';
-import 'package:appflowy_editor/appflowy_editor.dart'
- show EditorState, SelectionUpdateReason;
+import 'package:appflowy_editor/appflowy_editor.dart' show EditorState;
import 'package:collection/collection.dart';
import 'package:flowy_infra_ui/flowy_infra_ui.dart';
import 'package:flowy_infra_ui/style_widget/hover.dart';
@@ -151,7 +150,6 @@ class _MentionPageBlockState extends State<MentionPageBlock> {
WidgetsBinding.instance.addPostFrameCallback((timeStamp) {
editorState.updateSelectionWithReason(
editorState.selection,
- reason: SelectionUpdateReason.transaction,
);
});
}
diff --git a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/mobile_toolbar_item/mobile_add_block_toolbar_item.dart b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/mobile_toolbar_item/mobile_add_block_toolbar_item.dart
index 2e5140f9b2..30d344b04a 100644
--- a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/mobile_toolbar_item/mobile_add_block_toolbar_item.dart
+++ b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/mobile_toolbar_item/mobile_add_block_toolbar_item.dart
@@ -247,7 +247,7 @@ extension EditorStateAddBlock on EditorState {
transaction
..insertNode(path, insertedNode)
..afterSelection = Selection.collapsed(
- Position(path: path, offset: 0),
+ Position(path: path),
);
} else {
final path = node.path;
@@ -256,7 +256,7 @@ extension EditorStateAddBlock on EditorState {
..insertNode(path, insertedNode)
..deleteNode(node)
..afterSelection = Selection.collapsed(
- Position(path: path, offset: 0),
+ Position(path: path),
)
..selectionExtraInfo = null;
}
diff --git a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/mobile_toolbar_item/mobile_block_settings_screen.dart b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/mobile_toolbar_item/mobile_block_settings_screen.dart
index 1973076151..293c5aefd8 100644
--- a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/mobile_toolbar_item/mobile_block_settings_screen.dart
+++ b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/mobile_toolbar_item/mobile_block_settings_screen.dart
@@ -51,19 +51,16 @@ enum MobileBlockActionType {
}
class MobileBlockSettingsScreen extends StatelessWidget {
+ const MobileBlockSettingsScreen({super.key, required this.actions});
+
+ final List<MobileBlockActionType> actions;
+
static const routeName = '/block_settings';
// the action string comes from the enum MobileBlockActionType
// example: MobileBlockActionType.delete.actionString, MobileBlockActionType.duplicate.actionString, etc.
static const supportedActions = 'actions';
- const MobileBlockSettingsScreen({
- super.key,
- required this.actions,
- });
-
- final List<MobileBlockActionType> actions;
-
@override
Widget build(BuildContext context) {
return Scaffold(
diff --git a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/mobile_toolbar_item/mobile_text_decoration_item.dart b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/mobile_toolbar_item/mobile_text_decoration_item.dart
index 2070edecb7..dddda0758d 100644
--- a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/mobile_toolbar_item/mobile_text_decoration_item.dart
+++ b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/mobile_toolbar_item/mobile_text_decoration_item.dart
@@ -135,7 +135,7 @@ class _TextDecorationMenuState extends State<_TextDecorationMenu> {
.getTextInSelection(
widget.selection,
)
- .join('');
+ .join();
final href =
editorState.getDeltaAttributeValueInSelection<String>(
AppFlowyRichTextKeys.href,
diff --git a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/mobile_toolbar_item/mobile_text_decoration_item_v2.dart b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/mobile_toolbar_item/mobile_text_decoration_item_v2.dart
index 2070edecb7..dddda0758d 100644
--- a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/mobile_toolbar_item/mobile_text_decoration_item_v2.dart
+++ b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/mobile_toolbar_item/mobile_text_decoration_item_v2.dart
@@ -135,7 +135,7 @@ class _TextDecorationMenuState extends State<_TextDecorationMenu> {
.getTextInSelection(
widget.selection,
)
- .join('');
+ .join();
final href =
editorState.getDeltaAttributeValueInSelection<String>(
AppFlowyRichTextKeys.href,
diff --git a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/mobile_toolbar_v3/_block_items.dart b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/mobile_toolbar_v3/_block_items.dart
index ddebcae99e..cff0ac8beb 100644
--- a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/mobile_toolbar_v3/_block_items.dart
+++ b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/mobile_toolbar_v3/_block_items.dart
@@ -114,8 +114,6 @@ class BlockItems extends StatelessWidget {
size: const Size(62, 54),
enableTopLeftRadius: false,
enableBottomLeftRadius: false,
- enableTopRightRadius: true,
- enableBottomRightRadius: true,
showDownArrow: true,
onTap: _onLinkItemTap,
backgroundColor: theme.toolbarMenuItemBackgroundColor,
@@ -154,7 +152,7 @@ class BlockItems extends StatelessWidget {
.getTextInSelection(
selection,
)
- .join('');
+ .join();
final href = editorState.getDeltaAttributeValueInSelection<String>(
AppFlowyRichTextKeys.href,
selection,
diff --git a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/mobile_toolbar_v3/_heading_and_text_items.dart b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/mobile_toolbar_v3/_heading_and_text_items.dart
index fcd0198799..0a627f75c5 100644
--- a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/mobile_toolbar_v3/_heading_and_text_items.dart
+++ b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/mobile_toolbar_v3/_heading_and_text_items.dart
@@ -72,7 +72,7 @@ class _HeadingOrTextItem extends StatelessWidget {
);
return MobileToolbarMenuItemWrapper(
size: const Size(76, 52),
- onTap: () async => await _convert(isSelected),
+ onTap: () async => _convert(isSelected),
icon: icon,
isSelected: isSelected,
iconPadding: padding,
diff --git a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/mobile_toolbar_v3/_menu_item.dart b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/mobile_toolbar_v3/_menu_item.dart
index 0056756d1a..156f743b12 100644
--- a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/mobile_toolbar_v3/_menu_item.dart
+++ b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/mobile_toolbar_v3/_menu_item.dart
@@ -62,7 +62,6 @@ class PopupMenuWrapper extends StatelessWidget {
color: theme.toolbarShadowColor,
blurRadius: 20,
offset: const Offset(0, 10),
- spreadRadius: 0,
),
],
),
diff --git a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/mobile_toolbar_v3/_toolbar_theme.dart b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/mobile_toolbar_v3/_toolbar_theme.dart
index 6042bd6695..6bc3d401af 100644
--- a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/mobile_toolbar_v3/_toolbar_theme.dart
+++ b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/mobile_toolbar_v3/_toolbar_theme.dart
@@ -3,6 +3,41 @@
import 'package:flutter/material.dart';
class ToolbarColorExtension extends ThemeExtension<ToolbarColorExtension> {
+ factory ToolbarColorExtension.light() => const ToolbarColorExtension(
+ toolbarBackgroundColor: Color(0xFFF3F3F8),
+ toolbarItemIconColor: Color(0xFF1F2329),
+ toolbarItemIconDisabledColor: Color(0xFF999BA0),
+ toolbarItemIconSelectedColor: Color(0x1F232914),
+ toolbarItemSelectedBackgroundColor: Color(0x1F232914),
+ toolbarMenuBackgroundColor: Color(0xFFFFFFFF),
+ toolbarMenuItemBackgroundColor: Color(0xFFF2F2F7),
+ toolbarMenuItemSelectedBackgroundColor: Color(0xFF00BCF0),
+ toolbarMenuIconColor: Color(0xFF1F2329),
+ toolbarMenuIconDisabledColor: Color(0xFF999BA0),
+ toolbarMenuIconSelectedColor: Color(0xFFFFFFFF),
+ toolbarShadowColor: Color(0x2D000000),
+ );
+
+ factory ToolbarColorExtension.dark() => const ToolbarColorExtension(
+ toolbarBackgroundColor: Color(0xFF1F2329),
+ toolbarItemIconColor: Color(0xFFF3F3F8),
+ toolbarItemIconDisabledColor: Color(0xFF55565B),
+ toolbarItemIconSelectedColor: Color(0xFF00BCF0),
+ toolbarItemSelectedBackgroundColor: Color(0xFF3A3D43),
+ toolbarMenuBackgroundColor: Color(0xFF23262B),
+ toolbarMenuItemBackgroundColor: Color(0xFF2D3036),
+ toolbarMenuItemSelectedBackgroundColor: Color(0xFF00BCF0),
+ toolbarMenuIconColor: Color(0xFFF3F3F8),
+ toolbarMenuIconDisabledColor: Color(0xFF55565B),
+ toolbarMenuIconSelectedColor: Color(0xFF1F2329),
+ toolbarShadowColor: Color.fromARGB(80, 112, 112, 112),
+ );
+
+ factory ToolbarColorExtension.fromBrightness(Brightness brightness) =>
+ brightness == Brightness.light
+ ? ToolbarColorExtension.light()
+ : ToolbarColorExtension.dark();
+
const ToolbarColorExtension({
required this.toolbarBackgroundColor,
required this.toolbarItemIconColor,
@@ -34,50 +69,6 @@ class ToolbarColorExtension extends ThemeExtension<ToolbarColorExtension> {
final Color toolbarShadowColor;
- factory ToolbarColorExtension.fromBrightness(Brightness brightness) {
- return brightness == Brightness.light
- ? ToolbarColorExtension.light()
- : ToolbarColorExtension.dark();
- }
-
- factory ToolbarColorExtension.light() {
- return const ToolbarColorExtension(
- toolbarBackgroundColor: Color(0xFFF3F3F8),
- toolbarItemIconColor: Color(0xFF1F2329),
- toolbarItemIconDisabledColor: Color(0xFF999BA0),
- toolbarItemIconSelectedColor: Color(0x1F232914),
- toolbarItemSelectedBackgroundColor: Color(0x1F232914),
- toolbarMenuBackgroundColor: Color(0xFFFFFFFF),
- toolbarMenuItemBackgroundColor: Color(0xFFF2F2F7),
- toolbarMenuItemSelectedBackgroundColor: Color(0xFF00BCF0),
- toolbarMenuIconColor: Color(0xFF1F2329),
- toolbarMenuIconDisabledColor: Color(0xFF999BA0),
- toolbarMenuIconSelectedColor: Color(0xFFFFFFFF),
- toolbarShadowColor: Color(0x2D000000),
- );
- }
- factory ToolbarColorExtension.dark() {
- return const ToolbarColorExtension(
- toolbarBackgroundColor: Color(0xFF1F2329),
- toolbarItemIconColor: Color(0xFFF3F3F8),
- toolbarItemIconDisabledColor: Color(0xFF55565B),
- toolbarItemIconSelectedColor: Color(0xFF00BCF0),
- toolbarItemSelectedBackgroundColor: Color(0xFF3A3D43),
- toolbarMenuBackgroundColor: Color(0xFF23262B),
- toolbarMenuItemBackgroundColor: Color(0xFF2D3036),
- toolbarMenuItemSelectedBackgroundColor: Color(0xFF00BCF0),
- toolbarMenuIconColor: Color(0xFFF3F3F8),
- toolbarMenuIconDisabledColor: Color(0xFF55565B),
- toolbarMenuIconSelectedColor: Color(0xFF1F2329),
- toolbarShadowColor: Color.fromARGB(
- 80,
- 112,
- 112,
- 112,
- ),
- );
- }
-
static ToolbarColorExtension of(BuildContext context) {
return Theme.of(context).extension<ToolbarColorExtension>()!;
}
diff --git a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/mobile_toolbar_v3/add_block_toolbar_item.dart b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/mobile_toolbar_v3/add_block_toolbar_item.dart
index ef775f0d05..e746ee88a8 100644
--- a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/mobile_toolbar_v3/add_block_toolbar_item.dart
+++ b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/mobile_toolbar_v3/add_block_toolbar_item.dart
@@ -347,7 +347,7 @@ extension on EditorState {
node,
);
transaction.afterSelection = Selection.collapsed(
- Position(path: path, offset: 0),
+ Position(path: path),
);
transaction.selectionExtraInfo = {};
await apply(transaction);
diff --git a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/mobile_toolbar_v3/appflowy_mobile_toolbar.dart b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/mobile_toolbar_v3/appflowy_mobile_toolbar.dart
index b65008a231..20bd1d0a15 100644
--- a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/mobile_toolbar_v3/appflowy_mobile_toolbar.dart
+++ b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/mobile_toolbar_v3/appflowy_mobile_toolbar.dart
@@ -289,7 +289,6 @@ class _MobileToolbarState extends State<_MobileToolbar>
color: Color(0x0F181818),
blurRadius: 40,
offset: Offset(0, -4),
- spreadRadius: 0,
),
],
),
diff --git a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/mobile_toolbar_v3/biuc_toolbar_item.dart b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/mobile_toolbar_v3/biuc_toolbar_item.dart
index d50d57aa60..6072feed88 100644
--- a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/mobile_toolbar_v3/biuc_toolbar_item.dart
+++ b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/mobile_toolbar_v3/biuc_toolbar_item.dart
@@ -10,7 +10,7 @@ final boldToolbarItem = AppFlowyMobileToolbarItem(
AppFlowyRichTextKeys.bold,
),
icon: FlowySvgs.m_toolbar_bold_s,
- onTap: () async => await editorState.toggleAttribute(
+ onTap: () async => editorState.toggleAttribute(
AppFlowyRichTextKeys.bold,
selectionExtraInfo: {
selectionExtraInfoDisableFloatingToolbar: true,
@@ -28,7 +28,7 @@ final italicToolbarItem = AppFlowyMobileToolbarItem(
AppFlowyRichTextKeys.italic,
),
icon: FlowySvgs.m_toolbar_italic_s,
- onTap: () async => await editorState.toggleAttribute(
+ onTap: () async => editorState.toggleAttribute(
AppFlowyRichTextKeys.italic,
selectionExtraInfo: {
selectionExtraInfoDisableFloatingToolbar: true,
@@ -45,7 +45,7 @@ final underlineToolbarItem = AppFlowyMobileToolbarItem(
AppFlowyRichTextKeys.underline,
),
icon: FlowySvgs.m_toolbar_underline_s,
- onTap: () async => await editorState.toggleAttribute(
+ onTap: () async => editorState.toggleAttribute(
AppFlowyRichTextKeys.underline,
selectionExtraInfo: {
selectionExtraInfoDisableFloatingToolbar: true,
diff --git a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/openai/widgets/auto_completion_node_widget.dart b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/openai/widgets/auto_completion_node_widget.dart
index e9d87a9d34..b7d4bef2b2 100644
--- a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/openai/widgets/auto_completion_node_widget.dart
+++ b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/openai/widgets/auto_completion_node_widget.dart
@@ -173,7 +173,7 @@ class _AutoCompletionBlockComponentState
focusNode: textFieldFocusNode,
autoFocus: false,
hintTextConstraints: const BoxConstraints(
- maxHeight: double.infinity,
+
),
);
}
@@ -183,8 +183,6 @@ class _AutoCompletionBlockComponentState
await editorState.apply(
transaction,
options: const ApplyOptions(
- // disable undo/redo
- recordRedo: false,
recordUndo: false,
),
);
@@ -229,7 +227,6 @@ class _AutoCompletionBlockComponentState
final text = response.choices.first.text;
await textRobot.autoInsertText(
text,
- inputType: TextRobotInputType.word,
delay: Duration.zero,
);
}
@@ -319,7 +316,6 @@ class _AutoCompletionBlockComponentState
final text = response.choices.first.text;
await textRobot.autoInsertText(
text,
- inputType: TextRobotInputType.word,
delay: Duration.zero,
);
}
diff --git a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/openai/widgets/loading.dart b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/openai/widgets/loading.dart
index 34c53d4ebc..536d371816 100644
--- a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/openai/widgets/loading.dart
+++ b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/openai/widgets/loading.dart
@@ -6,7 +6,7 @@ class Loading {
late BuildContext loadingContext;
final BuildContext context;
- Future<void> start() async => await showDialog<void>(
+ Future<void> start() async => showDialog<void>(
context: context,
barrierDismissible: false,
builder: (BuildContext context) {
@@ -33,13 +33,13 @@ class BarrierDialog {
late BuildContext loadingContext;
final BuildContext context;
- Future<void> show() async => await showDialog<void>(
+ Future<void> show() async => showDialog<void>(
context: context,
barrierDismissible: false,
barrierColor: Colors.transparent,
builder: (BuildContext context) {
loadingContext = context;
- return Container();
+ return const SizedBox.shrink();
},
);
diff --git a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/openai/widgets/smart_edit_action.dart b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/openai/widgets/smart_edit_action.dart
index 9c67de7493..70affa002a 100644
--- a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/openai/widgets/smart_edit_action.dart
+++ b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/openai/widgets/smart_edit_action.dart
@@ -64,10 +64,10 @@ enum SmartEditAction {
}
class SmartEditActionWrapper extends ActionCell {
- final SmartEditAction inner;
-
SmartEditActionWrapper(this.inner);
+ final SmartEditAction inner;
+
Widget? icon(Color iconColor) => null;
@override
diff --git a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/openai/widgets/smart_edit_node_widget.dart b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/openai/widgets/smart_edit_node_widget.dart
index 7381489ff0..dbddcc45bc 100644
--- a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/openai/widgets/smart_edit_node_widget.dart
+++ b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/openai/widgets/smart_edit_node_widget.dart
@@ -331,9 +331,9 @@ class _SmartEditInputWidgetState extends State<SmartEditInputWidget> {
),
],
),
- onPressed: () async => await _onExit(),
+ onPressed: () async => _onExit(),
),
- const Spacer(flex: 1),
+ const Spacer(),
Expanded(
child: Container(
alignment: Alignment.centerRight,
@@ -398,7 +398,7 @@ class _SmartEditInputWidgetState extends State<SmartEditInputWidget> {
),
);
transaction.afterSelection = Selection(
- start: Position(path: selection.end.path.next, offset: 0),
+ start: Position(path: selection.end.path.next),
end: Position(
path: [selection.end.path.next.first + insertedText.length],
),
@@ -411,7 +411,6 @@ class _SmartEditInputWidgetState extends State<SmartEditInputWidget> {
return editorState.apply(
transaction,
options: const ApplyOptions(
- recordRedo: false,
recordUndo: false,
),
);
diff --git a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/openai/widgets/smart_edit_toolbar_item.dart b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/openai/widgets/smart_edit_toolbar_item.dart
index 10e09f9263..a25966c342 100644
--- a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/openai/widgets/smart_edit_toolbar_item.dart
+++ b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/openai/widgets/smart_edit_toolbar_item.dart
@@ -112,7 +112,6 @@ class _SmartEditActionListState extends State<SmartEditActionList> {
transaction,
options: const ApplyOptions(
recordUndo: false,
- recordRedo: false,
),
withUpdateSelection: false,
);
diff --git a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/outline/outline_block_component.dart b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/outline/outline_block_component.dart
index 5d6403d708..8e5e5f2334 100644
--- a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/outline/outline_block_component.dart
+++ b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/outline/outline_block_component.dart
@@ -149,7 +149,6 @@ class _OutlineBlockWidgetState extends State<OutlineBlockWidget>
child: Column(
key: ValueKey(children.hashCode),
crossAxisAlignment: CrossAxisAlignment.start,
- mainAxisAlignment: MainAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
textDirection: textDirection,
children: children,
diff --git a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/stability_ai/stability_ai_error.dart b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/stability_ai/stability_ai_error.dart
index d99a2f20b7..c699237762 100644
--- a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/stability_ai/stability_ai_error.dart
+++ b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/stability_ai/stability_ai_error.dart
@@ -1,8 +1,8 @@
class StabilityAIRequestError {
- final String message;
-
StabilityAIRequestError(this.message);
+ final String message;
+
@override
String toString() {
return 'StabilityAIRequestError{message: $message}';
diff --git a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/table/table_option_action.dart b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/table/table_option_action.dart
index c3d7cbf35b..afb2b63f49 100644
--- a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/table/table_option_action.dart
+++ b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/table/table_option_action.dart
@@ -138,7 +138,6 @@ class TableColorOptionAction extends PopoverActionCell {
selected: selectedColor,
border: Border.all(
color: Theme.of(context).colorScheme.onBackground,
- width: 1,
),
onTap: (option, index) async {
final backgroundColor =
diff --git a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/toggle/toggle_block_component.dart b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/toggle/toggle_block_component.dart
index 003ae01d7b..a38755849c 100644
--- a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/toggle/toggle_block_component.dart
+++ b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/toggle/toggle_block_component.dart
@@ -159,7 +159,6 @@ class _ToggleListBlockComponentWidgetState
child: Row(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
- mainAxisAlignment: MainAxisAlignment.start,
textDirection: textDirection,
children: [
// the emoji picker button for the note
diff --git a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/toggle/toggle_block_shortcut_event.dart b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/toggle/toggle_block_shortcut_event.dart
index 6428e0dccf..900cc66583 100644
--- a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/toggle/toggle_block_shortcut_event.dart
+++ b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/toggle/toggle_block_shortcut_event.dart
@@ -14,7 +14,7 @@ const _greater = '>';
CharacterShortcutEvent formatGreaterToToggleList = CharacterShortcutEvent(
key: 'format greater to quote',
character: ' ',
- handler: (editorState) async => await formatMarkdownSymbol(
+ handler: (editorState) async => formatMarkdownSymbol(
editorState,
(node) => node.type != ToggleListBlockKeys.type,
(_, text, __) => text == _greater,
@@ -58,13 +58,13 @@ CharacterShortcutEvent insertChildNodeInsideToggleList = CharacterShortcutEvent(
)
..deleteNode(node)
..afterSelection = Selection.collapsed(
- Position(path: selection.start.path, offset: 0),
+ Position(path: selection.start.path),
);
} else if (selection.startIndex == 0) {
// insert a paragraph block above the current toggle list block
transaction.insertNode(selection.start.path, paragraphNode());
transaction.afterSelection = Selection.collapsed(
- Position(path: selection.start.path.next, offset: 0),
+ Position(path: selection.start.path.next),
);
} else {
// insert a toggle list block below the current toggle list block
@@ -78,7 +78,7 @@ CharacterShortcutEvent insertChildNodeInsideToggleList = CharacterShortcutEvent(
],
)
..afterSelection = Selection.collapsed(
- Position(path: selection.start.path.next, offset: 0),
+ Position(path: selection.start.path.next),
);
}
} else {
@@ -90,7 +90,7 @@ CharacterShortcutEvent insertChildNodeInsideToggleList = CharacterShortcutEvent(
paragraphNode(delta: slicedDelta),
)
..afterSelection = Selection.collapsed(
- Position(path: selection.start.path + [0], offset: 0),
+ Position(path: selection.start.path + [0]),
);
}
await editorState.apply(transaction);
diff --git a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_style.dart b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_style.dart
index cd6d07bacd..f00d975fe2 100644
--- a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_style.dart
+++ b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_style.dart
@@ -130,7 +130,6 @@ class EditorStyleCustomizer {
),
textSpanDecorator: customizeAttributeDecorator,
mobileDragHandleBallSize: const Size.square(12.0),
- mobileDragHandleWidth: 2.0,
magnifierSize: const Size(144, 96),
);
}
diff --git a/frontend/appflowy_flutter/lib/plugins/document/presentation/share/share_button.dart b/frontend/appflowy_flutter/lib/plugins/document/presentation/share/share_button.dart
index 7497a93379..c5a81ab293 100644
--- a/frontend/appflowy_flutter/lib/plugins/document/presentation/share/share_button.dart
+++ b/frontend/appflowy_flutter/lib/plugins/document/presentation/share/share_button.dart
@@ -148,10 +148,10 @@ enum ShareAction {
}
class ShareActionWrapper extends ActionCell {
- final ShareAction inner;
-
ShareActionWrapper(this.inner);
+ final ShareAction inner;
+
Widget? icon(Color iconColor) => null;
@override
diff --git a/frontend/appflowy_flutter/lib/plugins/inline_actions/handlers/inline_page_reference.dart b/frontend/appflowy_flutter/lib/plugins/inline_actions/handlers/inline_page_reference.dart
index c4610dd67c..e5e7cf127f 100644
--- a/frontend/appflowy_flutter/lib/plugins/inline_actions/handlers/inline_page_reference.dart
+++ b/frontend/appflowy_flutter/lib/plugins/inline_actions/handlers/inline_page_reference.dart
@@ -105,7 +105,7 @@ class InlinePageReferenceService {
}
final List<InlineActionsMenuItem> pages = [];
- views.sort(((a, b) => b.createTime.compareTo(a.createTime)));
+ views.sort((a, b) => b.createTime.compareTo(a.createTime));
for (final view in views) {
if (view.id == currentViewId) {
diff --git a/frontend/appflowy_flutter/lib/plugins/inline_actions/widgets/inline_actions_handler.dart b/frontend/appflowy_flutter/lib/plugins/inline_actions/widgets/inline_actions_handler.dart
index f0cbb3c136..cdc326afea 100644
--- a/frontend/appflowy_flutter/lib/plugins/inline_actions/widgets/inline_actions_handler.dart
+++ b/frontend/appflowy_flutter/lib/plugins/inline_actions/widgets/inline_actions_handler.dart
@@ -270,7 +270,7 @@ class _InlineActionsHandlerState extends State<InlineActionsHandler> {
widget.onSelectionUpdate();
event.logicalKey == LogicalKeyboardKey.arrowLeft
- ? widget.editorState.moveCursorForward(SelectionMoveRange.character)
+ ? widget.editorState.moveCursorForward()
: widget.editorState.moveCursorBackward(SelectionMoveRange.character);
/// If cursor moves before @ then dismiss menu
diff --git a/frontend/appflowy_flutter/lib/plugins/trash/application/trash_bloc.dart b/frontend/appflowy_flutter/lib/plugins/trash/application/trash_bloc.dart
index 60f12d89d3..c2ce55cf10 100644
--- a/frontend/appflowy_flutter/lib/plugins/trash/application/trash_bloc.dart
+++ b/frontend/appflowy_flutter/lib/plugins/trash/application/trash_bloc.dart
@@ -1,21 +1,26 @@
-import 'package:dartz/dartz.dart';
+import 'package:appflowy/plugins/trash/application/trash_listener.dart';
+import 'package:appflowy/plugins/trash/application/trash_service.dart';
import 'package:appflowy_backend/log.dart';
-import 'package:appflowy_backend/protobuf/flowy-folder/trash.pb.dart';
import 'package:appflowy_backend/protobuf/flowy-error/errors.pb.dart';
+import 'package:appflowy_backend/protobuf/flowy-folder/trash.pb.dart';
+import 'package:dartz/dartz.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:freezed_annotation/freezed_annotation.dart';
-import 'package:appflowy/plugins/trash/application/trash_service.dart';
-import 'package:appflowy/plugins/trash/application/trash_listener.dart';
part 'trash_bloc.freezed.dart';
class TrashBloc extends Bloc<TrashEvent, TrashState> {
- final TrashService _service;
- final TrashListener _listener;
TrashBloc()
: _service = TrashService(),
_listener = TrashListener(),
super(TrashState.init()) {
+ _dispatch();
+ }
+
+ final TrashService _service;
+ final TrashListener _listener;
+
+ void _dispatch() {
on<TrashEvent>((event, emit) async {
await event.map(
initial: (e) async {
diff --git a/frontend/appflowy_flutter/lib/plugins/trash/src/trash_cell.dart b/frontend/appflowy_flutter/lib/plugins/trash/src/trash_cell.dart
index 4ae049dbb7..e1cfefeffa 100644
--- a/frontend/appflowy_flutter/lib/plugins/trash/src/trash_cell.dart
+++ b/frontend/appflowy_flutter/lib/plugins/trash/src/trash_cell.dart
@@ -10,16 +10,17 @@ import 'package:fixnum/fixnum.dart' as $fixnum;
import 'sizes.dart';
class TrashCell extends StatelessWidget {
- final VoidCallback onRestore;
- final VoidCallback onDelete;
- final TrashPB object;
const TrashCell({
+ super.key,
required this.object,
required this.onRestore,
required this.onDelete,
- super.key,
});
+ final VoidCallback onRestore;
+ final VoidCallback onDelete;
+ final TrashPB object;
+
@override
Widget build(BuildContext context) {
return Row(
diff --git a/frontend/appflowy_flutter/lib/plugins/trash/src/trash_header.dart b/frontend/appflowy_flutter/lib/plugins/trash/src/trash_header.dart
index e2ba8d9f58..34051428a9 100644
--- a/frontend/appflowy_flutter/lib/plugins/trash/src/trash_header.dart
+++ b/frontend/appflowy_flutter/lib/plugins/trash/src/trash_header.dart
@@ -30,13 +30,15 @@ class TrashHeaderDelegate extends SliverPersistentHeaderDelegate {
}
class TrashHeaderItem {
+ TrashHeaderItem({required this.width, required this.title});
+
double width;
String title;
-
- TrashHeaderItem({required this.width, required this.title});
}
class TrashHeader extends StatelessWidget {
+ TrashHeader({super.key});
+
final List<TrashHeaderItem> items = [
TrashHeaderItem(
title: LocaleKeys.trash_pageHeader_fileName.tr(),
@@ -52,8 +54,6 @@ class TrashHeader extends StatelessWidget {
),
];
- TrashHeader({super.key});
-
@override
Widget build(BuildContext context) {
final headerItems = List<Widget>.empty(growable: true);
diff --git a/frontend/appflowy_flutter/lib/plugins/trash/trash.dart b/frontend/appflowy_flutter/lib/plugins/trash/trash.dart
index cedac2622a..a25609edd3 100644
--- a/frontend/appflowy_flutter/lib/plugins/trash/trash.dart
+++ b/frontend/appflowy_flutter/lib/plugins/trash/trash.dart
@@ -34,10 +34,10 @@ class TrashPluginConfig implements PluginConfig {
}
class TrashPlugin extends Plugin {
- final PluginType _pluginType;
-
TrashPlugin({required PluginType pluginType}) : _pluginType = pluginType;
+ final PluginType _pluginType;
+
@override
PluginWidgetBuilder get widgetBuilder => TrashPluginDisplay();
diff --git a/frontend/appflowy_flutter/lib/plugins/trash/trash_page.dart b/frontend/appflowy_flutter/lib/plugins/trash/trash_page.dart
index 99767b8095..afabb6a57a 100644
--- a/frontend/appflowy_flutter/lib/plugins/trash/trash_page.dart
+++ b/frontend/appflowy_flutter/lib/plugins/trash/trash_page.dart
@@ -37,7 +37,6 @@ class _TrashPageState extends State<TrashPage> {
builder: (context, state) {
return SizedBox.expand(
child: Column(
- mainAxisAlignment: MainAxisAlignment.start,
children: [
_renderTopBar(context, state),
const VSpace(32),
diff --git a/frontend/appflowy_flutter/lib/plugins/util.dart b/frontend/appflowy_flutter/lib/plugins/util.dart
index 4000ca8524..7c7c3c317f 100644
--- a/frontend/appflowy_flutter/lib/plugins/util.dart
+++ b/frontend/appflowy_flutter/lib/plugins/util.dart
@@ -6,28 +6,24 @@ import 'package:appflowy_backend/protobuf/flowy-folder/view.pb.dart';
import 'package:flutter/material.dart';
class ViewPluginNotifier extends PluginNotifier<Option<DeletedViewPB>> {
- final ViewListener? _viewListener;
- ViewPB view;
-
- @override
- final ValueNotifier<Option<DeletedViewPB>> isDeleted = ValueNotifier(none());
-
ViewPluginNotifier({
required this.view,
}) : _viewListener = ViewListener(viewId: view.id) {
_viewListener?.start(
- onViewUpdated: (updatedView) {
- view = updatedView;
- },
- onViewMoveToTrash: (result) {
- result.fold(
- (deletedView) => isDeleted.value = some(deletedView),
- (err) => Log.error(err),
- );
- },
+ onViewUpdated: (updatedView) => view = updatedView,
+ onViewMoveToTrash: (result) => result.fold(
+ (deletedView) => isDeleted.value = some(deletedView),
+ (err) => Log.error(err),
+ ),
);
}
+ ViewPB view;
+ final ViewListener? _viewListener;
+
+ @override
+ final ValueNotifier<Option<DeletedViewPB>> isDeleted = ValueNotifier(none());
+
@override
void dispose() {
isDeleted.dispose();
diff --git a/frontend/appflowy_flutter/lib/shared/custom_image_cache_manager.dart b/frontend/appflowy_flutter/lib/shared/custom_image_cache_manager.dart
index eebf316542..5e5e677193 100644
--- a/frontend/appflowy_flutter/lib/shared/custom_image_cache_manager.dart
+++ b/frontend/appflowy_flutter/lib/shared/custom_image_cache_manager.dart
@@ -1,13 +1,11 @@
import 'package:flutter_cache_manager/flutter_cache_manager.dart';
class CustomImageCacheManager extends CacheManager with ImageCacheManager {
- static const key = 'appflowy_image_cache';
+ CustomImageCacheManager._() : super(Config(key));
- static final CustomImageCacheManager _instance = CustomImageCacheManager._();
+ factory CustomImageCacheManager() => _instance;
- factory CustomImageCacheManager() {
- return _instance;
- }
+ static final CustomImageCacheManager _instance = CustomImageCacheManager._();
- CustomImageCacheManager._() : super(Config(key));
+ static const key = 'appflowy_image_cache';
}
diff --git a/frontend/appflowy_flutter/lib/startup/plugin/plugin.dart b/frontend/appflowy_flutter/lib/startup/plugin/plugin.dart
index 55f7c062fa..197cd98c07 100644
--- a/frontend/appflowy_flutter/lib/startup/plugin/plugin.dart
+++ b/frontend/appflowy_flutter/lib/startup/plugin/plugin.dart
@@ -71,10 +71,10 @@ abstract class PluginWidgetBuilder with NavigationItem {
}
class PluginContext {
+ PluginContext({required this.onDeleted});
+
// calls when widget of the plugin get deleted
final Function(ViewPB, int?) onDeleted;
-
- PluginContext({required this.onDeleted});
}
void registerPlugin({required PluginBuilder builder, PluginConfig? config}) {
diff --git a/frontend/appflowy_flutter/lib/startup/plugin/src/sandbox.dart b/frontend/appflowy_flutter/lib/startup/plugin/src/sandbox.dart
index 740fb3f4d2..efcc5f9707 100644
--- a/frontend/appflowy_flutter/lib/startup/plugin/src/sandbox.dart
+++ b/frontend/appflowy_flutter/lib/startup/plugin/src/sandbox.dart
@@ -7,16 +7,16 @@ import '../plugin.dart';
import 'runner.dart';
class PluginSandbox {
+ PluginSandbox() {
+ pluginRunner = PluginRunner();
+ }
+
final LinkedHashMap<PluginType, PluginBuilder> _pluginBuilders =
LinkedHashMap();
final Map<PluginType, PluginConfig> _pluginConfigs =
<PluginType, PluginConfig>{};
late PluginRunner pluginRunner;
- PluginSandbox() {
- pluginRunner = PluginRunner();
- }
-
int indexOf(PluginType pluginType) {
final index =
_pluginBuilders.keys.toList().indexWhere((ty) => ty == pluginType);
diff --git a/frontend/appflowy_flutter/lib/startup/startup.dart b/frontend/appflowy_flutter/lib/startup/startup.dart
index 390b73168e..b9f28f606c 100644
--- a/frontend/appflowy_flutter/lib/startup/startup.dart
+++ b/frontend/appflowy_flutter/lib/startup/startup.dart
@@ -22,9 +22,9 @@ abstract class EntryPoint {
}
class FlowyRunnerContext {
- final Directory applicationDataDirectory;
-
FlowyRunnerContext({required this.applicationDataDirectory});
+
+ final Directory applicationDataDirectory;
}
Future<void> runAppFlowy({bool isAnon = false}) async {
@@ -174,10 +174,11 @@ Future<void> initGetIt(
}
class LaunchContext {
+ LaunchContext(this.getIt, this.env, this.config);
+
GetIt getIt;
IntegrationMode env;
LaunchConfiguration config;
- LaunchContext(this.getIt, this.env, this.config);
}
enum LaunchTaskType {
diff --git a/frontend/appflowy_flutter/lib/startup/tasks/appflowy_cloud_task.dart b/frontend/appflowy_flutter/lib/startup/tasks/appflowy_cloud_task.dart
index 4e583d2d6b..b72f593ec3 100644
--- a/frontend/appflowy_flutter/lib/startup/tasks/appflowy_cloud_task.dart
+++ b/frontend/appflowy_flutter/lib/startup/tasks/appflowy_cloud_task.dart
@@ -21,13 +21,6 @@ import 'package:flutter/material.dart';
import 'package:url_protocol/url_protocol.dart';
class AppFlowyCloudDeepLink {
- final _appLinks = AppLinks();
- // The AppLinks is a singleton, so we need to cancel the previous subscription
- // before creating a new one.
- static StreamSubscription<Uri?>? _deeplinkSubscription;
- ValueNotifier<DeepLinkResult?>? _stateNotifier = ValueNotifier(null);
- Completer<Either<FlowyError, UserProfilePB>>? _completer;
-
AppFlowyCloudDeepLink() {
if (_deeplinkSubscription == null) {
_deeplinkSubscription = _appLinks.uriLinkStream.listen(
@@ -50,6 +43,15 @@ class AppFlowyCloudDeepLink {
}
}
+ final _appLinks = AppLinks();
+
+ ValueNotifier<DeepLinkResult?>? _stateNotifier = ValueNotifier(null);
+ Completer<Either<FlowyError, UserProfilePB>>? _completer;
+
+ // The AppLinks is a singleton, so we need to cancel the previous subscription
+ // before creating a new one.
+ static StreamSubscription<Uri?>? _deeplinkSubscription;
+
Future<void> dispose() async {
_deeplinkSubscription?.pause();
_stateNotifier?.dispose();
@@ -192,10 +194,10 @@ class InitAppFlowyCloudTask extends LaunchTask {
}
class DeepLinkResult {
+ DeepLinkResult({required this.state, this.result});
+
final DeepLinkState state;
final Either<FlowyError, UserProfilePB>? result;
-
- DeepLinkResult({required this.state, this.result});
}
enum DeepLinkState {
diff --git a/frontend/appflowy_flutter/lib/startup/tasks/generate_router.dart b/frontend/appflowy_flutter/lib/startup/tasks/generate_router.dart
index 7985c6887e..2b64a82624 100644
--- a/frontend/appflowy_flutter/lib/startup/tasks/generate_router.dart
+++ b/frontend/appflowy_flutter/lib/startup/tasks/generate_router.dart
@@ -612,5 +612,5 @@ Widget _buildFadeTransition(
FadeTransition(opacity: animation, child: child);
Duration _slowDuration = Duration(
- milliseconds: (RouteDurations.slow.inMilliseconds).round(),
+ milliseconds: RouteDurations.slow.inMilliseconds.round(),
);
diff --git a/frontend/appflowy_flutter/lib/user/application/auth/af_cloud_mock_auth_service.dart b/frontend/appflowy_flutter/lib/user/application/auth/af_cloud_mock_auth_service.dart
index ec209d8630..df6dc89eb1 100644
--- a/frontend/appflowy_flutter/lib/user/application/auth/af_cloud_mock_auth_service.dart
+++ b/frontend/appflowy_flutter/lib/user/application/auth/af_cloud_mock_auth_service.dart
@@ -13,11 +13,11 @@ import 'package:flowy_infra/uuid.dart';
/// Only used for testing.
class AppFlowyCloudMockAuthService implements AuthService {
- final String userEmail;
-
AppFlowyCloudMockAuthService({String? email})
: userEmail = email ?? "${uuid()}@appflowy.io";
+ final String userEmail;
+
final BackendAuthService _appFlowyAuthService =
BackendAuthService(AuthenticatorPB.Supabase);
@@ -63,7 +63,7 @@ class AppFlowyCloudMockAuthService implements AuthService {
},
);
Log.info("UserEventOauthSignIn with payload: $payload");
- return await UserEventOauthSignIn(payload).send().then((value) {
+ return UserEventOauthSignIn(payload).send().then((value) {
value.fold((l) => null, (err) => Log.error(err));
return value.swap();
});
diff --git a/frontend/appflowy_flutter/lib/user/application/auth/backend_auth_service.dart b/frontend/appflowy_flutter/lib/user/application/auth/backend_auth_service.dart
index e990cc75f8..2c60e3e674 100644
--- a/frontend/appflowy_flutter/lib/user/application/auth/backend_auth_service.dart
+++ b/frontend/appflowy_flutter/lib/user/application/auth/backend_auth_service.dart
@@ -14,10 +14,10 @@ import '../../../generated/locale_keys.g.dart';
import 'device_id.dart';
class BackendAuthService implements AuthService {
- final AuthenticatorPB authType;
-
BackendAuthService(this.authType);
+ final AuthenticatorPB authType;
+
@override
Future<Either<FlowyError, UserProfilePB>> signInWithEmailPassword({
required String email,
diff --git a/frontend/appflowy_flutter/lib/user/application/auth/supabase_auth_service.dart b/frontend/appflowy_flutter/lib/user/application/auth/supabase_auth_service.dart
index 6c3c3ef4eb..0ccc9e73c1 100644
--- a/frontend/appflowy_flutter/lib/user/application/auth/supabase_auth_service.dart
+++ b/frontend/appflowy_flutter/lib/user/application/auth/supabase_auth_service.dart
@@ -94,7 +94,7 @@ class SupabaseAuthService implements AuthService {
final provider = platform.toProvider();
final completer = supabaseLoginCompleter(
onSuccess: (userId, userEmail) async {
- return await _setupAuth(
+ return _setupAuth(
map: {
AuthServiceMapKeys.uuid: userId,
AuthServiceMapKeys.email: userEmail,
@@ -137,7 +137,7 @@ class SupabaseAuthService implements AuthService {
}) async {
final completer = supabaseLoginCompleter(
onSuccess: (userId, userEmail) async {
- return await _setupAuth(
+ return _setupAuth(
map: {
AuthServiceMapKeys.uuid: userId,
AuthServiceMapKeys.email: userEmail,
diff --git a/frontend/appflowy_flutter/lib/user/application/encrypt_secret_bloc.dart b/frontend/appflowy_flutter/lib/user/application/encrypt_secret_bloc.dart
index 1abb16b98b..1d98b5d63b 100644
--- a/frontend/appflowy_flutter/lib/user/application/encrypt_secret_bloc.dart
+++ b/frontend/appflowy_flutter/lib/user/application/encrypt_secret_bloc.dart
@@ -12,9 +12,14 @@ import 'auth/auth_service.dart';
part 'encrypt_secret_bloc.freezed.dart';
class EncryptSecretBloc extends Bloc<EncryptSecretEvent, EncryptSecretState> {
- final UserProfilePB user;
EncryptSecretBloc({required this.user})
: super(EncryptSecretState.initial()) {
+ _dispatch();
+ }
+
+ final UserProfilePB user;
+
+ void _dispatch() {
on<EncryptSecretEvent>((event, emit) async {
await event.when(
setEncryptSecret: (secret) async {
diff --git a/frontend/appflowy_flutter/lib/user/application/reminder/reminder_bloc.dart b/frontend/appflowy_flutter/lib/user/application/reminder/reminder_bloc.dart
index 3d590f7e4a..abb6903de7 100644
--- a/frontend/appflowy_flutter/lib/user/application/reminder/reminder_bloc.dart
+++ b/frontend/appflowy_flutter/lib/user/application/reminder/reminder_bloc.dart
@@ -21,153 +21,159 @@ import 'package:freezed_annotation/freezed_annotation.dart';
part 'reminder_bloc.freezed.dart';
class ReminderBloc extends Bloc<ReminderEvent, ReminderState> {
- late final NotificationActionBloc _actionBloc;
- late final ReminderService _reminderService;
- late final Timer timer;
-
ReminderBloc() : super(ReminderState()) {
_actionBloc = getIt<NotificationActionBloc>();
_reminderService = const ReminderService();
timer = _periodicCheck();
- on<ReminderEvent>((event, emit) async {
- await event.when(
- markAllRead: () async {
- final unreadReminders =
- state.pastReminders.where((reminder) => !reminder.isRead);
+ _dispatch();
+ }
- final reminders = [...state.reminders];
- final updatedReminders = <ReminderPB>[];
- for (final reminder in unreadReminders) {
- reminders.remove(reminder);
+ late final NotificationActionBloc _actionBloc;
+ late final ReminderService _reminderService;
+ late final Timer timer;
- reminder.isRead = true;
- await _reminderService.updateReminder(reminder: reminder);
+ void _dispatch() {
+ on<ReminderEvent>(
+ (event, emit) async {
+ await event.when(
+ markAllRead: () async {
+ final unreadReminders =
+ state.pastReminders.where((reminder) => !reminder.isRead);
- updatedReminders.add(reminder);
- }
+ final reminders = [...state.reminders];
+ final updatedReminders = <ReminderPB>[];
+ for (final reminder in unreadReminders) {
+ reminders.remove(reminder);
- reminders.addAll(updatedReminders);
- emit(state.copyWith(reminders: reminders));
- },
- started: () async {
- final remindersOrFailure = await _reminderService.fetchReminders();
-
- remindersOrFailure.fold(
- (error) => Log.error(error),
- (reminders) => emit(state.copyWith(reminders: reminders)),
- );
- },
- remove: (reminderId) async {
- final unitOrFailure =
- await _reminderService.removeReminder(reminderId: reminderId);
-
- unitOrFailure.fold(
- (error) => Log.error(error),
- (_) {
- final reminders = [...state.reminders];
- reminders.removeWhere((e) => e.id == reminderId);
- emit(state.copyWith(reminders: reminders));
- },
- );
- },
- add: (reminder) async {
- final unitOrFailure =
- await _reminderService.addReminder(reminder: reminder);
-
- return unitOrFailure.fold(
- (error) => Log.error(error),
- (_) {
- final reminders = [...state.reminders, reminder];
- emit(state.copyWith(reminders: reminders));
- },
- );
- },
- addById: (reminderId, objectId, scheduledAt, meta) async => add(
- ReminderEvent.add(
- reminder: ReminderPB(
- id: reminderId,
- objectId: objectId,
- title: LocaleKeys.reminderNotification_title.tr(),
- message: LocaleKeys.reminderNotification_message.tr(),
- scheduledAt: scheduledAt,
- isAck: scheduledAt.toDateTime().isBefore(DateTime.now()),
- meta: meta,
- ),
- ),
- ),
- update: (updateObject) async {
- final reminder =
- state.reminders.firstWhereOrNull((r) => r.id == updateObject.id);
+ reminder.isRead = true;
+ await _reminderService.updateReminder(reminder: reminder);
- if (reminder == null) {
- return;
- }
+ updatedReminders.add(reminder);
+ }
- final newReminder = updateObject.merge(a: reminder);
- final failureOrUnit = await _reminderService.updateReminder(
- reminder: updateObject.merge(a: reminder),
- );
-
- failureOrUnit.fold(
- (error) => Log.error(error),
- (_) {
- final index =
- state.reminders.indexWhere((r) => r.id == reminder.id);
- final reminders = [...state.reminders];
- reminders.replaceRange(index, index + 1, [newReminder]);
- emit(state.copyWith(reminders: reminders));
- },
- );
- },
- pressReminder: (reminderId, path, view) {
- final reminder =
- state.reminders.firstWhereOrNull((r) => r.id == reminderId);
-
- if (reminder == null) {
- return;
- }
+ reminders.addAll(updatedReminders);
+ emit(state.copyWith(reminders: reminders));
+ },
+ started: () async {
+ final remindersOrFailure = await _reminderService.fetchReminders();
- add(
- ReminderEvent.update(
- ReminderUpdate(
+ remindersOrFailure.fold(
+ (error) => Log.error(error),
+ (reminders) => emit(state.copyWith(reminders: reminders)),
+ );
+ },
+ remove: (reminderId) async {
+ final unitOrFailure =
+ await _reminderService.removeReminder(reminderId: reminderId);
+
+ unitOrFailure.fold(
+ (error) => Log.error(error),
+ (_) {
+ final reminders = [...state.reminders];
+ reminders.removeWhere((e) => e.id == reminderId);
+ emit(state.copyWith(reminders: reminders));
+ },
+ );
+ },
+ add: (reminder) async {
+ final unitOrFailure =
+ await _reminderService.addReminder(reminder: reminder);
+
+ return unitOrFailure.fold(
+ (error) => Log.error(error),
+ (_) {
+ final reminders = [...state.reminders, reminder];
+ emit(state.copyWith(reminders: reminders));
+ },
+ );
+ },
+ addById: (reminderId, objectId, scheduledAt, meta) async => add(
+ ReminderEvent.add(
+ reminder: ReminderPB(
id: reminderId,
- isRead: state.pastReminders.contains(reminder),
+ objectId: objectId,
+ title: LocaleKeys.reminderNotification_title.tr(),
+ message: LocaleKeys.reminderNotification_message.tr(),
+ scheduledAt: scheduledAt,
+ isAck: scheduledAt.toDateTime().isBefore(DateTime.now()),
+ meta: meta,
),
),
- );
+ ),
+ update: (updateObject) async {
+ final reminder = state.reminders
+ .firstWhereOrNull((r) => r.id == updateObject.id);
- String? rowId;
- if (view?.layout != ViewLayoutPB.Document) {
- rowId = reminder.meta[ReminderMetaKeys.rowId];
- }
+ if (reminder == null) {
+ return;
+ }
- final action = NotificationAction(
- objectId: reminder.objectId,
- arguments: {
- ActionArgumentKeys.view: view,
- ActionArgumentKeys.nodePath: path,
- ActionArgumentKeys.rowId: rowId,
- },
- );
-
- if (!isClosed) {
- _actionBloc.add(
- NotificationActionEvent.performAction(
- action: action,
- nextActions: [
- action.copyWith(
- type: rowId != null
- ? ActionType.openRow
- : ActionType.jumpToBlock,
- ),
- ],
+ final newReminder = updateObject.merge(a: reminder);
+ final failureOrUnit = await _reminderService.updateReminder(
+ reminder: updateObject.merge(a: reminder),
+ );
+
+ failureOrUnit.fold(
+ (error) => Log.error(error),
+ (_) {
+ final index =
+ state.reminders.indexWhere((r) => r.id == reminder.id);
+ final reminders = [...state.reminders];
+ reminders.replaceRange(index, index + 1, [newReminder]);
+ emit(state.copyWith(reminders: reminders));
+ },
+ );
+ },
+ pressReminder: (reminderId, path, view) {
+ final reminder =
+ state.reminders.firstWhereOrNull((r) => r.id == reminderId);
+
+ if (reminder == null) {
+ return;
+ }
+
+ add(
+ ReminderEvent.update(
+ ReminderUpdate(
+ id: reminderId,
+ isRead: state.pastReminders.contains(reminder),
+ ),
),
);
- }
- },
- );
- });
+
+ String? rowId;
+ if (view?.layout != ViewLayoutPB.Document) {
+ rowId = reminder.meta[ReminderMetaKeys.rowId];
+ }
+
+ final action = NotificationAction(
+ objectId: reminder.objectId,
+ arguments: {
+ ActionArgumentKeys.view: view,
+ ActionArgumentKeys.nodePath: path,
+ ActionArgumentKeys.rowId: rowId,
+ },
+ );
+
+ if (!isClosed) {
+ _actionBloc.add(
+ NotificationActionEvent.performAction(
+ action: action,
+ nextActions: [
+ action.copyWith(
+ type: rowId != null
+ ? ActionType.openRow
+ : ActionType.jumpToBlock,
+ ),
+ ],
+ ),
+ );
+ }
+ },
+ );
+ },
+ );
}
Timer _periodicCheck() {
@@ -247,12 +253,6 @@ class ReminderEvent with _$ReminderEvent {
/// a [ReminderPB]
///
class ReminderUpdate {
- final String id;
- final bool? isAck;
- final bool? isRead;
- final DateTime? scheduledAt;
- final bool? includeTime;
-
ReminderUpdate({
required this.id,
this.isAck,
@@ -261,6 +261,12 @@ class ReminderUpdate {
this.includeTime,
});
+ final String id;
+ final bool? isAck;
+ final bool? isRead;
+ final DateTime? scheduledAt;
+ final bool? includeTime;
+
ReminderPB merge({required ReminderPB a}) {
final isAcknowledged = isAck == null && scheduledAt != null
? scheduledAt!.isBefore(DateTime.now())
diff --git a/frontend/appflowy_flutter/lib/user/application/sign_in_bloc.dart b/frontend/appflowy_flutter/lib/user/application/sign_in_bloc.dart
index 30cefff50e..665407bcca 100644
--- a/frontend/appflowy_flutter/lib/user/application/sign_in_bloc.dart
+++ b/frontend/appflowy_flutter/lib/user/application/sign_in_bloc.dart
@@ -13,6 +13,19 @@ import 'package:freezed_annotation/freezed_annotation.dart';
part 'sign_in_bloc.freezed.dart';
class SignInBloc extends Bloc<SignInEvent, SignInState> {
+ SignInBloc(this.authService) : super(SignInState.initial()) {
+ if (isAppFlowyCloudEnabled) {
+ deepLinkStateListener =
+ getIt<AppFlowyCloudDeepLink>().subscribeDeepLinkLoadingState((value) {
+ if (isClosed) return;
+
+ add(SignInEvent.deepLinkStateChange(value));
+ });
+ }
+
+ _dispatch();
+ }
+
final AuthService authService;
void Function()? deepLinkStateListener;
@@ -27,96 +40,83 @@ class SignInBloc extends Bloc<SignInEvent, SignInState> {
return super.close();
}
- SignInBloc(this.authService) : super(SignInState.initial()) {
- if (isAppFlowyCloudEnabled) {
- deepLinkStateListener =
- getIt<AppFlowyCloudDeepLink>().subscribeDeepLinkLoadingState((value) {
- if (isClosed) return;
-
- add(SignInEvent.deepLinkStateChange(value));
- });
- }
-
- on<SignInEvent>((event, emit) async {
- await event.map(
- signedInWithUserEmailAndPassword: (e) async {
- await _performActionOnSignIn(
- state,
- emit,
- );
- },
- signedInWithOAuth: (value) async =>
- await _performActionOnSignInWithOAuth(
- state,
- emit,
- value.platform,
- ),
- signedInAsGuest: (value) async => await _performActionOnSignInAsGuest(
- state,
- emit,
- ),
- emailChanged: (EmailChanged value) async {
- emit(
- state.copyWith(
- email: value.email,
- emailError: none(),
- successOrFail: none(),
- ),
- );
- },
- passwordChanged: (PasswordChanged value) async {
- emit(
- state.copyWith(
- password: value.password,
- passwordError: none(),
- successOrFail: none(),
- ),
- );
- },
- signedWithMagicLink: (SignedWithMagicLink value) async {
- await _performActionOnSignInWithMagicLink(state, emit, value.email);
- },
- deepLinkStateChange: (_DeepLinkStateChange value) {
- final deepLinkState = value.result.state;
+ void _dispatch() {
+ on<SignInEvent>(
+ (event, emit) async {
+ await event.map(
+ signedInWithUserEmailAndPassword: (e) async {
+ await _performActionOnSignIn(
+ state,
+ emit,
+ );
+ },
+ signedInWithOAuth: (value) async =>
+ _performActionOnSignInWithOAuth(state, emit, value.platform),
+ signedInAsGuest: (value) async =>
+ _performActionOnSignInAsGuest(state, emit),
+ emailChanged: (EmailChanged value) async {
+ emit(
+ state.copyWith(
+ email: value.email,
+ emailError: none(),
+ successOrFail: none(),
+ ),
+ );
+ },
+ passwordChanged: (PasswordChanged value) async {
+ emit(
+ state.copyWith(
+ password: value.password,
+ passwordError: none(),
+ successOrFail: none(),
+ ),
+ );
+ },
+ signedWithMagicLink: (SignedWithMagicLink value) async {
+ await _performActionOnSignInWithMagicLink(state, emit, value.email);
+ },
+ deepLinkStateChange: (_DeepLinkStateChange value) {
+ final deepLinkState = value.result.state;
- switch (deepLinkState) {
- case DeepLinkState.none:
- break;
- case DeepLinkState.loading:
- emit(
- state.copyWith(
- isSubmitting: true,
- emailError: none(),
- passwordError: none(),
- successOrFail: none(),
- ),
- );
- case DeepLinkState.finish:
- if (value.result.result != null) {
+ switch (deepLinkState) {
+ case DeepLinkState.none:
+ break;
+ case DeepLinkState.loading:
emit(
- value.result.result!.fold(
- (error) => stateFromCode(error),
- (userProfile) => state.copyWith(
- isSubmitting: false,
- successOrFail: some(left(userProfile)),
- ),
+ state.copyWith(
+ isSubmitting: true,
+ emailError: none(),
+ passwordError: none(),
+ successOrFail: none(),
),
);
- }
- }
- },
- cancel: (value) {
- emit(
- state.copyWith(
- isSubmitting: false,
- emailError: none(),
- passwordError: none(),
- successOrFail: none(),
- ),
- );
- },
- );
- });
+ case DeepLinkState.finish:
+ if (value.result.result != null) {
+ emit(
+ value.result.result!.fold(
+ (error) => stateFromCode(error),
+ (userProfile) => state.copyWith(
+ isSubmitting: false,
+ successOrFail: some(left(userProfile)),
+ ),
+ ),
+ );
+ }
+ }
+ },
+ cancel: (value) {
+ emit(
+ state.copyWith(
+ isSubmitting: false,
+ emailError: none(),
+ passwordError: none(),
+ successOrFail: none(),
+ ),
+ );
+ },
+ );
+ },
+ );
}
Future<void> _performActionOnSignIn(
diff --git a/frontend/appflowy_flutter/lib/user/application/sign_up_bloc.dart b/frontend/appflowy_flutter/lib/user/application/sign_up_bloc.dart
index fe796960b3..a7cd6e29c5 100644
--- a/frontend/appflowy_flutter/lib/user/application/sign_up_bloc.dart
+++ b/frontend/appflowy_flutter/lib/user/application/sign_up_bloc.dart
@@ -1,53 +1,60 @@
+import 'package:appflowy/generated/locale_keys.g.dart';
import 'package:appflowy/user/application/auth/auth_service.dart';
-import 'package:dartz/dartz.dart';
-import 'package:easy_localization/easy_localization.dart';
import 'package:appflowy_backend/protobuf/flowy-error/code.pb.dart';
import 'package:appflowy_backend/protobuf/flowy-user/protobuf.dart'
show UserProfilePB;
import 'package:appflowy_backend/protobuf/flowy-error/errors.pb.dart';
-import 'package:freezed_annotation/freezed_annotation.dart';
+import 'package:dartz/dartz.dart';
+import 'package:easy_localization/easy_localization.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
-import 'package:appflowy/generated/locale_keys.g.dart';
+import 'package:freezed_annotation/freezed_annotation.dart';
part 'sign_up_bloc.freezed.dart';
class SignUpBloc extends Bloc<SignUpEvent, SignUpState> {
- final AuthService authService;
SignUpBloc(this.authService) : super(SignUpState.initial()) {
- on<SignUpEvent>((event, emit) async {
- await event.map(
- signUpWithUserEmailAndPassword: (e) async {
- await _performActionOnSignUp(emit);
- },
- emailChanged: (_EmailChanged value) async {
- emit(
- state.copyWith(
- email: value.email,
- emailError: none(),
- successOrFail: none(),
- ),
- );
- },
- passwordChanged: (_PasswordChanged value) async {
- emit(
- state.copyWith(
- password: value.password,
- passwordError: none(),
- successOrFail: none(),
- ),
- );
- },
- repeatPasswordChanged: (_RepeatPasswordChanged value) async {
- emit(
- state.copyWith(
- repeatedPassword: value.password,
- repeatPasswordError: none(),
- successOrFail: none(),
- ),
- );
- },
- );
- });
+ _dispatch();
+ }
+
+ final AuthService authService;
+
+ void _dispatch() {
+ on<SignUpEvent>(
+ (event, emit) async {
+ await event.map(
+ signUpWithUserEmailAndPassword: (e) async {
+ await _performActionOnSignUp(emit);
+ },
+ emailChanged: (_EmailChanged value) async {
+ emit(
+ state.copyWith(
+ email: value.email,
+ emailError: none(),
+ successOrFail: none(),
+ ),
+ );
+ },
+ passwordChanged: (_PasswordChanged value) async {
+ emit(
+ state.copyWith(
+ password: value.password,
+ passwordError: none(),
+ successOrFail: none(),
+ ),
+ );
+ },
+ repeatPasswordChanged: (_RepeatPasswordChanged value) async {
+ emit(
+ state.copyWith(
+ repeatedPassword: value.password,
+ repeatPasswordError: none(),
+ successOrFail: none(),
+ ),
+ );
+ },
+ );
+ },
+ );
}
Future<void> _performActionOnSignUp(Emitter<SignUpState> emit) async {
diff --git a/frontend/appflowy_flutter/lib/user/application/supabase_realtime.dart b/frontend/appflowy_flutter/lib/user/application/supabase_realtime.dart
index 5dc159e9d7..daf0afbfb0 100644
--- a/frontend/appflowy_flutter/lib/user/application/supabase_realtime.dart
+++ b/frontend/appflowy_flutter/lib/user/application/supabase_realtime.dart
@@ -16,14 +16,6 @@ import 'package:supabase_flutter/supabase_flutter.dart';
/// a reference to a Supabase instance and sets up the necessary subscriptions
/// accordingly.
class SupabaseRealtimeService {
- final Supabase supabase;
- final _authStateListener = UserAuthStateListener();
-
- bool isLoggingOut = false;
-
- RealtimeChannel? channel;
- StreamSubscription<AuthState>? authStateSubscription;
-
SupabaseRealtimeService({required this.supabase}) {
_subscribeAuthState();
_subscribeTablesChanges();
@@ -45,6 +37,14 @@ class SupabaseRealtimeService {
);
}
+ final Supabase supabase;
+ final _authStateListener = UserAuthStateListener();
+
+ bool isLoggingOut = false;
+
+ RealtimeChannel? channel;
+ StreamSubscription<AuthState>? authStateSubscription;
+
void _subscribeAuthState() {
final auth = Supabase.instance.client.auth;
authStateSubscription = auth.onAuthStateChange.listen((state) async {
diff --git a/frontend/appflowy_flutter/lib/user/application/user_listener.dart b/frontend/appflowy_flutter/lib/user/application/user_listener.dart
index 02e4f4b684..b23689f562 100644
--- a/frontend/appflowy_flutter/lib/user/application/user_listener.dart
+++ b/frontend/appflowy_flutter/lib/user/application/user_listener.dart
@@ -17,15 +17,16 @@ typedef UserProfileNotifyValue = Either<UserProfilePB, FlowyError>;
typedef AuthNotifyValue = Either<Unit, FlowyError>;
class UserListener {
- StreamSubscription<SubscribeObject>? _subscription;
- PublishNotifier<UserProfileNotifyValue>? _profileNotifier = PublishNotifier();
-
- UserNotificationParser? _userParser;
- final UserProfilePB _userProfile;
UserListener({
required UserProfilePB userProfile,
}) : _userProfile = userProfile;
+ final UserProfilePB _userProfile;
+
+ UserNotificationParser? _userParser;
+ StreamSubscription<SubscribeObject>? _subscription;
+ PublishNotifier<UserProfileNotifyValue>? _profileNotifier = PublishNotifier();
+
void start({
void Function(UserProfileNotifyValue)? onProfileUpdated,
}) {
@@ -70,15 +71,13 @@ class UserListener {
typedef WorkspaceSettingNotifyValue = Either<WorkspaceSettingPB, FlowyError>;
class UserWorkspaceListener {
+ UserWorkspaceListener();
+
PublishNotifier<WorkspaceSettingNotifyValue>? _settingChangedNotifier =
PublishNotifier();
FolderNotificationListener? _listener;
- UserWorkspaceListener({
- required UserProfilePB userProfile,
- });
-
void start({
void Function(WorkspaceSettingNotifyValue)? onSettingUpdated,
}) {
diff --git a/frontend/appflowy_flutter/lib/user/application/workspace_error_bloc.dart b/frontend/appflowy_flutter/lib/user/application/workspace_error_bloc.dart
index d65a8f43fc..4319f37b09 100644
--- a/frontend/appflowy_flutter/lib/user/application/workspace_error_bloc.dart
+++ b/frontend/appflowy_flutter/lib/user/application/workspace_error_bloc.dart
@@ -4,63 +4,67 @@ import 'package:appflowy_backend/protobuf/flowy-error/errors.pb.dart';
import 'package:appflowy_backend/protobuf/flowy-folder/protobuf.dart';
import 'package:appflowy_backend/protobuf/flowy-folder/workspace.pb.dart';
import 'package:appflowy_backend/protobuf/flowy-user/user_profile.pb.dart';
-import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:dartz/dartz.dart';
+import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:freezed_annotation/freezed_annotation.dart';
part 'workspace_error_bloc.freezed.dart';
class WorkspaceErrorBloc
extends Bloc<WorkspaceErrorEvent, WorkspaceErrorState> {
+ WorkspaceErrorBloc({required this.userFolder, required FlowyError error})
+ : super(WorkspaceErrorState.initial(error)) {
+ _dispatch();
+ }
+
final UserFolderPB userFolder;
- WorkspaceErrorBloc({
- required this.userFolder,
- required FlowyError error,
- }) : super(WorkspaceErrorState.initial(error)) {
- on<WorkspaceErrorEvent>((event, emit) async {
- await event.when(
- init: () {
- // _loadSnapshots();
- },
- resetWorkspace: () async {
- emit(state.copyWith(loadingState: const LoadingState.loading()));
- final payload = ResetWorkspacePB.create()
- ..workspaceId = userFolder.workspaceId
- ..uid = userFolder.uid;
- UserEventResetWorkspace(payload).send().then(
- (result) {
- if (isClosed) {
- return;
- }
- add(WorkspaceErrorEvent.didResetWorkspace(result));
- },
- );
- },
- didResetWorkspace: (result) {
- result.fold(
- (_) {
- emit(
- state.copyWith(
- loadingState: LoadingState.finish(result),
- workspaceState: const WorkspaceState.reset(),
- ),
- );
- },
- (err) {
- emit(state.copyWith(loadingState: LoadingState.finish(result)));
- },
- );
- },
- logout: () {
- emit(
- state.copyWith(
- workspaceState: const WorkspaceState.logout(),
- ),
- );
- },
- );
- });
+ void _dispatch() {
+ on<WorkspaceErrorEvent>(
+ (event, emit) async {
+ await event.when(
+ init: () {
+ // _loadSnapshots();
+ },
+ resetWorkspace: () async {
+ emit(state.copyWith(loadingState: const LoadingState.loading()));
+ final payload = ResetWorkspacePB.create()
+ ..workspaceId = userFolder.workspaceId
+ ..uid = userFolder.uid;
+ UserEventResetWorkspace(payload).send().then(
+ (result) {
+ if (isClosed) {
+ return;
+ }
+ add(WorkspaceErrorEvent.didResetWorkspace(result));
+ },
+ );
+ },
+ didResetWorkspace: (result) {
+ result.fold(
+ (_) {
+ emit(
+ state.copyWith(
+ loadingState: LoadingState.finish(result),
+ workspaceState: const WorkspaceState.reset(),
+ ),
+ );
+ },
+ (err) {
+ emit(state.copyWith(loadingState: LoadingState.finish(result)));
+ },
+ );
+ },
+ logout: () {
+ emit(
+ state.copyWith(
+ workspaceState: const WorkspaceState.logout(),
+ ),
+ );
+ },
+ );
+ },
+ );
}
}
diff --git a/frontend/appflowy_flutter/lib/user/presentation/anon_user.dart b/frontend/appflowy_flutter/lib/user/presentation/anon_user.dart
index 8f63a70df6..a9b11cb42e 100644
--- a/frontend/appflowy_flutter/lib/user/presentation/anon_user.dart
+++ b/frontend/appflowy_flutter/lib/user/presentation/anon_user.dart
@@ -8,9 +8,10 @@ import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
class AnonUserList extends StatelessWidget {
- final VoidCallback didOpenUser;
const AnonUserList({required this.didOpenUser, super.key});
+ final VoidCallback didOpenUser;
+
@override
Widget build(BuildContext context) {
return BlocProvider(
@@ -59,16 +60,17 @@ class AnonUserList extends StatelessWidget {
}
class AnonUserItem extends StatelessWidget {
- final VoidCallback didOpenUser;
- final bool isSelected;
- final UserProfilePB user;
const AnonUserItem({
+ super.key,
required this.user,
required this.isSelected,
required this.didOpenUser,
- super.key,
});
+ final UserProfilePB user;
+ final bool isSelected;
+ final VoidCallback didOpenUser;
+
@override
Widget build(BuildContext context) {
final icon = isSelected ? const FlowySvg(FlowySvgs.check_s) : null;
diff --git a/frontend/appflowy_flutter/lib/user/presentation/screens/encrypt_secret_screen.dart b/frontend/appflowy_flutter/lib/user/presentation/screens/encrypt_secret_screen.dart
index 7d4fe83b61..0cefb6e7d8 100644
--- a/frontend/appflowy_flutter/lib/user/presentation/screens/encrypt_secret_screen.dart
+++ b/frontend/appflowy_flutter/lib/user/presentation/screens/encrypt_secret_screen.dart
@@ -12,14 +12,16 @@ import 'package:flutter_bloc/flutter_bloc.dart';
import '../../application/encrypt_secret_bloc.dart';
class EncryptSecretScreen extends StatefulWidget {
+ const EncryptSecretScreen({required this.user, super.key});
+
+ final UserProfilePB user;
+
static const routeName = '/EncryptSecretScreen';
- // arguments names to used in GoRouter
+
+ // arguments used in GoRouter
static const argUser = 'user';
static const argKey = 'key';
- final UserProfilePB user;
- const EncryptSecretScreen({required this.user, super.key});
-
@override
State<EncryptSecretScreen> createState() => _EncryptSecretScreenState();
}
diff --git a/frontend/appflowy_flutter/lib/user/presentation/screens/sign_in_screen/desktop_sign_in_screen.dart b/frontend/appflowy_flutter/lib/user/presentation/screens/sign_in_screen/desktop_sign_in_screen.dart
index e499a5b927..f80c8f6488 100644
--- a/frontend/appflowy_flutter/lib/user/presentation/screens/sign_in_screen/desktop_sign_in_screen.dart
+++ b/frontend/appflowy_flutter/lib/user/presentation/screens/sign_in_screen/desktop_sign_in_screen.dart
@@ -58,7 +58,6 @@ class DesktopSignInScreen extends StatelessWidget {
const VSpace(indicatorMinHeight),
isLoading
? const LinearProgressIndicator(
- value: null,
minHeight: indicatorMinHeight,
)
: const VSpace(indicatorMinHeight),
diff --git a/frontend/appflowy_flutter/lib/user/presentation/screens/sign_up_screen.dart b/frontend/appflowy_flutter/lib/user/presentation/screens/sign_up_screen.dart
index 3995af40c0..049279ca4a 100644
--- a/frontend/appflowy_flutter/lib/user/presentation/screens/sign_up_screen.dart
+++ b/frontend/appflowy_flutter/lib/user/presentation/screens/sign_up_screen.dart
@@ -61,7 +61,6 @@ class SignUpForm extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Align(
- alignment: Alignment.center,
child: AuthFormContainer(
children: [
FlowyLogoTitle(
@@ -80,7 +79,7 @@ class SignUpForm extends StatelessWidget {
const SignUpPrompt(),
if (context.read<SignUpBloc>().state.isSubmitting) ...[
const SizedBox(height: 8),
- const LinearProgressIndicator(value: null),
+ const LinearProgressIndicator(),
],
],
),
diff --git a/frontend/appflowy_flutter/lib/user/presentation/screens/skip_log_in_screen.dart b/frontend/appflowy_flutter/lib/user/presentation/screens/skip_log_in_screen.dart
index 402704cd2b..af5e66496f 100644
--- a/frontend/appflowy_flutter/lib/user/presentation/screens/skip_log_in_screen.dart
+++ b/frontend/appflowy_flutter/lib/user/presentation/screens/skip_log_in_screen.dart
@@ -20,11 +20,9 @@ import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:url_launcher/url_launcher.dart';
class SkipLogInScreen extends StatefulWidget {
- static const routeName = '/SkipLogInScreen';
+ const SkipLogInScreen({super.key});
- const SkipLogInScreen({
- super.key,
- });
+ static const routeName = '/SkipLogInScreen';
@override
State<SkipLogInScreen> createState() => _SkipLogInScreenState();
@@ -47,7 +45,6 @@ class _SkipLogInScreenState extends State<SkipLogInScreen> {
final size = MediaQuery.of(context).size;
return Column(
mainAxisAlignment: MainAxisAlignment.center,
- crossAxisAlignment: CrossAxisAlignment.center,
children: [
const Spacer(),
FlowyLogoTitle(
@@ -252,12 +249,9 @@ class LanguageSelectorOnWelcomePage extends StatelessWidget {
}
class GoButton extends StatelessWidget {
- final VoidCallback onPressed;
+ const GoButton({super.key, required this.onPressed});
- const GoButton({
- super.key,
- required this.onPressed,
- });
+ final VoidCallback onPressed;
@override
Widget build(BuildContext context) {
diff --git a/frontend/appflowy_flutter/lib/user/presentation/screens/splash_screen.dart b/frontend/appflowy_flutter/lib/user/presentation/screens/splash_screen.dart
index dd0ccc69c5..e192914c32 100644
--- a/frontend/appflowy_flutter/lib/user/presentation/screens/splash_screen.dart
+++ b/frontend/appflowy_flutter/lib/user/presentation/screens/splash_screen.dart
@@ -30,7 +30,7 @@ class SplashScreen extends StatelessWidget {
future: _registerIfNeeded(),
builder: (context, snapshot) {
if (snapshot.connectionState != ConnectionState.done) {
- return Container();
+ return const SizedBox.shrink();
}
return _buildChild(context);
},
diff --git a/frontend/appflowy_flutter/lib/user/presentation/screens/workspace_error_screen.dart b/frontend/appflowy_flutter/lib/user/presentation/screens/workspace_error_screen.dart
index 7d29ba460d..d79127e04c 100644
--- a/frontend/appflowy_flutter/lib/user/presentation/screens/workspace_error_screen.dart
+++ b/frontend/appflowy_flutter/lib/user/presentation/screens/workspace_error_screen.dart
@@ -13,19 +13,20 @@ import 'package:flutter_bloc/flutter_bloc.dart';
import '../../application/workspace_error_bloc.dart';
class WorkspaceErrorScreen extends StatelessWidget {
- static const routeName = "/WorkspaceErrorScreen";
- // arguments names to used in GoRouter
- static const argError = "error";
- static const argUserFolder = "userFolder";
-
- final FlowyError error;
- final UserFolderPB userFolder;
const WorkspaceErrorScreen({
+ super.key,
required this.userFolder,
required this.error,
- super.key,
});
+ final UserFolderPB userFolder;
+ final FlowyError error;
+
+ static const routeName = "/WorkspaceErrorScreen";
+ // arguments names to used in GoRouter
+ static const argError = "error";
+ static const argUserFolder = "userFolder";
+
@override
Widget build(BuildContext context) {
return Scaffold(
@@ -93,7 +94,6 @@ class WorkspaceErrorScreen extends StatelessWidget {
width: 500,
child: IntrinsicHeight(
child: Column(
- crossAxisAlignment: CrossAxisAlignment.center,
children: children,
),
),
@@ -108,11 +108,9 @@ class WorkspaceErrorScreen extends StatelessWidget {
}
class WorkspaceErrorDescription extends StatelessWidget {
+ const WorkspaceErrorDescription({super.key, required this.error});
+
final FlowyError error;
- const WorkspaceErrorDescription({
- required this.error,
- super.key,
- });
@override
Widget build(BuildContext context) {
@@ -129,7 +127,6 @@ class WorkspaceErrorDescription extends StatelessWidget {
FlowyText.medium(
"Error code: ${state.initialError.code.value.toString()}",
fontSize: 12,
- maxLines: 1,
),
],
);
diff --git a/frontend/appflowy_flutter/lib/user/presentation/screens/workspace_start_screen/desktop_workspace_start_screen.dart b/frontend/appflowy_flutter/lib/user/presentation/screens/workspace_start_screen/desktop_workspace_start_screen.dart
index 73d282b934..2be9ed6484 100644
--- a/frontend/appflowy_flutter/lib/user/presentation/screens/workspace_start_screen/desktop_workspace_start_screen.dart
+++ b/frontend/appflowy_flutter/lib/user/presentation/screens/workspace_start_screen/desktop_workspace_start_screen.dart
@@ -57,13 +57,14 @@ Widget _renderList(List<WorkspacePB> workspaces) {
}
class _WorkspaceItem extends StatelessWidget {
- final WorkspacePB workspace;
- final void Function(WorkspacePB workspace) onPressed;
const _WorkspaceItem({
required this.workspace,
required this.onPressed,
});
+ final WorkspacePB workspace;
+ final void Function(WorkspacePB workspace) onPressed;
+
@override
Widget build(BuildContext context) {
return SizedBox(
diff --git a/frontend/appflowy_flutter/lib/user/presentation/screens/workspace_start_screen/workspace_start_screen.dart b/frontend/appflowy_flutter/lib/user/presentation/screens/workspace_start_screen/workspace_start_screen.dart
index 8bc8c9f275..a03b3bcf63 100644
--- a/frontend/appflowy_flutter/lib/user/presentation/screens/workspace_start_screen/workspace_start_screen.dart
+++ b/frontend/appflowy_flutter/lib/user/presentation/screens/workspace_start_screen/workspace_start_screen.dart
@@ -9,16 +9,13 @@ import 'package:flutter_bloc/flutter_bloc.dart';
// For future use
class WorkspaceStartScreen extends StatelessWidget {
- static const routeName = "/WorkspaceStartScreen";
- static const argUserProfile = "userProfile";
+ /// To choose which screen is going to open
+ const WorkspaceStartScreen({super.key, required this.userProfile});
final UserProfilePB userProfile;
- /// To choose which screen is going to open
- const WorkspaceStartScreen({
- super.key,
- required this.userProfile,
- });
+ static const routeName = "/WorkspaceStartScreen";
+ static const argUserProfile = "userProfile";
@override
Widget build(BuildContext context) {
diff --git a/frontend/appflowy_flutter/lib/user/presentation/widgets/auth_form_container.dart b/frontend/appflowy_flutter/lib/user/presentation/widgets/auth_form_container.dart
index 348e2b5ee7..9cd71b270e 100644
--- a/frontend/appflowy_flutter/lib/user/presentation/widgets/auth_form_container.dart
+++ b/frontend/appflowy_flutter/lib/user/presentation/widgets/auth_form_container.dart
@@ -1,12 +1,11 @@
import 'package:flutter/material.dart';
class AuthFormContainer extends StatelessWidget {
+ const AuthFormContainer({super.key, required this.children});
+
final List<Widget> children;
+
static const double width = 340;
- const AuthFormContainer({
- super.key,
- required this.children,
- });
@override
Widget build(BuildContext context) {
diff --git a/frontend/appflowy_flutter/lib/user/presentation/widgets/folder_widget.dart b/frontend/appflowy_flutter/lib/user/presentation/widgets/folder_widget.dart
index 8ac0e2cb43..64ed445be9 100644
--- a/frontend/appflowy_flutter/lib/user/presentation/widgets/folder_widget.dart
+++ b/frontend/appflowy_flutter/lib/user/presentation/widgets/folder_widget.dart
@@ -57,7 +57,7 @@ class _FolderWidgetState extends State<FolderWidget> {
onPressedCreate: widget.createFolderCallback,
);
case _FolderPage.open:
- return Container();
+ return const SizedBox.shrink();
}
}
@@ -255,7 +255,6 @@ class _FolderCard extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
- crossAxisAlignment: CrossAxisAlignment.center,
children: [
Flexible(
child: FlowyText.regular(
diff --git a/frontend/appflowy_flutter/lib/util/debounce.dart b/frontend/appflowy_flutter/lib/util/debounce.dart
index 324818a650..46881ab0a0 100644
--- a/frontend/appflowy_flutter/lib/util/debounce.dart
+++ b/frontend/appflowy_flutter/lib/util/debounce.dart
@@ -3,13 +3,13 @@ import 'dart:async';
import 'package:flutter/material.dart';
class Debounce {
- final Duration duration;
- Timer? _timer;
-
Debounce({
this.duration = const Duration(milliseconds: 1000),
});
+ final Duration duration;
+ Timer? _timer;
+
void call(VoidCallback action) {
dispose();
_timer = Timer(duration, () {
diff --git a/frontend/appflowy_flutter/lib/workspace/application/edit_panel/edit_context.dart b/frontend/appflowy_flutter/lib/workspace/application/edit_panel/edit_context.dart
index 95fabf8396..b0b4406ac3 100644
--- a/frontend/appflowy_flutter/lib/workspace/application/edit_panel/edit_context.dart
+++ b/frontend/appflowy_flutter/lib/workspace/application/edit_panel/edit_context.dart
@@ -2,15 +2,16 @@ import 'package:equatable/equatable.dart';
import 'package:flutter/material.dart';
abstract class EditPanelContext extends Equatable {
- final String identifier;
- final String title;
- final Widget child;
const EditPanelContext({
- required this.child,
required this.identifier,
required this.title,
+ required this.child,
});
+ final String identifier;
+ final String title;
+ final Widget child;
+
@override
List<Object> get props => [identifier];
}
diff --git a/frontend/appflowy_flutter/lib/workspace/application/edit_panel/edit_panel_bloc.dart b/frontend/appflowy_flutter/lib/workspace/application/edit_panel/edit_panel_bloc.dart
index 4935530732..fc948f7591 100644
--- a/frontend/appflowy_flutter/lib/workspace/application/edit_panel/edit_panel_bloc.dart
+++ b/frontend/appflowy_flutter/lib/workspace/application/edit_panel/edit_panel_bloc.dart
@@ -1,7 +1,7 @@
import 'package:appflowy/workspace/application/edit_panel/edit_context.dart';
import 'package:dartz/dartz.dart';
-import 'package:freezed_annotation/freezed_annotation.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
+import 'package:freezed_annotation/freezed_annotation.dart';
part 'edit_panel_bloc.freezed.dart';
diff --git a/frontend/appflowy_flutter/lib/workspace/application/favorite/favorite_bloc.dart b/frontend/appflowy_flutter/lib/workspace/application/favorite/favorite_bloc.dart
index 18da724f2a..204d18e025 100644
--- a/frontend/appflowy_flutter/lib/workspace/application/favorite/favorite_bloc.dart
+++ b/frontend/appflowy_flutter/lib/workspace/application/favorite/favorite_bloc.dart
@@ -11,10 +11,20 @@ import 'favorite_listener.dart';
part 'favorite_bloc.freezed.dart';
class FavoriteBloc extends Bloc<FavoriteEvent, FavoriteState> {
+ FavoriteBloc() : super(FavoriteState.initial()) {
+ _dispatch();
+ }
+
final _service = FavoriteService();
final _listener = FavoriteListener();
- FavoriteBloc() : super(FavoriteState.initial()) {
+ @override
+ Future<void> close() async {
+ await _listener.stop();
+ return super.close();
+ }
+
+ void _dispatch() {
on<FavoriteEvent>(
(event, emit) async {
await event.map(
@@ -58,12 +68,6 @@ class FavoriteBloc extends Bloc<FavoriteEvent, FavoriteState> {
);
}
- @override
- Future<void> close() async {
- await _listener.stop();
- return super.close();
- }
-
void _onFavoritesUpdated(
Either<FlowyError, RepeatedViewPB> favoriteOrFailed,
bool didFavorite,
diff --git a/frontend/appflowy_flutter/lib/workspace/application/home/home_bloc.dart b/frontend/appflowy_flutter/lib/workspace/application/home/home_bloc.dart
index da218895da..98e8bcf08e 100644
--- a/frontend/appflowy_flutter/lib/workspace/application/home/home_bloc.dart
+++ b/frontend/appflowy_flutter/lib/workspace/application/home/home_bloc.dart
@@ -1,22 +1,29 @@
import 'package:appflowy/user/application/user_listener.dart';
-import 'package:flowy_infra/time/duration.dart';
import 'package:appflowy_backend/log.dart';
import 'package:appflowy_backend/protobuf/flowy-folder/view.pb.dart';
import 'package:appflowy_backend/protobuf/flowy-folder/workspace.pb.dart'
show WorkspaceSettingPB;
-import 'package:appflowy_backend/protobuf/flowy-user/user_profile.pb.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
+import 'package:flowy_infra/time/duration.dart';
import 'package:freezed_annotation/freezed_annotation.dart';
part 'home_bloc.freezed.dart';
class HomeBloc extends Bloc<HomeEvent, HomeState> {
+ HomeBloc(WorkspaceSettingPB workspaceSetting)
+ : _workspaceListener = UserWorkspaceListener(),
+ super(HomeState.initial(workspaceSetting)) {
+ _dispatch(workspaceSetting);
+ }
+
final UserWorkspaceListener _workspaceListener;
- HomeBloc(
- UserProfilePB userProfile,
- WorkspaceSettingPB workspaceSetting,
- ) : _workspaceListener = UserWorkspaceListener(userProfile: userProfile),
- super(HomeState.initial(workspaceSetting)) {
+ @override
+ Future<void> close() async {
+ await _workspaceListener.stop();
+ return super.close();
+ }
+
+ void _dispatch(WorkspaceSettingPB workspaceSetting) {
on<HomeEvent>(
(event, emit) async {
await event.map(
@@ -56,12 +63,6 @@ class HomeBloc extends Bloc<HomeEvent, HomeState> {
},
);
}
-
- @override
- Future<void> close() async {
- await _workspaceListener.stop();
- return super.close();
- }
}
enum MenuResizeType {
@@ -100,6 +101,5 @@ class HomeState with _$HomeState {
factory HomeState.initial(WorkspaceSettingPB workspaceSetting) => HomeState(
isLoading: false,
workspaceSetting: workspaceSetting,
- latestView: null,
);
}
diff --git a/frontend/appflowy_flutter/lib/workspace/application/home/home_setting_bloc.dart b/frontend/appflowy_flutter/lib/workspace/application/home/home_setting_bloc.dart
index e8f616302d..90531f1b9f 100644
--- a/frontend/appflowy_flutter/lib/workspace/application/home/home_setting_bloc.dart
+++ b/frontend/appflowy_flutter/lib/workspace/application/home/home_setting_bloc.dart
@@ -1,9 +1,8 @@
import 'package:appflowy/user/application/user_listener.dart';
-import 'package:appflowy/workspace/application/settings/appearance/appearance_cubit.dart';
import 'package:appflowy/workspace/application/edit_panel/edit_context.dart';
+import 'package:appflowy/workspace/application/settings/appearance/appearance_cubit.dart';
import 'package:appflowy_backend/protobuf/flowy-folder/workspace.pb.dart'
show WorkspaceSettingPB;
-import 'package:appflowy_backend/protobuf/flowy-user/user_profile.pb.dart';
import 'package:dartz/dartz.dart';
import 'package:flowy_infra/size.dart';
import 'package:flowy_infra/time/duration.dart';
@@ -13,15 +12,11 @@ import 'package:freezed_annotation/freezed_annotation.dart';
part 'home_setting_bloc.freezed.dart';
class HomeSettingBloc extends Bloc<HomeSettingEvent, HomeSettingState> {
- final UserWorkspaceListener _listener;
- final AppearanceSettingsCubit _appearanceSettingsCubit;
-
HomeSettingBloc(
- UserProfilePB user,
WorkspaceSettingPB workspaceSetting,
AppearanceSettingsCubit appearanceSettingsCubit,
double screenWidthPx,
- ) : _listener = UserWorkspaceListener(userProfile: user),
+ ) : _listener = UserWorkspaceListener(),
_appearanceSettingsCubit = appearanceSettingsCubit,
super(
HomeSettingState.initial(
@@ -30,6 +25,19 @@ class HomeSettingBloc extends Bloc<HomeSettingEvent, HomeSettingState> {
screenWidthPx,
),
) {
+ _dispatch();
+ }
+
+ final UserWorkspaceListener _listener;
+ final AppearanceSettingsCubit _appearanceSettingsCubit;
+
+ @override
+ Future<void> close() async {
+ await _listener.stop();
+ return super.close();
+ }
+
+ void _dispatch() {
on<HomeSettingEvent>(
(event, emit) async {
await event.map(
@@ -92,12 +100,6 @@ class HomeSettingBloc extends Bloc<HomeSettingEvent, HomeSettingState> {
},
);
}
-
- @override
- Future<void> close() async {
- await _listener.stop();
- return super.close();
- }
}
enum MenuResizeType {
diff --git a/frontend/appflowy_flutter/lib/workspace/application/menu/menu_bloc.dart b/frontend/appflowy_flutter/lib/workspace/application/menu/menu_bloc.dart
index 281b19f10f..3816dfb87d 100644
--- a/frontend/appflowy_flutter/lib/workspace/application/menu/menu_bloc.dart
+++ b/frontend/appflowy_flutter/lib/workspace/application/menu/menu_bloc.dart
@@ -13,73 +13,77 @@ import 'package:freezed_annotation/freezed_annotation.dart';
part 'menu_bloc.freezed.dart';
class MenuBloc extends Bloc<MenuEvent, MenuState> {
- final WorkspaceService _workspaceService;
- final WorkspaceListener _listener;
- final UserProfilePB user;
- final String workspaceId;
-
- MenuBloc({
- required this.user,
- required this.workspaceId,
- }) : _workspaceService = WorkspaceService(workspaceId: workspaceId),
+ MenuBloc({required this.user, required this.workspaceId})
+ : _workspaceService = WorkspaceService(workspaceId: workspaceId),
_listener = WorkspaceListener(
user: user,
workspaceId: workspaceId,
),
super(MenuState.initial()) {
- on<MenuEvent>((event, emit) async {
- await event.map(
- initial: (e) async {
- _listener.start(appsChanged: _handleAppsOrFail);
- await _fetchApps(emit);
- },
- createApp: (_CreateApp event) async {
- final result = await _workspaceService.createApp(
- name: event.name,
- desc: event.desc,
- index: event.index,
- );
- result.fold(
- (app) => emit(state.copyWith(lastCreatedView: app)),
- (error) {
- Log.error(error);
- emit(state.copyWith(successOrFailure: right(error)));
- },
- );
- },
- didReceiveApps: (e) async {
- emit(
- e.appsOrFail.fold(
- (views) =>
- state.copyWith(views: views, successOrFailure: left(unit)),
- (err) => state.copyWith(successOrFailure: right(err)),
- ),
- );
- },
- moveApp: (_MoveApp value) {
- if (state.views.length > value.fromIndex) {
- final view = state.views[value.fromIndex];
- _workspaceService.moveApp(
- appId: view.id,
- fromIndex: value.fromIndex,
- toIndex: value.toIndex,
- );
- final apps = List<ViewPB>.from(state.views);
-
- apps.insert(value.toIndex, apps.removeAt(value.fromIndex));
- emit(state.copyWith(views: apps));
- }
- },
- );
- });
+ _dispatch();
}
+ final WorkspaceService _workspaceService;
+ final WorkspaceListener _listener;
+ final UserProfilePB user;
+ final String workspaceId;
+
@override
Future<void> close() async {
await _listener.stop();
return super.close();
}
+ void _dispatch() {
+ on<MenuEvent>(
+ (event, emit) async {
+ await event.map(
+ initial: (e) async {
+ _listener.start(appsChanged: _handleAppsOrFail);
+ await _fetchApps(emit);
+ },
+ createApp: (_CreateApp event) async {
+ final result = await _workspaceService.createApp(
+ name: event.name,
+ desc: event.desc,
+ index: event.index,
+ );
+ result.fold(
+ (app) => emit(state.copyWith(lastCreatedView: app)),
+ (error) {
+ Log.error(error);
+ emit(state.copyWith(successOrFailure: right(error)));
+ },
+ );
+ },
+ didReceiveApps: (e) async {
+ emit(
+ e.appsOrFail.fold(
+ (views) =>
+ state.copyWith(views: views, successOrFailure: left(unit)),
+ (err) => state.copyWith(successOrFailure: right(err)),
+ ),
+ );
+ },
+ moveApp: (_MoveApp value) {
+ if (state.views.length > value.fromIndex) {
+ final view = state.views[value.fromIndex];
+ _workspaceService.moveApp(
+ appId: view.id,
+ fromIndex: value.fromIndex,
+ toIndex: value.toIndex,
+ );
+ final apps = List<ViewPB>.from(state.views);
+
+ apps.insert(value.toIndex, apps.removeAt(value.fromIndex));
+ emit(state.copyWith(views: apps));
+ }
+ },
+ );
+ },
+ );
+ }
+
// ignore: unused_element
Future<void> _fetchApps(Emitter<MenuState> emit) async {
final viewsOrError = await _workspaceService.getViews();
@@ -124,6 +128,5 @@ class MenuState with _$MenuState {
factory MenuState.initial() => MenuState(
views: [],
successOrFailure: left(unit),
- lastCreatedView: null,
);
}
diff --git a/frontend/appflowy_flutter/lib/workspace/application/menu/menu_user_bloc.dart b/frontend/appflowy_flutter/lib/workspace/application/menu/menu_user_bloc.dart
index 5488208316..987b1d3fab 100644
--- a/frontend/appflowy_flutter/lib/workspace/application/menu/menu_user_bloc.dart
+++ b/frontend/appflowy_flutter/lib/workspace/application/menu/menu_user_bloc.dart
@@ -1,51 +1,29 @@
import 'package:appflowy/user/application/user_listener.dart';
import 'package:appflowy/user/application/user_service.dart';
import 'package:appflowy_backend/log.dart';
-import 'package:appflowy_backend/protobuf/flowy-folder/workspace.pb.dart';
import 'package:appflowy_backend/protobuf/flowy-error/errors.pb.dart';
+import 'package:appflowy_backend/protobuf/flowy-folder/workspace.pb.dart';
import 'package:appflowy_backend/protobuf/flowy-user/user_profile.pb.dart';
+import 'package:dartz/dartz.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:freezed_annotation/freezed_annotation.dart';
-import 'package:dartz/dartz.dart';
part 'menu_user_bloc.freezed.dart';
class MenuUserBloc extends Bloc<MenuUserEvent, MenuUserState> {
- final UserBackendService _userService;
- final UserListener _userListener;
- final UserWorkspaceListener _userWorkspaceListener;
- final UserProfilePB userProfile;
-
MenuUserBloc(this.userProfile)
: _userListener = UserListener(userProfile: userProfile),
- _userWorkspaceListener =
- UserWorkspaceListener(userProfile: userProfile),
+ _userWorkspaceListener = UserWorkspaceListener(),
_userService = UserBackendService(userId: userProfile.id),
super(MenuUserState.initial(userProfile)) {
- on<MenuUserEvent>((event, emit) async {
- await event.when(
- initial: () async {
- _userListener.start(onProfileUpdated: _profileUpdated);
- await _initUser();
- },
- fetchWorkspaces: () async {
- //
- },
- didReceiveUserProfile: (UserProfilePB newUserProfile) {
- emit(state.copyWith(userProfile: newUserProfile));
- },
- updateUserName: (String name) {
- _userService.updateUserProfile(name: name).then((result) {
- result.fold(
- (l) => null,
- (err) => Log.error(err),
- );
- });
- },
- );
- });
+ _dispatch();
}
+ final UserBackendService _userService;
+ final UserListener _userListener;
+ final UserWorkspaceListener _userWorkspaceListener;
+ final UserProfilePB userProfile;
+
@override
Future<void> close() async {
await _userListener.stop();
@@ -53,6 +31,33 @@ class MenuUserBloc extends Bloc<MenuUserEvent, MenuUserState> {
super.close();
}
+ void _dispatch() {
+ on<MenuUserEvent>(
+ (event, emit) async {
+ await event.when(
+ initial: () async {
+ _userListener.start(onProfileUpdated: _profileUpdated);
+ await _initUser();
+ },
+ fetchWorkspaces: () async {
+ //
+ },
+ didReceiveUserProfile: (UserProfilePB newUserProfile) {
+ emit(state.copyWith(userProfile: newUserProfile));
+ },
+ updateUserName: (String name) {
+ _userService.updateUserProfile(name: name).then((result) {
+ result.fold(
+ (l) => null,
+ (err) => Log.error(err),
+ );
+ });
+ },
+ );
+ },
+ );
+ }
+
Future<void> _initUser() async {
final result = await _userService.initUser();
result.fold((l) => null, (error) => Log.error(error));
diff --git a/frontend/appflowy_flutter/lib/workspace/application/notifications/notification_action_bloc.dart b/frontend/appflowy_flutter/lib/workspace/application/notifications/notification_action_bloc.dart
index ab837deee6..831c2ed83f 100644
--- a/frontend/appflowy_flutter/lib/workspace/application/notifications/notification_action_bloc.dart
+++ b/frontend/appflowy_flutter/lib/workspace/application/notifications/notification_action_bloc.dart
@@ -38,6 +38,10 @@ class NotificationActionEvent with _$NotificationActionEvent {
}
class NotificationActionState {
+ const NotificationActionState.initial()
+ : action = null,
+ nextActions = const [];
+
const NotificationActionState({
required this.action,
this.nextActions = const [],
@@ -46,10 +50,6 @@ class NotificationActionState {
final NotificationAction? action;
final List<NotificationAction> nextActions;
- const NotificationActionState.initial()
- : action = null,
- nextActions = const [];
-
NotificationActionState copyWith({
NotificationAction? action,
List<NotificationAction>? nextActions,
diff --git a/frontend/appflowy_flutter/lib/workspace/application/notifications/notification_service.dart b/frontend/appflowy_flutter/lib/workspace/application/notifications/notification_service.dart
index d85b644f78..13d0820314 100644
--- a/frontend/appflowy_flutter/lib/workspace/application/notifications/notification_service.dart
+++ b/frontend/appflowy_flutter/lib/workspace/application/notifications/notification_service.dart
@@ -14,7 +14,6 @@ class NotificationService {
static Future<void> initialize() async {
await localNotifier.setup(
appName: _appName,
- shortcutPolicy: ShortcutPolicy.requireCreate, // Windows Specific
);
}
}
diff --git a/frontend/appflowy_flutter/lib/workspace/application/recent/recent_views_bloc.dart b/frontend/appflowy_flutter/lib/workspace/application/recent/recent_views_bloc.dart
index 729a36fdf9..32496b1c45 100644
--- a/frontend/appflowy_flutter/lib/workspace/application/recent/recent_views_bloc.dart
+++ b/frontend/appflowy_flutter/lib/workspace/application/recent/recent_views_bloc.dart
@@ -10,10 +10,20 @@ import 'package:freezed_annotation/freezed_annotation.dart';
part 'recent_views_bloc.freezed.dart';
class RecentViewsBloc extends Bloc<RecentViewsEvent, RecentViewsState> {
+ RecentViewsBloc() : super(RecentViewsState.initial()) {
+ _dispatch();
+ }
+
final _service = RecentService();
final _listener = RecentViewsListener();
- RecentViewsBloc() : super(RecentViewsState.initial()) {
+ @override
+ Future<void> close() async {
+ await _listener.stop();
+ return super.close();
+ }
+
+ void _dispatch() {
on<RecentViewsEvent>(
(event, emit) async {
await event.map(
@@ -43,12 +53,6 @@ class RecentViewsBloc extends Bloc<RecentViewsEvent, RecentViewsState> {
);
}
- @override
- Future<void> close() async {
- await _listener.stop();
- return super.close();
- }
-
void _onRecentViewsUpdated(
Either<FlowyError, RepeatedViewIdPB> result,
) {
diff --git a/frontend/appflowy_flutter/lib/workspace/application/settings/appearance/appearance_cubit.dart b/frontend/appflowy_flutter/lib/workspace/application/settings/appearance/appearance_cubit.dart
index 5db1e7603d..858f354a56 100644
--- a/frontend/appflowy_flutter/lib/workspace/application/settings/appearance/appearance_cubit.dart
+++ b/frontend/appflowy_flutter/lib/workspace/application/settings/appearance/appearance_cubit.dart
@@ -26,9 +26,6 @@ part 'appearance_cubit.freezed.dart';
/// - [UserTimeFormatPB]
///
class AppearanceSettingsCubit extends Cubit<AppearanceSettingsState> {
- final AppearanceSettingsPB _appearanceSettings;
- final DateTimeSettingsPB _dateTimeSettings;
-
AppearanceSettingsCubit(
AppearanceSettingsPB appearanceSettings,
DateTimeSettingsPB dateTimeSettings,
@@ -52,9 +49,7 @@ class AppearanceSettingsCubit extends Cubit<AppearanceSettingsState> {
appearanceSettings.documentSetting.cursorColor.isEmpty
? null
: Color(
- int.parse(
- appearanceSettings.documentSetting.cursorColor,
- ),
+ int.parse(appearanceSettings.documentSetting.cursorColor),
),
appearanceSettings.documentSetting.selectionColor.isEmpty
? null
@@ -66,6 +61,9 @@ class AppearanceSettingsCubit extends Cubit<AppearanceSettingsState> {
),
);
+ final AppearanceSettingsPB _appearanceSettings;
+ final DateTimeSettingsPB _dateTimeSettings;
+
/// Update selected theme in the user's settings and emit an updated state
/// with the AppTheme named [themeName].
Future<void> setTheme(String themeName) async {
diff --git a/frontend/appflowy_flutter/lib/workspace/application/settings/appflowy_cloud_setting_bloc.dart b/frontend/appflowy_flutter/lib/workspace/application/settings/appflowy_cloud_setting_bloc.dart
index 4777cbcae8..eb9cf6f330 100644
--- a/frontend/appflowy_flutter/lib/workspace/application/settings/appflowy_cloud_setting_bloc.dart
+++ b/frontend/appflowy_flutter/lib/workspace/application/settings/appflowy_cloud_setting_bloc.dart
@@ -3,55 +3,62 @@ import 'package:appflowy/workspace/application/settings/cloud_setting_listener.d
import 'package:appflowy_backend/dispatch/dispatch.dart';
import 'package:appflowy_backend/log.dart';
import 'package:appflowy_backend/protobuf/flowy-user/user_setting.pb.dart';
+import 'package:dartz/dartz.dart';
import 'package:easy_localization/easy_localization.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:freezed_annotation/freezed_annotation.dart';
-import 'package:dartz/dartz.dart';
part 'appflowy_cloud_setting_bloc.freezed.dart';
class AppFlowyCloudSettingBloc
extends Bloc<AppFlowyCloudSettingEvent, AppFlowyCloudSettingState> {
- final UserCloudConfigListener _listener;
AppFlowyCloudSettingBloc(CloudSettingPB setting)
: _listener = UserCloudConfigListener(),
super(AppFlowyCloudSettingState.initial(setting)) {
- on<AppFlowyCloudSettingEvent>((event, emit) async {
- await event.when(
- initial: () async {
- _listener.start(
- onSettingChanged: (result) {
- if (isClosed) {
- return;
- }
- result.fold(
- (setting) =>
- add(AppFlowyCloudSettingEvent.didReceiveSetting(setting)),
- (error) => Log.error(error),
- );
- },
- );
- },
- enableSync: (isEnable) async {
- final config = UpdateCloudConfigPB.create()..enableSync = isEnable;
- await UserEventSetCloudConfig(config).send();
- },
- didReceiveSetting: (CloudSettingPB setting) {
- emit(
- state.copyWith(
- setting: setting,
- ),
- );
- },
- );
- });
+ _dispatch();
}
+ final UserCloudConfigListener _listener;
+
@override
Future<void> close() async {
_listener.stop();
return super.close();
}
+
+ void _dispatch() {
+ on<AppFlowyCloudSettingEvent>(
+ (event, emit) async {
+ await event.when(
+ initial: () async {
+ _listener.start(
+ onSettingChanged: (result) {
+ if (isClosed) {
+ return;
+ }
+ result.fold(
+ (setting) =>
+ add(AppFlowyCloudSettingEvent.didReceiveSetting(setting)),
+ (error) => Log.error(error),
+ );
+ },
+ );
+ },
+ enableSync: (isEnable) async {
+ final config = UpdateCloudConfigPB.create()..enableSync = isEnable;
+ await UserEventSetCloudConfig(config).send();
+ },
+ didReceiveSetting: (CloudSettingPB setting) {
+ emit(
+ state.copyWith(
+ setting: setting,
+ ),
+ );
+ },
+ );
+ },
+ );
+ }
}
@freezed
diff --git a/frontend/appflowy_flutter/lib/workspace/application/settings/appflowy_cloud_urls_bloc.dart b/frontend/appflowy_flutter/lib/workspace/application/settings/appflowy_cloud_urls_bloc.dart
index 9e46c50765..7d425bcb47 100644
--- a/frontend/appflowy_flutter/lib/workspace/application/settings/appflowy_cloud_urls_bloc.dart
+++ b/frontend/appflowy_flutter/lib/workspace/application/settings/appflowy_cloud_urls_bloc.dart
@@ -2,10 +2,10 @@ import 'package:appflowy/env/backend_env.dart';
import 'package:appflowy/env/cloud_env.dart';
import 'package:appflowy/generated/locale_keys.g.dart';
import 'package:appflowy/startup/startup.dart';
+import 'package:dartz/dartz.dart';
import 'package:easy_localization/easy_localization.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:freezed_annotation/freezed_annotation.dart';
-import 'package:dartz/dartz.dart';
part 'appflowy_cloud_urls_bloc.freezed.dart';
diff --git a/frontend/appflowy_flutter/lib/workspace/application/settings/cloud_setting_listener.dart b/frontend/appflowy_flutter/lib/workspace/application/settings/cloud_setting_listener.dart
index a67da1a43d..f23d5aacf0 100644
--- a/frontend/appflowy_flutter/lib/workspace/application/settings/cloud_setting_listener.dart
+++ b/frontend/appflowy_flutter/lib/workspace/application/settings/cloud_setting_listener.dart
@@ -10,11 +10,11 @@ import 'package:dartz/dartz.dart';
import '../../../core/notification/user_notification.dart';
class UserCloudConfigListener {
- StreamSubscription<SubscribeObject>? _subscription;
- void Function(Either<CloudSettingPB, FlowyError>)? _onSettingChanged;
+ UserCloudConfigListener();
UserNotificationParser? _userParser;
- UserCloudConfigListener();
+ StreamSubscription<SubscribeObject>? _subscription;
+ void Function(Either<CloudSettingPB, FlowyError>)? _onSettingChanged;
void start({
void Function(Either<CloudSettingPB, FlowyError>)? onSettingChanged,
diff --git a/frontend/appflowy_flutter/lib/workspace/application/settings/notifications/notification_settings_cubit.dart b/frontend/appflowy_flutter/lib/workspace/application/settings/notifications/notification_settings_cubit.dart
index b495845909..956b077c1f 100644
--- a/frontend/appflowy_flutter/lib/workspace/application/settings/notifications/notification_settings_cubit.dart
+++ b/frontend/appflowy_flutter/lib/workspace/application/settings/notifications/notification_settings_cubit.dart
@@ -9,10 +9,6 @@ import 'package:freezed_annotation/freezed_annotation.dart';
part 'notification_settings_cubit.freezed.dart';
class NotificationSettingsCubit extends Cubit<NotificationSettingsState> {
- final Completer<void> _initCompleter = Completer();
-
- late final NotificationSettingsPB _notificationSettings;
-
NotificationSettingsCubit() : super(NotificationSettingsState.initial()) {
UserSettingsBackendService()
.getNotificationSettings()
@@ -27,6 +23,10 @@ class NotificationSettingsCubit extends Cubit<NotificationSettingsState> {
});
}
+ final Completer<void> _initCompleter = Completer();
+
+ late final NotificationSettingsPB _notificationSettings;
+
Future<void> toggleNotificationsEnabled() async {
await _initCompleter.future;
diff --git a/frontend/appflowy_flutter/lib/workspace/application/settings/settings_dialog_bloc.dart b/frontend/appflowy_flutter/lib/workspace/application/settings/settings_dialog_bloc.dart
index 91a4fbcec4..3e37d7c030 100644
--- a/frontend/appflowy_flutter/lib/workspace/application/settings/settings_dialog_bloc.dart
+++ b/frontend/appflowy_flutter/lib/workspace/application/settings/settings_dialog_bloc.dart
@@ -2,9 +2,9 @@ import 'package:appflowy/user/application/user_listener.dart';
import 'package:appflowy_backend/log.dart';
import 'package:appflowy_backend/protobuf/flowy-error/errors.pb.dart';
import 'package:appflowy_backend/protobuf/flowy-user/user_profile.pb.dart';
+import 'package:dartz/dartz.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:freezed_annotation/freezed_annotation.dart';
-import 'package:dartz/dartz.dart';
part 'settings_dialog_bloc.freezed.dart';
@@ -20,33 +20,39 @@ enum SettingsPage {
class SettingsDialogBloc
extends Bloc<SettingsDialogEvent, SettingsDialogState> {
- final UserListener _userListener;
- final UserProfilePB userProfile;
-
SettingsDialogBloc(this.userProfile)
: _userListener = UserListener(userProfile: userProfile),
super(SettingsDialogState.initial(userProfile)) {
- on<SettingsDialogEvent>((event, emit) async {
- await event.when(
- initial: () async {
- _userListener.start(onProfileUpdated: _profileUpdated);
- },
- didReceiveUserProfile: (UserProfilePB newUserProfile) {
- emit(state.copyWith(userProfile: newUserProfile));
- },
- setSelectedPage: (SettingsPage page) {
- emit(state.copyWith(page: page));
- },
- );
- });
+ _dispatch();
}
+ final UserProfilePB userProfile;
+ final UserListener _userListener;
+
@override
Future<void> close() async {
await _userListener.stop();
super.close();
}
+ void _dispatch() {
+ on<SettingsDialogEvent>(
+ (event, emit) async {
+ await event.when(
+ initial: () async {
+ _userListener.start(onProfileUpdated: _profileUpdated);
+ },
+ didReceiveUserProfile: (UserProfilePB newUserProfile) {
+ emit(state.copyWith(userProfile: newUserProfile));
+ },
+ setSelectedPage: (SettingsPage page) {
+ emit(state.copyWith(page: page));
+ },
+ );
+ },
+ );
+ }
+
void _profileUpdated(Either<UserProfilePB, FlowyError> userProfileOrFailed) {
userProfileOrFailed.fold(
(newUserProfile) =>
diff --git a/frontend/appflowy_flutter/lib/workspace/application/settings/share/import_service.dart b/frontend/appflowy_flutter/lib/workspace/application/settings/share/import_service.dart
index 5155aaae02..9628ea104d 100644
--- a/frontend/appflowy_flutter/lib/workspace/application/settings/share/import_service.dart
+++ b/frontend/appflowy_flutter/lib/workspace/application/settings/share/import_service.dart
@@ -17,7 +17,7 @@ class ImportBackendService {
..viewLayout = importType.toLayout()
..name = name
..importType = importType;
- return await FolderEventImportData(payload).send();
+ return FolderEventImportData(payload).send();
}
}
diff --git a/frontend/appflowy_flutter/lib/workspace/application/settings/shortcuts/settings_shortcuts_service.dart b/frontend/appflowy_flutter/lib/workspace/application/settings/shortcuts/settings_shortcuts_service.dart
index 688fe563ff..35809ac585 100644
--- a/frontend/appflowy_flutter/lib/workspace/application/settings/shortcuts/settings_shortcuts_service.dart
+++ b/frontend/appflowy_flutter/lib/workspace/application/settings/shortcuts/settings_shortcuts_service.dart
@@ -66,7 +66,7 @@ class SettingsShortcutService {
) async {
for (final shortcut in customizeShortcuts) {
final shortcutEvent = commandShortcuts.firstWhereOrNull(
- (s) => (s.key == shortcut.key && s.command != shortcut.command),
+ (s) => s.key == shortcut.key && s.command != shortcut.command,
);
shortcutEvent?.updateCommand(command: shortcut.command);
}
diff --git a/frontend/appflowy_flutter/lib/workspace/application/settings/shortcuts/shortcuts_model.dart b/frontend/appflowy_flutter/lib/workspace/application/settings/shortcuts/shortcuts_model.dart
index 4ad7f1d9f6..93cebf83a4 100644
--- a/frontend/appflowy_flutter/lib/workspace/application/settings/shortcuts/shortcuts_model.dart
+++ b/frontend/appflowy_flutter/lib/workspace/application/settings/shortcuts/shortcuts_model.dart
@@ -1,21 +1,17 @@
import 'package:appflowy_editor/appflowy_editor.dart';
class EditorShortcuts {
- EditorShortcuts({
- required this.commandShortcuts,
- });
-
- final List<CommandShortcutModel> commandShortcuts;
-
factory EditorShortcuts.fromJson(Map<String, dynamic> json) =>
EditorShortcuts(
commandShortcuts: List<CommandShortcutModel>.from(
- json["commandShortcuts"].map(
- (x) => CommandShortcutModel.fromJson(x),
- ),
+ json["commandShortcuts"].map((x) => CommandShortcutModel.fromJson(x)),
),
);
+ EditorShortcuts({required this.commandShortcuts});
+
+ final List<CommandShortcutModel> commandShortcuts;
+
Map<String, dynamic> toJson() => {
"commandShortcuts":
List<dynamic>.from(commandShortcuts.map((x) => x.toJson())),
@@ -23,20 +19,6 @@ class EditorShortcuts {
}
class CommandShortcutModel {
- const CommandShortcutModel({
- required this.key,
- required this.command,
- });
-
- final String key;
- final String command;
-
- factory CommandShortcutModel.fromJson(Map<String, dynamic> json) =>
- CommandShortcutModel(
- key: json["key"],
- command: (json["command"] ?? ''),
- );
-
factory CommandShortcutModel.fromCommandEvent(
CommandShortcutEvent commandShortcutEvent,
) =>
@@ -45,10 +27,18 @@ class CommandShortcutModel {
command: commandShortcutEvent.command,
);
- Map<String, dynamic> toJson() => {
- "key": key,
- "command": command,
- };
+ factory CommandShortcutModel.fromJson(Map<String, dynamic> json) =>
+ CommandShortcutModel(
+ key: json["key"],
+ command: json["command"] ?? '',
+ );
+
+ const CommandShortcutModel({required this.key, required this.command});
+
+ final String key;
+ final String command;
+
+ Map<String, dynamic> toJson() => {"key": key, "command": command};
@override
bool operator ==(Object other) =>
diff --git a/frontend/appflowy_flutter/lib/workspace/application/settings/supabase_cloud_setting_bloc.dart b/frontend/appflowy_flutter/lib/workspace/application/settings/supabase_cloud_setting_bloc.dart
index 7194e03f1e..bedd797a43 100644
--- a/frontend/appflowy_flutter/lib/workspace/application/settings/supabase_cloud_setting_bloc.dart
+++ b/frontend/appflowy_flutter/lib/workspace/application/settings/supabase_cloud_setting_bloc.dart
@@ -5,9 +5,9 @@ import 'package:appflowy/startup/startup.dart';
import 'package:appflowy_backend/dispatch/dispatch.dart';
import 'package:appflowy_backend/log.dart';
import 'package:appflowy_backend/protobuf/flowy-user/protobuf.dart';
+import 'package:dartz/dartz.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:freezed_annotation/freezed_annotation.dart';
-import 'package:dartz/dartz.dart';
import 'cloud_setting_listener.dart';
@@ -15,58 +15,64 @@ part 'supabase_cloud_setting_bloc.freezed.dart';
class SupabaseCloudSettingBloc
extends Bloc<SupabaseCloudSettingEvent, SupabaseCloudSettingState> {
- final UserCloudConfigListener _listener;
-
SupabaseCloudSettingBloc({
required CloudSettingPB setting,
}) : _listener = UserCloudConfigListener(),
super(SupabaseCloudSettingState.initial(setting)) {
- on<SupabaseCloudSettingEvent>((event, emit) async {
- await event.when(
- initial: () async {
- _listener.start(
- onSettingChanged: (result) {
- if (isClosed) {
- return;
- }
- result.fold(
- (setting) =>
- add(SupabaseCloudSettingEvent.didReceiveSetting(setting)),
- (error) => Log.error(error),
- );
- },
- );
- },
- enableSync: (bool enable) async {
- final update = UpdateCloudConfigPB.create()..enableSync = enable;
- updateCloudConfig(update);
- },
- didReceiveSetting: (CloudSettingPB setting) {
- emit(
- state.copyWith(
- setting: setting,
- loadingState: LoadingState.finish(left(unit)),
- ),
- );
- },
- enableEncrypt: (bool enable) {
- final update = UpdateCloudConfigPB.create()..enableEncrypt = enable;
- updateCloudConfig(update);
- emit(state.copyWith(loadingState: const LoadingState.loading()));
- },
- );
- });
+ _dispatch();
}
- Future<void> updateCloudConfig(UpdateCloudConfigPB setting) async {
- await UserEventSetCloudConfig(setting).send();
- }
+ final UserCloudConfigListener _listener;
@override
Future<void> close() async {
_listener.stop();
return super.close();
}
+
+ void _dispatch() {
+ on<SupabaseCloudSettingEvent>(
+ (event, emit) async {
+ await event.when(
+ initial: () async {
+ _listener.start(
+ onSettingChanged: (result) {
+ if (isClosed) {
+ return;
+ }
+ result.fold(
+ (setting) =>
+ add(SupabaseCloudSettingEvent.didReceiveSetting(setting)),
+ (error) => Log.error(error),
+ );
+ },
+ );
+ },
+ enableSync: (bool enable) async {
+ final update = UpdateCloudConfigPB.create()..enableSync = enable;
+ updateCloudConfig(update);
+ },
+ didReceiveSetting: (CloudSettingPB setting) {
+ emit(
+ state.copyWith(
+ setting: setting,
+ loadingState: LoadingState.finish(left(unit)),
+ ),
+ );
+ },
+ enableEncrypt: (bool enable) {
+ final update = UpdateCloudConfigPB.create()..enableEncrypt = enable;
+ updateCloudConfig(update);
+ emit(state.copyWith(loadingState: const LoadingState.loading()));
+ },
+ );
+ },
+ );
+ }
+
+ Future<void> updateCloudConfig(UpdateCloudConfigPB setting) async {
+ await UserEventSetCloudConfig(setting).send();
+ }
}
@freezed
diff --git a/frontend/appflowy_flutter/lib/workspace/application/settings/supabase_cloud_urls_bloc.dart b/frontend/appflowy_flutter/lib/workspace/application/settings/supabase_cloud_urls_bloc.dart
index 9922b9ce5c..0145ea93d0 100644
--- a/frontend/appflowy_flutter/lib/workspace/application/settings/supabase_cloud_urls_bloc.dart
+++ b/frontend/appflowy_flutter/lib/workspace/application/settings/supabase_cloud_urls_bloc.dart
@@ -4,10 +4,10 @@ import 'package:appflowy/generated/locale_keys.g.dart';
import 'package:appflowy/startup/startup.dart';
import 'package:appflowy_backend/dispatch/dispatch.dart';
import 'package:appflowy_backend/protobuf/flowy-user/protobuf.dart';
+import 'package:dartz/dartz.dart';
import 'package:easy_localization/easy_localization.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:freezed_annotation/freezed_annotation.dart';
-import 'package:dartz/dartz.dart';
import 'appflowy_cloud_setting_bloc.dart';
diff --git a/frontend/appflowy_flutter/lib/workspace/application/tabs/tabs_bloc.dart b/frontend/appflowy_flutter/lib/workspace/application/tabs/tabs_bloc.dart
index bc3dae67a4..4770822f1a 100644
--- a/frontend/appflowy_flutter/lib/workspace/application/tabs/tabs_bloc.dart
+++ b/frontend/appflowy_flutter/lib/workspace/application/tabs/tabs_bloc.dart
@@ -15,40 +15,45 @@ part 'tabs_state.dart';
part 'tabs_bloc.freezed.dart';
class TabsBloc extends Bloc<TabsEvent, TabsState> {
- late final MenuSharedState menuSharedState;
-
TabsBloc() : super(TabsState()) {
menuSharedState = getIt<MenuSharedState>();
+ _dispatch();
+ }
- on<TabsEvent>((event, emit) async {
- event.when(
- selectTab: (int index) {
- if (index != state.currentIndex &&
- index >= 0 &&
- index < state.pages) {
- emit(state.copyWith(newIndex: index));
+ late final MenuSharedState menuSharedState;
+
+ void _dispatch() {
+ on<TabsEvent>(
+ (event, emit) async {
+ event.when(
+ selectTab: (int index) {
+ if (index != state.currentIndex &&
+ index >= 0 &&
+ index < state.pages) {
+ emit(state.copyWith(newIndex: index));
+ _setLatestOpenView();
+ }
+ },
+ moveTab: () {},
+ closeTab: (String pluginId) {
+ emit(state.closeView(pluginId));
_setLatestOpenView();
- }
- },
- moveTab: () {},
- closeTab: (String pluginId) {
- emit(state.closeView(pluginId));
- _setLatestOpenView();
- },
- closeCurrentTab: () {
- emit(state.closeView(state.currentPageManager.plugin.id));
- _setLatestOpenView();
- },
- openTab: (Plugin plugin, ViewPB view) {
- emit(state.openView(plugin, view));
- _setLatestOpenView(view);
- },
- openPlugin: (Plugin plugin, ViewPB? view) {
- emit(state.openPlugin(plugin: plugin));
- _setLatestOpenView(view);
- },
- );
- });
+ },
+ closeCurrentTab: () {
+ emit(state.closeView(state.currentPageManager.plugin.id));
+ _setLatestOpenView();
+ },
+ openTab: (Plugin plugin, ViewPB view) {
+ emit(state.openView(plugin, view));
+ _setLatestOpenView(view);
+ },
+ openPlugin: (Plugin plugin, ViewPB? view) {
+ emit(state.openPlugin(plugin: plugin));
+ _setLatestOpenView(view);
+ },
+ );
+ },
+ );
}
void _setLatestOpenView([ViewPB? view]) {
diff --git a/frontend/appflowy_flutter/lib/workspace/application/tabs/tabs_state.dart b/frontend/appflowy_flutter/lib/workspace/application/tabs/tabs_state.dart
index 34d8dd69b1..caa9c8d3b9 100644
--- a/frontend/appflowy_flutter/lib/workspace/application/tabs/tabs_state.dart
+++ b/frontend/appflowy_flutter/lib/workspace/application/tabs/tabs_state.dart
@@ -1,18 +1,17 @@
part of 'tabs_bloc.dart';
class TabsState {
- final int currentIndex;
+ TabsState({
+ this.currentIndex = 0,
+ List<PageManager>? pageManagers,
+ }) : _pageManagers = pageManagers ?? [PageManager()];
+ final int currentIndex;
final List<PageManager> _pageManagers;
int get pages => _pageManagers.length;
PageManager get currentPageManager => _pageManagers[currentIndex];
List<PageManager> get pageManagers => _pageManagers;
- TabsState({
- this.currentIndex = 0,
- List<PageManager>? pageManagers,
- }) : _pageManagers = pageManagers ?? [PageManager()];
-
/// This opens a new tab given a [Plugin] and a [View].
///
/// If the [Plugin.id] is already associated with an open tab,
diff --git a/frontend/appflowy_flutter/lib/workspace/application/user/settings_user_bloc.dart b/frontend/appflowy_flutter/lib/workspace/application/user/settings_user_bloc.dart
index 0e7eda3580..2df746b272 100644
--- a/frontend/appflowy_flutter/lib/workspace/application/user/settings_user_bloc.dart
+++ b/frontend/appflowy_flutter/lib/workspace/application/user/settings_user_bloc.dart
@@ -10,84 +10,90 @@ import 'package:freezed_annotation/freezed_annotation.dart';
part 'settings_user_bloc.freezed.dart';
class SettingsUserViewBloc extends Bloc<SettingsUserEvent, SettingsUserState> {
- final UserBackendService _userService;
- final UserListener _userListener;
- final UserProfilePB userProfile;
-
SettingsUserViewBloc(this.userProfile)
: _userListener = UserListener(userProfile: userProfile),
_userService = UserBackendService(userId: userProfile.id),
super(SettingsUserState.initial(userProfile)) {
- on<SettingsUserEvent>((event, emit) async {
- await event.when(
- initial: () async {
- _loadUserProfile();
- _userListener.start(onProfileUpdated: _profileUpdated);
- },
- didReceiveUserProfile: (UserProfilePB newUserProfile) {
- emit(state.copyWith(userProfile: newUserProfile));
- },
- updateUserName: (String name) {
- _userService.updateUserProfile(name: name).then((result) {
- result.fold(
- (l) => null,
- (err) => Log.error(err),
- );
- });
- },
- updateUserIcon: (String iconUrl) {
- _userService.updateUserProfile(iconUrl: iconUrl).then((result) {
- result.fold(
- (l) => null,
- (err) => Log.error(err),
- );
- });
- },
- removeUserIcon: () {
- // Empty Icon URL = No icon
- _userService.updateUserProfile(iconUrl: "").then((result) {
- result.fold(
- (l) => null,
- (err) => Log.error(err),
- );
- });
- },
- updateUserOpenAIKey: (openAIKey) {
- _userService.updateUserProfile(openAIKey: openAIKey).then((result) {
- result.fold(
- (l) => null,
- (err) => Log.error(err),
- );
- });
- },
- updateUserStabilityAIKey: (stabilityAIKey) {
- _userService
- .updateUserProfile(stabilityAiKey: stabilityAIKey)
- .then((result) {
- result.fold(
- (l) => null,
- (err) => Log.error(err),
- );
- });
- },
- updateUserEmail: (String email) {
- _userService.updateUserProfile(email: email).then((result) {
- result.fold(
- (l) => null,
- (err) => Log.error(err),
- );
- });
- },
- );
- });
+ _dispatch();
}
+ final UserBackendService _userService;
+ final UserListener _userListener;
+ final UserProfilePB userProfile;
+
@override
Future<void> close() async {
await _userListener.stop();
super.close();
}
+ void _dispatch() {
+ on<SettingsUserEvent>(
+ (event, emit) async {
+ await event.when(
+ initial: () async {
+ _loadUserProfile();
+ _userListener.start(onProfileUpdated: _profileUpdated);
+ },
+ didReceiveUserProfile: (UserProfilePB newUserProfile) {
+ emit(state.copyWith(userProfile: newUserProfile));
+ },
+ updateUserName: (String name) {
+ _userService.updateUserProfile(name: name).then((result) {
+ result.fold(
+ (l) => null,
+ (err) => Log.error(err),
+ );
+ });
+ },
+ updateUserIcon: (String iconUrl) {
+ _userService.updateUserProfile(iconUrl: iconUrl).then((result) {
+ result.fold(
+ (l) => null,
+ (err) => Log.error(err),
+ );
+ });
+ },
+ removeUserIcon: () {
+ // Empty Icon URL = No icon
+ _userService.updateUserProfile(iconUrl: "").then((result) {
+ result.fold(
+ (l) => null,
+ (err) => Log.error(err),
+ );
+ });
+ },
+ updateUserOpenAIKey: (openAIKey) {
+ _userService.updateUserProfile(openAIKey: openAIKey).then((result) {
+ result.fold(
+ (l) => null,
+ (err) => Log.error(err),
+ );
+ });
+ },
+ updateUserStabilityAIKey: (stabilityAIKey) {
+ _userService
+ .updateUserProfile(stabilityAiKey: stabilityAIKey)
+ .then((result) {
+ result.fold(
+ (l) => null,
+ (err) => Log.error(err),
+ );
+ });
+ },
+ updateUserEmail: (String email) {
+ _userService.updateUserProfile(email: email).then((result) {
+ result.fold(
+ (l) => null,
+ (err) => Log.error(err),
+ );
+ });
+ },
+ );
+ },
+ );
+ }
+
void _loadUserProfile() {
UserBackendService.getCurrentUserProfile().then((result) {
if (isClosed) {
diff --git a/frontend/appflowy_flutter/lib/workspace/application/view/view_bloc.dart b/frontend/appflowy_flutter/lib/workspace/application/view/view_bloc.dart
index a22cee33e8..638fe68e70 100644
--- a/frontend/appflowy_flutter/lib/workspace/application/view/view_bloc.dart
+++ b/frontend/appflowy_flutter/lib/workspace/application/view/view_bloc.dart
@@ -18,167 +18,19 @@ import 'package:protobuf/protobuf.dart';
part 'view_bloc.freezed.dart';
class ViewBloc extends Bloc<ViewEvent, ViewState> {
- final ViewBackendService viewBackendSvc;
- final ViewListener listener;
- final FavoriteListener favoriteListener;
- final ViewPB view;
-
- ViewBloc({
- required this.view,
- }) : viewBackendSvc = ViewBackendService(),
+ ViewBloc({required this.view})
+ : viewBackendSvc = ViewBackendService(),
listener = ViewListener(viewId: view.id),
favoriteListener = FavoriteListener(),
super(ViewState.init(view)) {
- on<ViewEvent>((event, emit) async {
- await event.map(
- initial: (e) async {
- listener.start(
- onViewUpdated: (result) {
- add(ViewEvent.viewDidUpdate(left(result)));
- },
- onViewChildViewsUpdated: (result) async {
- final view = await _updateChildViews(result);
- if (!isClosed && view != null) {
- add(ViewEvent.viewUpdateChildView(view));
- }
- },
- );
- favoriteListener.start(
- favoritesUpdated: (result, isFavorite) {
- result.fold((error) {}, (result) {
- final current =
- result.items.firstWhereOrNull((v) => v.id == state.view.id);
- if (current != null) {
- add(ViewEvent.viewDidUpdate(left(current)));
- }
- });
- },
- );
- final isExpanded = await _getViewIsExpanded(view);
- emit(state.copyWith(isExpanded: isExpanded));
- await _loadViewsWhenExpanded(emit, isExpanded);
- },
- setIsEditing: (e) {
- emit(state.copyWith(isEditing: e.isEditing));
- },
- setIsExpanded: (e) async {
- if (e.isExpanded && !state.isExpanded) {
- await _loadViewsWhenExpanded(emit, true);
- } else {
- emit(state.copyWith(isExpanded: e.isExpanded));
- }
- await _setViewIsExpanded(view, e.isExpanded);
- },
- viewDidUpdate: (e) async {
- final result = await ViewBackendService.getView(
- view.id,
- );
- final view_ = result.fold((l) => l, (r) => null);
- e.result.fold(
- (view) async {
- // ignore child view changes because it only contains one level
- // children data.
- if (_isSameViewIgnoreChildren(view, state.view)) {
- // do nothing.
- }
- emit(
- state.copyWith(
- view: view_ ?? view,
- successOrFailure: left(unit),
- ),
- );
- },
- (error) => emit(
- state.copyWith(successOrFailure: right(error)),
- ),
- );
- },
- rename: (e) async {
- final result = await ViewBackendService.updateView(
- viewId: view.id,
- name: e.newName,
- );
- emit(
- result.fold(
- (l) {
- final view = state.view;
- view.freeze();
- final newView = view.rebuild(
- (b) => b.name = e.newName,
- );
- return state.copyWith(
- successOrFailure: left(unit),
- view: newView,
- );
- },
- (error) => state.copyWith(successOrFailure: right(error)),
- ),
- );
- },
- delete: (e) async {
- final result = await ViewBackendService.delete(viewId: view.id);
- emit(
- result.fold(
- (l) => state.copyWith(successOrFailure: left(unit)),
- (error) => state.copyWith(successOrFailure: right(error)),
- ),
- );
- RecentService().updateRecentViews([view.id], false);
- },
- duplicate: (e) async {
- final result = await ViewBackendService.duplicate(view: view);
- emit(
- result.fold(
- (l) => state.copyWith(successOrFailure: left(unit)),
- (error) => state.copyWith(successOrFailure: right(error)),
- ),
- );
- },
- move: (value) async {
- final result = await ViewBackendService.moveViewV2(
- viewId: value.from.id,
- newParentId: value.newParentId,
- prevViewId: value.prevId,
- );
- emit(
- result.fold(
- (l) => state.copyWith(successOrFailure: left(unit)),
- (error) => state.copyWith(successOrFailure: right(error)),
- ),
- );
- },
- createView: (e) async {
- final result = await ViewBackendService.createView(
- parentViewId: view.id,
- name: e.name,
- desc: '',
- layoutType: e.layoutType,
- initialDataBytes: null,
- ext: {},
- openAfterCreate: e.openAfterCreated,
- );
-
- emit(
- result.fold(
- (view) => state.copyWith(
- lastCreatedView: view,
- successOrFailure: left(unit),
- ),
- (error) => state.copyWith(successOrFailure: right(error)),
- ),
- );
- },
- viewUpdateChildView: (e) async {
- emit(
- state.copyWith(
- view: e.result,
- ),
- );
- },
- );
- });
+ _dispatch();
}
+ final ViewPB view;
+ final ViewBackendService viewBackendSvc;
+ final ViewListener listener;
+ final FavoriteListener favoriteListener;
+
@override
Future<void> close() async {
await listener.stop();
@@ -186,6 +38,158 @@ class ViewBloc extends Bloc<ViewEvent, ViewState> {
return super.close();
}
+ void _dispatch() {
+ on<ViewEvent>(
+ (event, emit) async {
+ await event.map(
+ initial: (e) async {
+ listener.start(
+ onViewUpdated: (result) {
+ add(ViewEvent.viewDidUpdate(left(result)));
+ },
+ onViewChildViewsUpdated: (result) async {
+ final view = await _updateChildViews(result);
+ if (!isClosed && view != null) {
+ add(ViewEvent.viewUpdateChildView(view));
+ }
+ },
+ );
+ favoriteListener.start(
+ favoritesUpdated: (result, isFavorite) {
+ result.fold((error) {}, (result) {
+ final current = result.items
+ .firstWhereOrNull((v) => v.id == state.view.id);
+ if (current != null) {
+ add(ViewEvent.viewDidUpdate(left(current)));
+ }
+ });
+ },
+ );
+ final isExpanded = await _getViewIsExpanded(view);
+ emit(state.copyWith(isExpanded: isExpanded));
+ await _loadViewsWhenExpanded(emit, isExpanded);
+ },
+ setIsEditing: (e) {
+ emit(state.copyWith(isEditing: e.isEditing));
+ },
+ setIsExpanded: (e) async {
+ if (e.isExpanded && !state.isExpanded) {
+ await _loadViewsWhenExpanded(emit, true);
+ } else {
+ emit(state.copyWith(isExpanded: e.isExpanded));
+ }
+ await _setViewIsExpanded(view, e.isExpanded);
+ },
+ viewDidUpdate: (e) async {
+ final result = await ViewBackendService.getView(
+ view.id,
+ );
+ final view_ = result.fold((l) => l, (r) => null);
+ e.result.fold(
+ (view) async {
+ // ignore child view changes because it only contains one level
+ // children data.
+ if (_isSameViewIgnoreChildren(view, state.view)) {
+ // do nothing.
+ }
+ emit(
+ state.copyWith(
+ view: view_ ?? view,
+ successOrFailure: left(unit),
+ ),
+ );
+ },
+ (error) => emit(
+ state.copyWith(successOrFailure: right(error)),
+ ),
+ );
+ },
+ rename: (e) async {
+ final result = await ViewBackendService.updateView(
+ viewId: view.id,
+ name: e.newName,
+ );
+ emit(
+ result.fold(
+ (l) {
+ final view = state.view;
+ view.freeze();
+ final newView = view.rebuild(
+ (b) => b.name = e.newName,
+ );
+ return state.copyWith(
+ successOrFailure: left(unit),
+ view: newView,
+ );
+ },
+ (error) => state.copyWith(successOrFailure: right(error)),
+ ),
+ );
+ },
+ delete: (e) async {
+ final result = await ViewBackendService.delete(viewId: view.id);
+ emit(
+ result.fold(
+ (l) => state.copyWith(successOrFailure: left(unit)),
+ (error) => state.copyWith(successOrFailure: right(error)),
+ ),
+ );
+ RecentService().updateRecentViews([view.id], false);
+ },
+ duplicate: (e) async {
+ final result = await ViewBackendService.duplicate(view: view);
+ emit(
+ result.fold(
+ (l) => state.copyWith(successOrFailure: left(unit)),
+ (error) => state.copyWith(successOrFailure: right(error)),
+ ),
+ );
+ },
+ move: (value) async {
+ final result = await ViewBackendService.moveViewV2(
+ viewId: value.from.id,
+ newParentId: value.newParentId,
+ prevViewId: value.prevId,
+ );
+ emit(
+ result.fold(
+ (l) => state.copyWith(successOrFailure: left(unit)),
+ (error) => state.copyWith(successOrFailure: right(error)),
+ ),
+ );
+ },
+ createView: (e) async {
+ final result = await ViewBackendService.createView(
+ parentViewId: view.id,
+ name: e.name,
+ desc: '',
+ layoutType: e.layoutType,
+ ext: {},
+ openAfterCreate: e.openAfterCreated,
+ );
+
+ emit(
+ result.fold(
+ (view) => state.copyWith(
+ lastCreatedView: view,
+ successOrFailure: left(unit),
+ ),
+ (error) => state.copyWith(successOrFailure: right(error)),
+ ),
+ );
+ },
+ viewUpdateChildView: (e) async {
+ emit(
+ state.copyWith(
+ view: e.result,
+ ),
+ );
+ },
+ );
+ },
+ );
+ }
+
Future<void> _loadViewsWhenExpanded(
Emitter<ViewState> emit,
bool isExpanded,
@@ -355,7 +359,5 @@ class ViewState with _$ViewState {
isExpanded: false,
isEditing: false,
successOrFailure: left(unit),
- lastCreatedView: null,
- isLoading: true,
);
}
diff --git a/frontend/appflowy_flutter/lib/workspace/application/view/view_ext.dart b/frontend/appflowy_flutter/lib/workspace/application/view/view_ext.dart
index 7e66c1a64a..3e111d72cf 100644
--- a/frontend/appflowy_flutter/lib/workspace/application/view/view_ext.dart
+++ b/frontend/appflowy_flutter/lib/workspace/application/view/view_ext.dart
@@ -44,7 +44,6 @@ extension ViewExtension on ViewPB {
};
Plugin plugin({
- bool listenOnViewChanged = false,
Map<String, dynamic> arguments = const {},
}) {
switch (layout) {
@@ -65,7 +64,6 @@ extension ViewExtension on ViewPB {
return DocumentPlugin(
view: this,
pluginType: pluginType,
- listenOnViewChanged: listenOnViewChanged,
initialSelection: initialSelection,
);
}
diff --git a/frontend/appflowy_flutter/lib/workspace/application/view/view_listener.dart b/frontend/appflowy_flutter/lib/workspace/application/view/view_listener.dart
index 8c91548dfd..d082cd84f6 100644
--- a/frontend/appflowy_flutter/lib/workspace/application/view/view_listener.dart
+++ b/frontend/appflowy_flutter/lib/workspace/application/view/view_listener.dart
@@ -19,6 +19,8 @@ typedef RestoreViewNotifiedValue = Either<ViewPB, FlowyError>;
typedef MoveToTrashNotifiedValue = Either<DeletedViewPB, FlowyError>;
class ViewListener {
+ ViewListener({required this.viewId});
+
StreamSubscription<SubscribeObject>? _subscription;
void Function(UpdateViewNotifiedValue)? _updatedViewNotifier;
void Function(ChildViewUpdatePB)? _updateViewChildViewsNotifier;
@@ -30,10 +32,6 @@ class ViewListener {
FolderNotificationParser? _parser;
final String viewId;
- ViewListener({
- required this.viewId,
- });
-
void start({
void Function(UpdateViewNotifiedValue)? onViewUpdated,
void Function(ChildViewUpdatePB)? onViewChildViewsUpdated,
diff --git a/frontend/appflowy_flutter/lib/workspace/application/view/view_service.dart b/frontend/appflowy_flutter/lib/workspace/application/view/view_service.dart
index e217196f71..8c31a69a76 100644
--- a/frontend/appflowy_flutter/lib/workspace/application/view/view_service.dart
+++ b/frontend/appflowy_flutter/lib/workspace/application/view/view_service.dart
@@ -94,7 +94,6 @@ class ViewBackendService {
layoutType: layoutType,
parentViewId: parentViewId,
name: name,
- openAfterCreate: false,
ext: {
'database_id': databaseId,
},
@@ -236,7 +235,7 @@ class ViewBackendService {
if (childViews != null && childViews.isNotEmpty) {
result.addAll(childViews);
final views = await Future.wait(
- childViews.map((e) async => await getAllViews(e)),
+ childViews.map((e) async => getAllViews(e)),
);
result.addAll(views.expand((element) => element));
}
diff --git a/frontend/appflowy_flutter/lib/workspace/application/workspace/workspace_bloc.dart b/frontend/appflowy_flutter/lib/workspace/application/workspace/workspace_bloc.dart
index 33fbedd891..f7a7a2a24f 100644
--- a/frontend/appflowy_flutter/lib/workspace/application/workspace/workspace_bloc.dart
+++ b/frontend/appflowy_flutter/lib/workspace/application/workspace/workspace_bloc.dart
@@ -1,18 +1,21 @@
import 'package:appflowy/user/application/user_service.dart';
import 'package:appflowy_backend/log.dart';
-import 'package:appflowy_backend/protobuf/flowy-folder/workspace.pb.dart';
import 'package:appflowy_backend/protobuf/flowy-error/errors.pb.dart';
-import 'package:freezed_annotation/freezed_annotation.dart';
-import 'package:flutter_bloc/flutter_bloc.dart';
+import 'package:appflowy_backend/protobuf/flowy-folder/workspace.pb.dart';
import 'package:dartz/dartz.dart';
+import 'package:flutter_bloc/flutter_bloc.dart';
+import 'package:freezed_annotation/freezed_annotation.dart';
part 'workspace_bloc.freezed.dart';
class WorkspaceBloc extends Bloc<WorkspaceEvent, WorkspaceState> {
+ WorkspaceBloc({required this.userService}) : super(WorkspaceState.initial()) {
+ _dispatch();
+ }
+
final UserBackendService userService;
- WorkspaceBloc({
- required this.userService,
- }) : super(WorkspaceState.initial()) {
+
+ void _dispatch() {
on<WorkspaceEvent>(
(event, emit) async {
await event.map(
diff --git a/frontend/appflowy_flutter/lib/workspace/application/workspace/workspace_listener.dart b/frontend/appflowy_flutter/lib/workspace/application/workspace/workspace_listener.dart
index bac9592fbb..3168e3ff3a 100644
--- a/frontend/appflowy_flutter/lib/workspace/application/workspace/workspace_listener.dart
+++ b/frontend/appflowy_flutter/lib/workspace/application/workspace/workspace_listener.dart
@@ -14,18 +14,16 @@ typedef AppListNotifyValue = Either<List<ViewPB>, FlowyError>;
typedef WorkspaceNotifyValue = Either<WorkspacePB, FlowyError>;
class WorkspaceListener {
+ WorkspaceListener({required this.user, required this.workspaceId});
+
+ final UserProfilePB user;
+ final String workspaceId;
+
PublishNotifier<AppListNotifyValue>? _appsChangedNotifier = PublishNotifier();
PublishNotifier<WorkspaceNotifyValue>? _workspaceUpdatedNotifier =
PublishNotifier();
FolderNotificationListener? _listener;
- final UserProfilePB user;
- final String workspaceId;
-
- WorkspaceListener({
- required this.user,
- required this.workspaceId,
- });
void start({
void Function(AppListNotifyValue)? appsChanged,
diff --git a/frontend/appflowy_flutter/lib/workspace/application/workspace/workspace_service.dart b/frontend/appflowy_flutter/lib/workspace/application/workspace/workspace_service.dart
index ab2ff333a9..da6f366ca1 100644
--- a/frontend/appflowy_flutter/lib/workspace/application/workspace/workspace_service.dart
+++ b/frontend/appflowy_flutter/lib/workspace/application/workspace/workspace_service.dart
@@ -8,10 +8,9 @@ import 'package:appflowy_backend/protobuf/flowy-folder/view.pb.dart'
import 'package:appflowy_backend/protobuf/flowy-folder/workspace.pb.dart';
class WorkspaceService {
+ WorkspaceService({required this.workspaceId});
+
final String workspaceId;
- WorkspaceService({
- required this.workspaceId,
- });
Future<Either<ViewPB, FlowyError>> createApp({
required String name,
diff --git a/frontend/appflowy_flutter/lib/workspace/presentation/home/desktop_home_screen.dart b/frontend/appflowy_flutter/lib/workspace/presentation/home/desktop_home_screen.dart
index f8206306f1..9f17f22799 100644
--- a/frontend/appflowy_flutter/lib/workspace/presentation/home/desktop_home_screen.dart
+++ b/frontend/appflowy_flutter/lib/workspace/presentation/home/desktop_home_screen.dart
@@ -32,10 +32,10 @@ import 'home_layout.dart';
import 'home_stack.dart';
class DesktopHomeScreen extends StatelessWidget {
- static const routeName = '/DesktopHomeScreen';
-
const DesktopHomeScreen({super.key});
+ static const routeName = '/DesktopHomeScreen';
+
@override
Widget build(BuildContext context) {
return FutureBuilder(
@@ -72,14 +72,13 @@ class DesktopHomeScreen extends StatelessWidget {
BlocProvider<TabsBloc>.value(value: getIt<TabsBloc>()),
BlocProvider<HomeBloc>(
create: (context) {
- return HomeBloc(userProfile, workspaceSetting)
+ return HomeBloc(workspaceSetting)
..add(const HomeEvent.initial());
},
),
BlocProvider<HomeSettingBloc>(
create: (_) {
return HomeSettingBloc(
- userProfile,
workspaceSetting,
context.read<AppearanceSettingsCubit>(),
context.widthPx,
@@ -104,9 +103,7 @@ class DesktopHomeScreen extends StatelessWidget {
if (currentPageManager.plugin.pluginType ==
PluginType.blank) {
getIt<TabsBloc>().add(
- TabsEvent.openPlugin(
- plugin: view.plugin(listenOnViewChanged: true),
- ),
+ TabsEvent.openPlugin(plugin: view.plugin()),
);
}
}
@@ -144,36 +141,32 @@ class DesktopHomeScreen extends StatelessWidget {
UserProfilePB userProfile,
WorkspaceSettingPB workspaceSetting,
) {
- return LayoutBuilder(
- builder: (BuildContext context, BoxConstraints constraints) {
- final layout = HomeLayout(context, constraints);
- final homeStack = HomeStack(
- layout: layout,
- delegate: DesktopHomeScreenStackAdaptor(
- buildContext: context,
- ),
- );
- final menu = _buildHomeSidebar(
- layout: layout,
- context: context,
- userProfile: userProfile,
- workspaceSetting: workspaceSetting,
- );
- final homeMenuResizer = _buildHomeMenuResizer(context: context);
- final editPanel = _buildEditPanel(
- layout: layout,
- context: context,
- );
- const bubble = QuestionBubble();
- return _layoutWidgets(
- layout: layout,
- homeStack: homeStack,
- homeMenu: menu,
- editPanel: editPanel,
- bubble: bubble,
- homeMenuResizer: homeMenuResizer,
- );
- },
+ final layout = HomeLayout(context);
+ final homeStack = HomeStack(
+ layout: layout,
+ delegate: DesktopHomeScreenStackAdaptor(
+ buildContext: context,
+ ),
+ );
+ final menu = _buildHomeSidebar(
+ layout: layout,
+ context: context,
+ userProfile: userProfile,
+ workspaceSetting: workspaceSetting,
+ );
+ final homeMenuResizer = _buildHomeMenuResizer(context: context);
+ final editPanel = _buildEditPanel(
+ layout: layout,
+ context: context,
+ );
+ const bubble = QuestionBubble();
+ return _layoutWidgets(
+ layout: layout,
+ homeStack: homeStack,
+ homeMenu: menu,
+ editPanel: editPanel,
+ bubble: bubble,
+ homeMenuResizer: homeMenuResizer,
);
}
@@ -305,11 +298,9 @@ class DesktopHomeScreen extends StatelessWidget {
}
class DesktopHomeScreenStackAdaptor extends HomeStackDelegate {
- final BuildContext buildContext;
+ DesktopHomeScreenStackAdaptor({required this.buildContext});
- DesktopHomeScreenStackAdaptor({
- required this.buildContext,
- });
+ final BuildContext buildContext;
@override
void didDeleteStackWidget(ViewPB view, int? index) {
@@ -325,9 +316,7 @@ class DesktopHomeScreenStackAdaptor extends HomeStackDelegate {
}
getIt<TabsBloc>().add(
- TabsEvent.openPlugin(
- plugin: lastView.plugin(listenOnViewChanged: true),
- ),
+ TabsEvent.openPlugin(plugin: lastView.plugin()),
);
} else {
getIt<TabsBloc>().add(
diff --git a/frontend/appflowy_flutter/lib/workspace/presentation/home/home_layout.dart b/frontend/appflowy_flutter/lib/workspace/presentation/home/home_layout.dart
index f1f1ac4b7c..b466ca9d2e 100644
--- a/frontend/appflowy_flutter/lib/workspace/presentation/home/home_layout.dart
+++ b/frontend/appflowy_flutter/lib/workspace/presentation/home/home_layout.dart
@@ -10,23 +10,10 @@ import 'package:sized_context/sized_context.dart';
import 'home_sizes.dart';
class HomeLayout {
- late double menuWidth;
- late bool showMenu;
- late bool menuIsDrawer;
- late bool showEditPanel;
- late double editPanelWidth;
- late double homePageLOffset;
- late double homePageROffset;
- late double menuSpacing;
- late Duration animDuration;
-
- HomeLayout(BuildContext context, BoxConstraints homeScreenConstraint) {
+ HomeLayout(BuildContext context) {
final homeSetting = context.read<HomeSettingBloc>().state;
-
showEditPanel = homeSetting.panelContext.isSome();
-
menuWidth = Sizes.sideBarWidth;
-
menuWidth += homeSetting.resizeOffset;
final screenWidthPx = context.widthPx;
@@ -34,10 +21,8 @@ class HomeLayout {
.read<HomeSettingBloc>()
.add(HomeSettingEvent.checkScreenSize(screenWidthPx));
- if (homeSetting.isMenuCollapsed) {
- showMenu = false;
- } else {
- showMenu = true;
+ showMenu = !homeSetting.isMenuCollapsed;
+ if (showMenu) {
menuIsDrawer = context.widthPx <= PageBreaks.tabletPortrait;
}
@@ -45,8 +30,17 @@ class HomeLayout {
menuSpacing = !showMenu && Platform.isMacOS ? 80.0 : 0.0;
animDuration = homeSetting.resizeType.duration();
-
editPanelWidth = HomeSizes.editPanelWidth;
homePageROffset = showEditPanel ? editPanelWidth : 0;
}
+
+ late bool showEditPanel;
+ late double menuWidth;
+ late bool showMenu;
+ late bool menuIsDrawer;
+ late double homePageLOffset;
+ late double menuSpacing;
+ late Duration animDuration;
+ late double editPanelWidth;
+ late double homePageROffset;
}
diff --git a/frontend/appflowy_flutter/lib/workspace/presentation/home/home_stack.dart b/frontend/appflowy_flutter/lib/workspace/presentation/home/home_stack.dart
index ae17ec53e2..d835956cdf 100644
--- a/frontend/appflowy_flutter/lib/workspace/presentation/home/home_stack.dart
+++ b/frontend/appflowy_flutter/lib/workspace/presentation/home/home_stack.dart
@@ -24,14 +24,15 @@ abstract class HomeStackDelegate {
}
class HomeStack extends StatelessWidget {
- final HomeStackDelegate delegate;
- final HomeLayout layout;
const HomeStack({
+ super.key,
required this.delegate,
required this.layout,
- super.key,
});
+ final HomeStackDelegate delegate;
+ final HomeLayout layout;
+
@override
Widget build(BuildContext context) {
final pageController = PageController();
@@ -41,7 +42,6 @@ class HomeStack extends StatelessWidget {
child: BlocBuilder<TabsBloc, TabsState>(
builder: (context, state) {
return Column(
- mainAxisAlignment: MainAxisAlignment.start,
children: [
Padding(
padding: EdgeInsets.only(left: layout.menuSpacing),
@@ -105,10 +105,6 @@ class _PageStackState extends State<PageStack>
}
class FadingIndexedStack extends StatefulWidget {
- final int index;
- final List<Widget> children;
- final Duration duration;
-
const FadingIndexedStack({
super.key,
required this.index,
@@ -118,6 +114,10 @@ class FadingIndexedStack extends StatefulWidget {
),
});
+ final int index;
+ final List<Widget> children;
+ final Duration duration;
+
@override
FadingIndexedStackState createState() => FadingIndexedStackState();
}
@@ -161,6 +161,9 @@ abstract mixin class NavigationItem {
}
class PageNotifier extends ChangeNotifier {
+ PageNotifier({Plugin? plugin})
+ : _plugin = plugin ?? makePlugin(pluginType: PluginType.blank);
+
Plugin _plugin;
Widget get titleWidget => _plugin.widgetBuilder.leftBarItem;
@@ -168,9 +171,6 @@ class PageNotifier extends ChangeNotifier {
Widget tabBarWidget(String pluginId) =>
_plugin.widgetBuilder.tabBarItem(pluginId);
- PageNotifier({Plugin? plugin})
- : _plugin = plugin ?? makePlugin(pluginType: PluginType.blank);
-
/// This is the only place where the plugin is set.
/// No need compare the old plugin with the new plugin. Just set it.
set plugin(Plugin newPlugin) {
@@ -188,12 +188,12 @@ class PageNotifier extends ChangeNotifier {
// PageManager manages the view for one Tab
class PageManager {
+ PageManager();
+
final PageNotifier _notifier = PageNotifier();
PageNotifier get notifier => _notifier;
- PageManager();
-
Widget title() {
return _notifier.plugin.widgetBuilder.leftBarItem;
}
@@ -275,7 +275,6 @@ class HomeTopBar extends StatelessWidget {
horizontal: HomeInsets.topBarTitlePadding,
),
child: Row(
- crossAxisAlignment: CrossAxisAlignment.center,
children: [
HSpace(layout.menuSpacing),
const FlowyNavigation(),
diff --git a/frontend/appflowy_flutter/lib/workspace/presentation/home/hotkeys.dart b/frontend/appflowy_flutter/lib/workspace/presentation/home/hotkeys.dart
index 7ca9aae327..fc813f9ad6 100644
--- a/frontend/appflowy_flutter/lib/workspace/presentation/home/hotkeys.dart
+++ b/frontend/appflowy_flutter/lib/workspace/presentation/home/hotkeys.dart
@@ -16,22 +16,23 @@ typedef KeyDownHandler = void Function(HotKey hotKey);
/// relevant [HotKey].
///
class HotKeyItem {
- final HotKey hotKey;
- final KeyDownHandler? keyDownHandler;
-
HotKeyItem({
required this.hotKey,
this.keyDownHandler,
});
+ final HotKey hotKey;
+ final KeyDownHandler? keyDownHandler;
+
void register() =>
hotKeyManager.register(hotKey, keyDownHandler: keyDownHandler);
}
class HomeHotKeys extends StatelessWidget {
- final Widget child;
const HomeHotKeys({required this.child, super.key});
+ final Widget child;
+
@override
Widget build(BuildContext context) {
// Collapse sidebar menu
diff --git a/frontend/appflowy_flutter/lib/workspace/presentation/home/menu/menu_shared_state.dart b/frontend/appflowy_flutter/lib/workspace/presentation/home/menu/menu_shared_state.dart
index 9852eb710c..535c89be4e 100644
--- a/frontend/appflowy_flutter/lib/workspace/presentation/home/menu/menu_shared_state.dart
+++ b/frontend/appflowy_flutter/lib/workspace/presentation/home/menu/menu_shared_state.dart
@@ -2,12 +2,12 @@ import 'package:appflowy_backend/protobuf/flowy-folder/view.pb.dart';
import 'package:flutter/material.dart';
class MenuSharedState {
- final ValueNotifier<ViewPB?> _latestOpenView = ValueNotifier<ViewPB?>(null);
-
MenuSharedState({ViewPB? view}) {
_latestOpenView.value = view;
}
+ final ValueNotifier<ViewPB?> _latestOpenView = ValueNotifier<ViewPB?>(null);
+
ViewPB? get latestOpenView => _latestOpenView.value;
ValueNotifier<ViewPB?> get notifier => _latestOpenView;
diff --git a/frontend/appflowy_flutter/lib/workspace/presentation/home/menu/sidebar/folder/favorite_folder.dart b/frontend/appflowy_flutter/lib/workspace/presentation/home/menu/sidebar/folder/favorite_folder.dart
index f56dc9098b..a1be030311 100644
--- a/frontend/appflowy_flutter/lib/workspace/presentation/home/menu/sidebar/folder/favorite_folder.dart
+++ b/frontend/appflowy_flutter/lib/workspace/presentation/home/menu/sidebar/folder/favorite_folder.dart
@@ -96,7 +96,6 @@ class _FavoriteHeaderState extends State<FavoriteHeader> {
onEnter: (event) => setState(() => onHover = true),
onExit: (event) => setState(() => onHover = false),
child: Row(
- crossAxisAlignment: CrossAxisAlignment.center,
children: [
FlowyTextButton(
LocaleKeys.sideBar_favorites.tr(),
diff --git a/frontend/appflowy_flutter/lib/workspace/presentation/home/menu/sidebar/folder/personal_folder.dart b/frontend/appflowy_flutter/lib/workspace/presentation/home/menu/sidebar/folder/personal_folder.dart
index 38fd6566be..fafc2989c8 100644
--- a/frontend/appflowy_flutter/lib/workspace/presentation/home/menu/sidebar/folder/personal_folder.dart
+++ b/frontend/appflowy_flutter/lib/workspace/presentation/home/menu/sidebar/folder/personal_folder.dart
@@ -96,7 +96,6 @@ class _PersonalFolderHeaderState extends State<PersonalFolderHeader> {
onEnter: (event) => setState(() => onHover = true),
onExit: (event) => setState(() => onHover = false),
child: Row(
- crossAxisAlignment: CrossAxisAlignment.center,
children: [
FlowyTextButton(
LocaleKeys.sideBar_personal.tr(),
diff --git a/frontend/appflowy_flutter/lib/workspace/presentation/home/menu/sidebar/sidebar.dart b/frontend/appflowy_flutter/lib/workspace/presentation/home/menu/sidebar/sidebar.dart
index e3df2530d3..f3814a164f 100644
--- a/frontend/appflowy_flutter/lib/workspace/presentation/home/menu/sidebar/sidebar.dart
+++ b/frontend/appflowy_flutter/lib/workspace/presentation/home/menu/sidebar/sidebar.dart
@@ -100,7 +100,6 @@ class HomeSideBar extends StatelessWidget {
),
child: Column(
mainAxisSize: MainAxisSize.min,
- mainAxisAlignment: MainAxisAlignment.start,
children: [
// top menu
const Padding(
diff --git a/frontend/appflowy_flutter/lib/workspace/presentation/home/menu/sidebar/sidebar_folder.dart b/frontend/appflowy_flutter/lib/workspace/presentation/home/menu/sidebar/sidebar_folder.dart
index bdb8560b53..01ec648e74 100644
--- a/frontend/appflowy_flutter/lib/workspace/presentation/home/menu/sidebar/sidebar_folder.dart
+++ b/frontend/appflowy_flutter/lib/workspace/presentation/home/menu/sidebar/sidebar_folder.dart
@@ -28,7 +28,6 @@ class SidebarFolder extends StatelessWidget {
valueListenable: getIt<MenuSharedState>().notifier,
builder: (context, value, child) {
return Column(
- mainAxisAlignment: MainAxisAlignment.start,
children: [
// favorite
if (favoriteViews.isNotEmpty) ...[
diff --git a/frontend/appflowy_flutter/lib/workspace/presentation/home/menu/sidebar/sidebar_new_page_button.dart b/frontend/appflowy_flutter/lib/workspace/presentation/home/menu/sidebar/sidebar_new_page_button.dart
index f5411a3fec..46cd3dfbb1 100644
--- a/frontend/appflowy_flutter/lib/workspace/presentation/home/menu/sidebar/sidebar_new_page_button.dart
+++ b/frontend/appflowy_flutter/lib/workspace/presentation/home/menu/sidebar/sidebar_new_page_button.dart
@@ -20,7 +20,7 @@ class SidebarNewPageButton extends StatelessWidget {
fillColor: Colors.transparent,
hoverColor: Colors.transparent,
fontColor: Theme.of(context).colorScheme.tertiary,
- onPressed: () async => await createViewAndShowRenameDialogIfNeeded(
+ onPressed: () async => createViewAndShowRenameDialogIfNeeded(
context,
LocaleKeys.newPageText.tr(),
(viewName) {
diff --git a/frontend/appflowy_flutter/lib/workspace/presentation/home/menu/sidebar/sidebar_user.dart b/frontend/appflowy_flutter/lib/workspace/presentation/home/menu/sidebar/sidebar_user.dart
index 5cf3e33145..bfebad71e7 100644
--- a/frontend/appflowy_flutter/lib/workspace/presentation/home/menu/sidebar/sidebar_user.dart
+++ b/frontend/appflowy_flutter/lib/workspace/presentation/home/menu/sidebar/sidebar_user.dart
@@ -36,7 +36,6 @@ class SidebarUser extends StatelessWidget {
),
child: BlocBuilder<MenuUserBloc, MenuUserState>(
builder: (context, state) => Row(
- crossAxisAlignment: CrossAxisAlignment.center,
children: [
UserAvatar(
iconUrl: state.userProfile.iconUrl,
@@ -75,9 +74,10 @@ class SidebarUser extends StatelessWidget {
}
class UserSettingButton extends StatelessWidget {
- final UserProfilePB userProfile;
const UserSettingButton({required this.userProfile, super.key});
+ final UserProfilePB userProfile;
+
@override
Widget build(BuildContext context) {
return FlowyTooltip(
diff --git a/frontend/appflowy_flutter/lib/workspace/presentation/home/navigation.dart b/frontend/appflowy_flutter/lib/workspace/presentation/home/navigation.dart
index 071dccfa98..d0c595b5bb 100644
--- a/frontend/appflowy_flutter/lib/workspace/presentation/home/navigation.dart
+++ b/frontend/appflowy_flutter/lib/workspace/presentation/home/navigation.dart
@@ -17,9 +17,10 @@ import 'package:styled_widget/styled_widget.dart';
typedef NaviAction = void Function();
class NavigationNotifier with ChangeNotifier {
- List<NavigationItem> navigationItems;
NavigationNotifier({required this.navigationItems});
+ List<NavigationItem> navigationItems;
+
void update(PageNotifier notifier) {
if (navigationItems != notifier.plugin.widgetBuilder.navigationItems) {
navigationItems = notifier.plugin.widgetBuilder.navigationItems;
@@ -88,7 +89,7 @@ class FlowyNavigation extends StatelessWidget {
),
);
} else {
- return Container();
+ return const SizedBox.shrink();
}
},
);
@@ -133,9 +134,10 @@ class FlowyNavigation extends StatelessWidget {
}
class NaviItemWidget extends StatelessWidget {
- final NavigationItem item;
const NaviItemWidget(this.item, {super.key});
+ final NavigationItem item;
+
@override
Widget build(BuildContext context) {
return Expanded(
@@ -145,9 +147,10 @@ class NaviItemWidget extends StatelessWidget {
}
class NaviItemDivider extends StatelessWidget {
- final Widget child;
const NaviItemDivider({super.key, required this.child});
+ final Widget child;
+
@override
Widget build(BuildContext context) {
return Row(
@@ -157,10 +160,9 @@ class NaviItemDivider extends StatelessWidget {
}
class EllipsisNaviItem extends NavigationItem {
+ EllipsisNaviItem({required this.items});
+
final List<NavigationItem> items;
- EllipsisNaviItem({
- required this.items,
- });
@override
Widget get leftBarItem => FlowyText.medium(
diff --git a/frontend/appflowy_flutter/lib/workspace/presentation/home/tabs/flowy_tab.dart b/frontend/appflowy_flutter/lib/workspace/presentation/home/tabs/flowy_tab.dart
index 46a8256cc7..81601cbfd4 100644
--- a/frontend/appflowy_flutter/lib/workspace/presentation/home/tabs/flowy_tab.dart
+++ b/frontend/appflowy_flutter/lib/workspace/presentation/home/tabs/flowy_tab.dart
@@ -8,15 +8,15 @@ import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
class FlowyTab extends StatefulWidget {
- final PageManager pageManager;
- final bool isCurrent;
-
const FlowyTab({
super.key,
required this.pageManager,
required this.isCurrent,
});
+ final PageManager pageManager;
+ final bool isCurrent;
+
@override
State<FlowyTab> createState() => _FlowyTabState();
}
diff --git a/frontend/appflowy_flutter/lib/workspace/presentation/home/tabs/tabs_manager.dart b/frontend/appflowy_flutter/lib/workspace/presentation/home/tabs/tabs_manager.dart
index 0f502a6c29..436e58f1bf 100644
--- a/frontend/appflowy_flutter/lib/workspace/presentation/home/tabs/tabs_manager.dart
+++ b/frontend/appflowy_flutter/lib/workspace/presentation/home/tabs/tabs_manager.dart
@@ -5,12 +5,9 @@ import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
class TabsManager extends StatefulWidget {
- final PageController pageController;
+ const TabsManager({super.key, required this.pageController});
- const TabsManager({
- super.key,
- required this.pageController,
- });
+ final PageController pageController;
@override
State<TabsManager> createState() => _TabsManagerState();
diff --git a/frontend/appflowy_flutter/lib/workspace/presentation/home/toast.dart b/frontend/appflowy_flutter/lib/workspace/presentation/home/toast.dart
index d9363ae037..57c3590a25 100644
--- a/frontend/appflowy_flutter/lib/workspace/presentation/home/toast.dart
+++ b/frontend/appflowy_flutter/lib/workspace/presentation/home/toast.dart
@@ -7,9 +7,10 @@ import 'package:flutter/material.dart';
import 'package:fluttertoast/fluttertoast.dart';
class FlowyMessageToast extends StatelessWidget {
- final String message;
const FlowyMessageToast({required this.message, super.key});
+ final String message;
+
@override
Widget build(BuildContext context) {
return DecoratedBox(
diff --git a/frontend/appflowy_flutter/lib/workspace/presentation/notifications/widgets/flowy_tab.dart b/frontend/appflowy_flutter/lib/workspace/presentation/notifications/widgets/flowy_tab.dart
index 9d2b09fb83..93b696c67f 100644
--- a/frontend/appflowy_flutter/lib/workspace/presentation/notifications/widgets/flowy_tab.dart
+++ b/frontend/appflowy_flutter/lib/workspace/presentation/notifications/widgets/flowy_tab.dart
@@ -4,12 +4,6 @@ import 'package:flowy_infra_ui/style_widget/text.dart';
import 'package:flutter/material.dart';
class FlowyTabItem extends StatelessWidget {
- static const double mobileHeight = 40;
- static const EdgeInsets mobilePadding = EdgeInsets.symmetric(horizontal: 12);
-
- static const double desktopHeight = 26;
- static const EdgeInsets desktopPadding = EdgeInsets.symmetric(horizontal: 8);
-
const FlowyTabItem({
super.key,
required this.label,
@@ -19,6 +13,12 @@ class FlowyTabItem extends StatelessWidget {
final String label;
final bool isSelected;
+ static const double mobileHeight = 40;
+ static const EdgeInsets mobilePadding = EdgeInsets.symmetric(horizontal: 12);
+
+ static const double desktopHeight = 26;
+ static const EdgeInsets desktopPadding = EdgeInsets.symmetric(horizontal: 8);
+
@override
Widget build(BuildContext context) {
return Tab(
diff --git a/frontend/appflowy_flutter/lib/workspace/presentation/notifications/widgets/inbox_action_bar.dart b/frontend/appflowy_flutter/lib/workspace/presentation/notifications/widgets/inbox_action_bar.dart
index ca924aac20..8ee7a0f102 100644
--- a/frontend/appflowy_flutter/lib/workspace/presentation/notifications/widgets/inbox_action_bar.dart
+++ b/frontend/appflowy_flutter/lib/workspace/presentation/notifications/widgets/inbox_action_bar.dart
@@ -134,10 +134,10 @@ class _ToggleUnreadsButtonState extends State<_ToggleUnreadsButton> {
}
class _MarkAsReadButton extends StatefulWidget {
- final VoidCallback? onMarkAllRead;
-
const _MarkAsReadButton({this.onMarkAllRead});
+ final VoidCallback? onMarkAllRead;
+
@override
State<_MarkAsReadButton> createState() => _MarkAsReadButtonState();
}
diff --git a/frontend/appflowy_flutter/lib/workspace/presentation/notifications/widgets/notification_item.dart b/frontend/appflowy_flutter/lib/workspace/presentation/notifications/widgets/notification_item.dart
index 29c03cb044..be5ad2e43b 100644
--- a/frontend/appflowy_flutter/lib/workspace/presentation/notifications/widgets/notification_item.dart
+++ b/frontend/appflowy_flutter/lib/workspace/presentation/notifications/widgets/notification_item.dart
@@ -126,7 +126,6 @@ class _NotificationItemState extends State<NotificationItem> {
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
- mainAxisAlignment: MainAxisAlignment.start,
children: [
FlowyText.semibold(
widget.title,
diff --git a/frontend/appflowy_flutter/lib/workspace/presentation/notifications/widgets/notification_tab_bar.dart b/frontend/appflowy_flutter/lib/workspace/presentation/notifications/widgets/notification_tab_bar.dart
index 66eebe83f9..099203a90a 100644
--- a/frontend/appflowy_flutter/lib/workspace/presentation/notifications/widgets/notification_tab_bar.dart
+++ b/frontend/appflowy_flutter/lib/workspace/presentation/notifications/widgets/notification_tab_bar.dart
@@ -4,12 +4,9 @@ import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart';
class NotificationTabBar extends StatelessWidget {
- final TabController tabController;
+ const NotificationTabBar({super.key, required this.tabController});
- const NotificationTabBar({
- super.key,
- required this.tabController,
- });
+ final TabController tabController;
@override
Widget build(BuildContext context) {
diff --git a/frontend/appflowy_flutter/lib/workspace/presentation/notifications/widgets/notification_view.dart b/frontend/appflowy_flutter/lib/workspace/presentation/notifications/widgets/notification_view.dart
index 3d155cdc5f..0f02100801 100644
--- a/frontend/appflowy_flutter/lib/workspace/presentation/notifications/widgets/notification_view.dart
+++ b/frontend/appflowy_flutter/lib/workspace/presentation/notifications/widgets/notification_view.dart
@@ -45,7 +45,6 @@ class NotificationsView extends StatelessWidget {
Widget build(BuildContext context) {
if (shownReminders.isEmpty) {
return Column(
- mainAxisSize: MainAxisSize.max,
children: [
if (actionBar != null) actionBar!,
const Expanded(child: NotificationsHubEmpty()),
diff --git a/frontend/appflowy_flutter/lib/workspace/presentation/settings/settings_dialog.dart b/frontend/appflowy_flutter/lib/workspace/presentation/settings/settings_dialog.dart
index c33cf53ac1..f7ad239e97 100644
--- a/frontend/appflowy_flutter/lib/workspace/presentation/settings/settings_dialog.dart
+++ b/frontend/appflowy_flutter/lib/workspace/presentation/settings/settings_dialog.dart
@@ -19,18 +19,18 @@ const _dialogHorizontalPadding = EdgeInsets.symmetric(horizontal: 12);
const _contentInsetPadding = EdgeInsets.fromLTRB(0.0, 12.0, 0.0, 16.0);
class SettingsDialog extends StatelessWidget {
- final VoidCallback dismissDialog;
- final VoidCallback didLogout;
- final VoidCallback restartApp;
- final UserProfilePB user;
SettingsDialog(
this.user, {
required this.dismissDialog,
required this.didLogout,
required this.restartApp,
- Key? key,
}) : super(key: ValueKey(user.id));
+ final VoidCallback dismissDialog;
+ final VoidCallback didLogout;
+ final VoidCallback restartApp;
+ final UserProfilePB user;
+
@override
Widget build(BuildContext context) {
return BlocProvider<SettingsDialogBloc>(
@@ -111,7 +111,7 @@ class SettingsDialog extends StatelessWidget {
case SettingsPage.shortcuts:
return const SettingsCustomizeShortcutsWrapper();
default:
- return Container();
+ return const SizedBox.shrink();
}
}
}
diff --git a/frontend/appflowy_flutter/lib/workspace/presentation/settings/widgets/emoji_picker/src/default_emoji_picker_view.dart b/frontend/appflowy_flutter/lib/workspace/presentation/settings/widgets/emoji_picker/src/default_emoji_picker_view.dart
index 95e252370c..e4eb5546c8 100644
--- a/frontend/appflowy_flutter/lib/workspace/presentation/settings/widgets/emoji_picker/src/default_emoji_picker_view.dart
+++ b/frontend/appflowy_flutter/lib/workspace/presentation/settings/widgets/emoji_picker/src/default_emoji_picker_view.dart
@@ -89,7 +89,7 @@ class DefaultEmojiPickerViewState extends State<DefaultEmojiPickerView>
),
);
}
- return Container();
+ return const SizedBox.shrink();
}
bool isEmojiSearching() {
diff --git a/frontend/appflowy_flutter/lib/workspace/presentation/settings/widgets/setting_appflowy_cloud.dart b/frontend/appflowy_flutter/lib/workspace/presentation/settings/widgets/setting_appflowy_cloud.dart
index b80ff6a24b..de694cd98a 100644
--- a/frontend/appflowy_flutter/lib/workspace/presentation/settings/widgets/setting_appflowy_cloud.dart
+++ b/frontend/appflowy_flutter/lib/workspace/presentation/settings/widgets/setting_appflowy_cloud.dart
@@ -20,16 +20,17 @@ import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:url_launcher/url_launcher.dart';
class AppFlowyCloudViewSetting extends StatelessWidget {
- final String serverURL;
- final AuthenticatorType authenticatorType;
- final VoidCallback restartAppFlowy;
const AppFlowyCloudViewSetting({
- required this.restartAppFlowy,
super.key,
this.serverURL = kAppflowyCloudUrl,
this.authenticatorType = AuthenticatorType.appflowyCloud,
+ required this.restartAppFlowy,
});
+ final String serverURL;
+ final AuthenticatorType authenticatorType;
+ final VoidCallback restartAppFlowy;
+
@override
Widget build(BuildContext context) {
return FutureBuilder<Either<CloudSettingPB, FlowyError>>(
@@ -80,9 +81,10 @@ class AppFlowyCloudViewSetting extends StatelessWidget {
}
class CustomAppFlowyCloudView extends StatelessWidget {
- final VoidCallback restartAppFlowy;
const CustomAppFlowyCloudView({required this.restartAppFlowy, super.key});
+ final VoidCallback restartAppFlowy;
+
@override
Widget build(BuildContext context) {
return FutureBuilder<Either<CloudSettingPB, FlowyError>>(
@@ -139,11 +141,9 @@ class CustomAppFlowyCloudView extends StatelessWidget {
}
class AppFlowyCloudURLs extends StatelessWidget {
+ const AppFlowyCloudURLs({super.key, required this.restartAppFlowy});
+
final VoidCallback restartAppFlowy;
- const AppFlowyCloudURLs({
- required this.restartAppFlowy,
- super.key,
- });
@override
Widget build(BuildContext context) {
@@ -197,9 +197,10 @@ class AppFlowyCloudURLs extends StatelessWidget {
}
class AppFlowySelfhostTip extends StatelessWidget {
+ const AppFlowySelfhostTip({super.key});
+
final url =
"https://docs.appflowy.io/docs/guides/appflowy/self-hosting-appflowy#build-appflowy-with-a-self-hosted-server";
- const AppFlowySelfhostTip({super.key});
@override
Widget build(BuildContext context) {
@@ -243,20 +244,19 @@ class AppFlowySelfhostTip extends StatelessWidget {
@visibleForTesting
class CloudURLInput extends StatefulWidget {
- final String title;
- final String url;
- final String hint;
-
- final Function(String) onChanged;
-
const CloudURLInput({
+ super.key,
required this.title,
required this.url,
required this.hint,
required this.onChanged,
- super.key,
});
+ final String title;
+ final String url;
+ final String hint;
+ final Function(String) onChanged;
+
@override
CloudURLInputState createState() => CloudURLInputState();
}
diff --git a/frontend/appflowy_flutter/lib/workspace/presentation/settings/widgets/setting_cloud.dart b/frontend/appflowy_flutter/lib/workspace/presentation/settings/widgets/setting_cloud.dart
index aca974e01c..ba2b355db8 100644
--- a/frontend/appflowy_flutter/lib/workspace/presentation/settings/widgets/setting_cloud.dart
+++ b/frontend/appflowy_flutter/lib/workspace/presentation/settings/widgets/setting_cloud.dart
@@ -20,9 +20,10 @@ import 'setting_appflowy_cloud.dart';
import 'setting_supabase_cloud.dart';
class SettingCloud extends StatelessWidget {
- final VoidCallback didResetServerUrl;
const SettingCloud({required this.didResetServerUrl, super.key});
+ final VoidCallback didResetServerUrl;
+
@override
Widget build(BuildContext context) {
return FutureBuilder(
@@ -106,14 +107,15 @@ class SettingCloud extends StatelessWidget {
}
class CloudTypeSwitcher extends StatelessWidget {
- final AuthenticatorType cloudType;
- final Function(AuthenticatorType) onSelected;
const CloudTypeSwitcher({
+ super.key,
required this.cloudType,
required this.onSelected,
- super.key,
});
+ final AuthenticatorType cloudType;
+ final Function(AuthenticatorType) onSelected;
+
@override
Widget build(BuildContext context) {
final isDevelopMode = integrationMode().isDevelop;
@@ -193,17 +195,17 @@ class CloudTypeSwitcher extends StatelessWidget {
}
class CloudTypeItem extends StatelessWidget {
- final AuthenticatorType cloudType;
- final AuthenticatorType currentCloudtype;
- final Function(AuthenticatorType) onSelected;
-
const CloudTypeItem({
+ super.key,
required this.cloudType,
required this.currentCloudtype,
required this.onSelected,
- super.key,
});
+ final AuthenticatorType cloudType;
+ final AuthenticatorType currentCloudtype;
+ final Function(AuthenticatorType) onSelected;
+
@override
Widget build(BuildContext context) {
return SizedBox(
diff --git a/frontend/appflowy_flutter/lib/workspace/presentation/settings/widgets/setting_file_import_appflowy_data_view.dart b/frontend/appflowy_flutter/lib/workspace/presentation/settings/widgets/setting_file_import_appflowy_data_view.dart
index e461d5c695..fa689f4849 100644
--- a/frontend/appflowy_flutter/lib/workspace/presentation/settings/widgets/setting_file_import_appflowy_data_view.dart
+++ b/frontend/appflowy_flutter/lib/workspace/presentation/settings/widgets/setting_file_import_appflowy_data_view.dart
@@ -76,9 +76,10 @@ class _ImportAppFlowyDataState extends State<ImportAppFlowyData> {
}
class AppFlowyDataImportTip extends StatelessWidget {
- final url = "https://docs.appflowy.io/docs/appflowy/product/data-storage";
const AppFlowyDataImportTip({super.key});
+ final url = "https://docs.appflowy.io/docs/appflowy/product/data-storage";
+
@override
Widget build(BuildContext context) {
return Opacity(
diff --git a/frontend/appflowy_flutter/lib/workspace/presentation/settings/widgets/setting_local_cloud.dart b/frontend/appflowy_flutter/lib/workspace/presentation/settings/widgets/setting_local_cloud.dart
index bdfbc85f5a..365933b7b4 100644
--- a/frontend/appflowy_flutter/lib/workspace/presentation/settings/widgets/setting_local_cloud.dart
+++ b/frontend/appflowy_flutter/lib/workspace/presentation/settings/widgets/setting_local_cloud.dart
@@ -6,11 +6,9 @@ import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart';
class SettingLocalCloud extends StatelessWidget {
+ const SettingLocalCloud({super.key, required this.didResetServerUrl});
+
final VoidCallback didResetServerUrl;
- const SettingLocalCloud({
- required this.didResetServerUrl,
- super.key,
- });
@override
Widget build(BuildContext context) {
diff --git a/frontend/appflowy_flutter/lib/workspace/presentation/settings/widgets/setting_supabase_cloud.dart b/frontend/appflowy_flutter/lib/workspace/presentation/settings/widgets/setting_supabase_cloud.dart
index ebb9d73dbe..6d740380ed 100644
--- a/frontend/appflowy_flutter/lib/workspace/presentation/settings/widgets/setting_supabase_cloud.dart
+++ b/frontend/appflowy_flutter/lib/workspace/presentation/settings/widgets/setting_supabase_cloud.dart
@@ -22,9 +22,10 @@ import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:url_launcher/url_launcher.dart';
class SettingSupabaseCloudView extends StatelessWidget {
- final VoidCallback didResetServerUrl;
const SettingSupabaseCloudView({required this.didResetServerUrl, super.key});
+ final VoidCallback didResetServerUrl;
+
@override
Widget build(BuildContext context) {
return FutureBuilder<Either<CloudSettingPB, FlowyError>>(
@@ -75,11 +76,9 @@ class SettingSupabaseCloudView extends StatelessWidget {
}
class SupabaseCloudURLs extends StatelessWidget {
+ const SupabaseCloudURLs({super.key, required this.didUpdateUrls});
+
final VoidCallback didUpdateUrls;
- const SupabaseCloudURLs({
- required this.didUpdateUrls,
- super.key,
- });
@override
Widget build(BuildContext context) {
@@ -176,7 +175,6 @@ class EnableEncrypt extends StatelessWidget {
),
Column(
crossAxisAlignment: CrossAxisAlignment.start,
- mainAxisAlignment: MainAxisAlignment.start,
children: [
IntrinsicHeight(
child: Opacity(
@@ -193,7 +191,7 @@ class EnableEncrypt extends StatelessWidget {
child: FlowyTooltip(
message: LocaleKeys.settings_menu_clickToCopySecret.tr(),
child: FlowyButton(
- disable: !(state.setting.enableEncrypt),
+ disable: !state.setting.enableEncrypt,
decoration: BoxDecoration(
borderRadius: Corners.s5Border,
border: Border.all(
@@ -248,21 +246,21 @@ class SupabaseEnableSync extends StatelessWidget {
@visibleForTesting
class SupabaseInput extends StatefulWidget {
- final String title;
- final String url;
- final String hint;
- final String? error;
- final Function(String) onChanged;
-
const SupabaseInput({
+ super.key,
required this.title,
required this.url,
required this.hint,
- required this.onChanged,
required this.error,
- super.key,
+ required this.onChanged,
});
+ final String title;
+ final String url;
+ final String hint;
+ final String? error;
+ final Function(String) onChanged;
+
@override
SupabaseInputState createState() => SupabaseInputState();
}
@@ -310,9 +308,10 @@ class SupabaseInputState extends State<SupabaseInput> {
}
class SupabaseSelfhostTip extends StatelessWidget {
+ const SupabaseSelfhostTip({super.key});
+
final url =
"https://docs.appflowy.io/docs/guides/appflowy/self-hosting-appflowy-using-supabase";
- const SupabaseSelfhostTip({super.key});
@override
Widget build(BuildContext context) {
diff --git a/frontend/appflowy_flutter/lib/workspace/presentation/settings/widgets/setting_third_party_login.dart b/frontend/appflowy_flutter/lib/workspace/presentation/settings/widgets/setting_third_party_login.dart
index 15ae16ec20..73bf46f285 100644
--- a/frontend/appflowy_flutter/lib/workspace/presentation/settings/widgets/setting_third_party_login.dart
+++ b/frontend/appflowy_flutter/lib/workspace/presentation/settings/widgets/setting_third_party_login.dart
@@ -14,9 +14,10 @@ import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
class SettingThirdPartyLogin extends StatelessWidget {
- final VoidCallback didLogin;
const SettingThirdPartyLogin({required this.didLogin, super.key});
+ final VoidCallback didLogin;
+
@override
Widget build(BuildContext context) {
return BlocProvider(
diff --git a/frontend/appflowy_flutter/lib/workspace/presentation/settings/widgets/settings_appearance/brightness_setting.dart b/frontend/appflowy_flutter/lib/workspace/presentation/settings/widgets/settings_appearance/brightness_setting.dart
index ff456a2af2..aaa7004014 100644
--- a/frontend/appflowy_flutter/lib/workspace/presentation/settings/widgets/settings_appearance/brightness_setting.dart
+++ b/frontend/appflowy_flutter/lib/workspace/presentation/settings/widgets/settings_appearance/brightness_setting.dart
@@ -13,9 +13,10 @@ import 'package:flutter_bloc/flutter_bloc.dart';
import 'theme_setting_entry_template.dart';
class BrightnessSetting extends StatelessWidget {
- final ThemeMode currentThemeMode;
const BrightnessSetting({required this.currentThemeMode, super.key});
+ final ThemeMode currentThemeMode;
+
@override
Widget build(BuildContext context) {
return FlowySettingListTile(
diff --git a/frontend/appflowy_flutter/lib/workspace/presentation/settings/widgets/settings_appearance_view.dart b/frontend/appflowy_flutter/lib/workspace/presentation/settings/widgets/settings_appearance_view.dart
index a4e5924d1a..ccb6281210 100644
--- a/frontend/appflowy_flutter/lib/workspace/presentation/settings/widgets/settings_appearance_view.dart
+++ b/frontend/appflowy_flutter/lib/workspace/presentation/settings/widgets/settings_appearance_view.dart
@@ -20,7 +20,6 @@ class SettingsAppearanceView extends StatelessWidget {
child: BlocBuilder<AppearanceSettingsCubit, AppearanceSettingsState>(
builder: (context, state) {
return Column(
- crossAxisAlignment: CrossAxisAlignment.center,
children: [
ColorSchemeSetting(
currentTheme: state.appTheme.themeName,
diff --git a/frontend/appflowy_flutter/lib/workspace/presentation/settings/widgets/settings_customize_shortcuts_view.dart b/frontend/appflowy_flutter/lib/workspace/presentation/settings/widgets/settings_customize_shortcuts_view.dart
index f739597aff..f391ac2ad7 100644
--- a/frontend/appflowy_flutter/lib/workspace/presentation/settings/widgets/settings_customize_shortcuts_view.dart
+++ b/frontend/appflowy_flutter/lib/workspace/presentation/settings/widgets/settings_customize_shortcuts_view.dart
@@ -233,9 +233,10 @@ extension on RawKeyEvent {
}
class ShortcutsErrorView extends StatelessWidget {
- final String errorMessage;
const ShortcutsErrorView({super.key, required this.errorMessage});
+ final String errorMessage;
+
@override
Widget build(BuildContext context) {
return Row(
diff --git a/frontend/appflowy_flutter/lib/workspace/presentation/settings/widgets/settings_language_view.dart b/frontend/appflowy_flutter/lib/workspace/presentation/settings/widgets/settings_language_view.dart
index ff5229a494..45243b27c8 100644
--- a/frontend/appflowy_flutter/lib/workspace/presentation/settings/widgets/settings_language_view.dart
+++ b/frontend/appflowy_flutter/lib/workspace/presentation/settings/widgets/settings_language_view.dart
@@ -31,12 +31,9 @@ class SettingsLanguageView extends StatelessWidget {
}
class LanguageSelector extends StatelessWidget {
- final Locale currentLocale;
+ const LanguageSelector({super.key, required this.currentLocale});
- const LanguageSelector({
- super.key,
- required this.currentLocale,
- });
+ final Locale currentLocale;
@override
Widget build(BuildContext context) {
@@ -85,15 +82,15 @@ class LanguageItemsListView extends StatelessWidget {
}
class LanguageItem extends StatelessWidget {
- final Locale locale;
- final Locale currentLocale;
-
const LanguageItem({
super.key,
required this.locale,
required this.currentLocale,
});
+ final Locale locale;
+ final Locale currentLocale;
+
@override
Widget build(BuildContext context) {
return SizedBox(
diff --git a/frontend/appflowy_flutter/lib/workspace/presentation/settings/widgets/settings_user_view.dart b/frontend/appflowy_flutter/lib/workspace/presentation/settings/widgets/settings_user_view.dart
index 92fb73a147..003679f6b5 100644
--- a/frontend/appflowy_flutter/lib/workspace/presentation/settings/widgets/settings_user_view.dart
+++ b/frontend/appflowy_flutter/lib/workspace/presentation/settings/widgets/settings_user_view.dart
@@ -26,6 +26,13 @@ const defaultUserAvatar = '1F600';
const _iconSize = Size(60, 60);
class SettingsUserView extends StatelessWidget {
+ SettingsUserView(
+ this.user, {
+ required this.didLogin,
+ required this.didLogout,
+ required this.didOpenUser,
+ }) : super(key: ValueKey(user.id));
+
// Called when the user login in the setting dialog
final VoidCallback didLogin;
// Called when the user logout in the setting dialog
@@ -34,14 +41,6 @@ class SettingsUserView extends StatelessWidget {
final VoidCallback didOpenUser;
final UserProfilePB user;
- SettingsUserView(
- this.user, {
- required this.didLogin,
- required this.didLogout,
- required this.didOpenUser,
- Key? key,
- }) : super(key: ValueKey(user.id));
-
@override
Widget build(BuildContext context) {
return BlocProvider<SettingsUserViewBloc>(
@@ -227,12 +226,9 @@ class SettingsUserView extends StatelessWidget {
@visibleForTesting
class UserNameInput extends StatefulWidget {
- final String name;
+ const UserNameInput(this.name, {super.key});
- const UserNameInput(
- this.name, {
- super.key,
- });
+ final String name;
@override
UserNameInputState createState() => UserNameInputState();
@@ -292,12 +288,9 @@ class UserNameInputState extends State<UserNameInput> {
@visibleForTesting
class UserEmailInput extends StatefulWidget {
- final String email;
+ const UserEmailInput(this.email, {super.key});
- const UserEmailInput(
- this.email, {
- super.key,
- });
+ final String email;
@override
UserEmailInputState createState() => UserEmailInputState();
@@ -450,10 +443,6 @@ final builtInSVGIcons = [
// REMOVE this widget in next version 0.3.10
class IconGallery extends StatelessWidget {
- final String selectedIcon;
- final SelectIconCallback onSelectIcon;
- final Widget? defaultOption;
-
const IconGallery({
super.key,
required this.selectedIcon,
@@ -461,6 +450,10 @@ class IconGallery extends StatelessWidget {
this.defaultOption,
});
+ final String selectedIcon;
+ final SelectIconCallback onSelectIcon;
+ final Widget? defaultOption;
+
@override
Widget build(BuildContext context) {
return GridView.count(
@@ -484,11 +477,6 @@ class IconGallery extends StatelessWidget {
}
class IconOption extends StatelessWidget {
- final FlowySvgData emoji;
- final String iconUrl;
- final SelectIconCallback onSelectIcon;
- final bool isSelected;
-
IconOption({
required this.emoji,
required this.iconUrl,
@@ -496,6 +484,11 @@ class IconOption extends StatelessWidget {
required this.isSelected,
}) : super(key: ValueKey(emoji));
+ final FlowySvgData emoji;
+ final String iconUrl;
+ final SelectIconCallback onSelectIcon;
+ final bool isSelected;
+
@override
Widget build(BuildContext context) {
return InkWell(
@@ -520,14 +513,15 @@ class IconOption extends StatelessWidget {
}
class SettingLogoutButton extends StatelessWidget {
- final UserProfilePB user;
- final VoidCallback didLogout;
const SettingLogoutButton({
+ super.key,
required this.user,
required this.didLogout,
- super.key,
});
+ final UserProfilePB user;
+ final VoidCallback didLogout;
+
@override
Widget build(BuildContext context) {
return Center(
diff --git a/frontend/appflowy_flutter/lib/workspace/presentation/settings/widgets/theme_upload/theme_upload_decoration.dart b/frontend/appflowy_flutter/lib/workspace/presentation/settings/widgets/theme_upload/theme_upload_decoration.dart
index 87060c349b..260918c7de 100644
--- a/frontend/appflowy_flutter/lib/workspace/presentation/settings/widgets/theme_upload/theme_upload_decoration.dart
+++ b/frontend/appflowy_flutter/lib/workspace/presentation/settings/widgets/theme_upload/theme_upload_decoration.dart
@@ -23,7 +23,6 @@ class ThemeUploadDecoration extends StatelessWidget {
padding: ThemeUploadWidget.padding,
child: DottedBorder(
borderType: BorderType.RRect,
- strokeWidth: 1,
dashPattern: const [6, 6],
color: Theme.of(context)
.colorScheme
diff --git a/frontend/appflowy_flutter/lib/workspace/presentation/settings/widgets/theme_upload/theme_upload_failure_widget.dart b/frontend/appflowy_flutter/lib/workspace/presentation/settings/widgets/theme_upload/theme_upload_failure_widget.dart
index ca67a01f65..379c78acd5 100644
--- a/frontend/appflowy_flutter/lib/workspace/presentation/settings/widgets/theme_upload/theme_upload_failure_widget.dart
+++ b/frontend/appflowy_flutter/lib/workspace/presentation/settings/widgets/theme_upload/theme_upload_failure_widget.dart
@@ -18,7 +18,6 @@ class ThemeUploadFailureWidget extends StatelessWidget {
constraints: const BoxConstraints.expand(),
padding: ThemeUploadWidget.padding,
child: Column(
- mainAxisSize: MainAxisSize.max,
mainAxisAlignment: MainAxisAlignment.center,
children: [
const Spacer(),
diff --git a/frontend/appflowy_flutter/lib/workspace/presentation/settings/widgets/theme_upload/theme_upload_loading_widget.dart b/frontend/appflowy_flutter/lib/workspace/presentation/settings/widgets/theme_upload/theme_upload_loading_widget.dart
index 28b4115e51..643189a38f 100644
--- a/frontend/appflowy_flutter/lib/workspace/presentation/settings/widgets/theme_upload/theme_upload_loading_widget.dart
+++ b/frontend/appflowy_flutter/lib/workspace/presentation/settings/widgets/theme_upload/theme_upload_loading_widget.dart
@@ -17,7 +17,6 @@ class ThemeUploadLoadingWidget extends StatelessWidget {
.withOpacity(ThemeUploadWidget.fadeOpacity),
constraints: const BoxConstraints.expand(),
child: Column(
- mainAxisSize: MainAxisSize.max,
mainAxisAlignment: MainAxisAlignment.center,
children: [
CircularProgressIndicator(
diff --git a/frontend/appflowy_flutter/lib/workspace/presentation/settings/widgets/theme_upload/upload_new_theme_widget.dart b/frontend/appflowy_flutter/lib/workspace/presentation/settings/widgets/theme_upload/upload_new_theme_widget.dart
index 6605312028..967f5b0b0f 100644
--- a/frontend/appflowy_flutter/lib/workspace/presentation/settings/widgets/theme_upload/upload_new_theme_widget.dart
+++ b/frontend/appflowy_flutter/lib/workspace/presentation/settings/widgets/theme_upload/upload_new_theme_widget.dart
@@ -17,7 +17,6 @@ class UploadNewThemeWidget extends StatelessWidget {
.withOpacity(ThemeUploadWidget.fadeOpacity),
padding: ThemeUploadWidget.padding,
child: Column(
- mainAxisSize: MainAxisSize.max,
mainAxisAlignment: MainAxisAlignment.center,
children: [
const Spacer(),
diff --git a/frontend/appflowy_flutter/lib/workspace/presentation/settings/widgets/utils/form_factor.dart b/frontend/appflowy_flutter/lib/workspace/presentation/settings/widgets/utils/form_factor.dart
index 83a96075f5..715b88f279 100644
--- a/frontend/appflowy_flutter/lib/workspace/presentation/settings/widgets/utils/form_factor.dart
+++ b/frontend/appflowy_flutter/lib/workspace/presentation/settings/widgets/utils/form_factor.dart
@@ -5,8 +5,6 @@ enum FormFactor {
const FormFactor._(this.width);
- final double width;
-
factory FormFactor.fromWidth(double width) {
if (width < FormFactor.mobile.width) {
return FormFactor.mobile;
@@ -16,4 +14,6 @@ enum FormFactor {
return FormFactor.desktop;
}
}
+
+ final double width;
}
diff --git a/frontend/appflowy_flutter/lib/workspace/presentation/widgets/date_picker/mobile_appflowy_date_picker.dart b/frontend/appflowy_flutter/lib/workspace/presentation/widgets/date_picker/mobile_appflowy_date_picker.dart
index 98a3fa1483..2b2cc702e4 100644
--- a/frontend/appflowy_flutter/lib/workspace/presentation/widgets/date_picker/mobile_appflowy_date_picker.dart
+++ b/frontend/appflowy_flutter/lib/workspace/presentation/widgets/date_picker/mobile_appflowy_date_picker.dart
@@ -183,7 +183,6 @@ class _ReminderSelector extends StatelessWidget {
return FlowyOptionTile.text(
text: 'Reminder',
trailing: Row(
- crossAxisAlignment: CrossAxisAlignment.center,
children: [
const HSpace(6.0),
FlowyText(
@@ -247,7 +246,6 @@ class _ReminderSelectHeader extends StatelessWidget {
return SizedBox(
height: 56,
child: Row(
- crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
SizedBox(
@@ -370,7 +368,6 @@ class _IncludeTimePickerState extends State<_IncludeTimePicker> {
builder: (context) => ConstrainedBox(
constraints: const BoxConstraints(maxHeight: 300),
child: CupertinoDatePicker(
- showDayOfWeek: false,
mode: CupertinoDatePickerMode.time,
use24hFormat: use24hFormat,
onDateTimeChanged: (dateTime) {
@@ -403,7 +400,6 @@ class _IncludeTimePickerState extends State<_IncludeTimePicker> {
color: Theme.of(context).colorScheme.secondaryContainer,
border: Border.all(
color: Theme.of(context).colorScheme.outline,
- width: 1,
),
),
child: Row(children: children),
diff --git a/frontend/appflowy_flutter/lib/workspace/presentation/widgets/date_picker/widgets/date_picker.dart b/frontend/appflowy_flutter/lib/workspace/presentation/widgets/date_picker/widgets/date_picker.dart
index 930caa1cf2..e43e2b17b5 100644
--- a/frontend/appflowy_flutter/lib/workspace/presentation/widgets/date_picker/widgets/date_picker.dart
+++ b/frontend/appflowy_flutter/lib/workspace/presentation/widgets/date_picker/widgets/date_picker.dart
@@ -6,8 +6,8 @@ import 'package:easy_localization/easy_localization.dart';
import 'package:flowy_infra/theme_extension.dart';
import 'package:table_calendar/table_calendar.dart';
-final kFirstDay = DateTime.utc(1970, 1, 1);
-final kLastDay = DateTime.utc(2100, 1, 1);
+final kFirstDay = DateTime.utc(1970);
+final kLastDay = DateTime.utc(2100);
class DatePicker extends StatefulWidget {
const DatePicker({
@@ -167,33 +167,6 @@ class _DatePickerState extends State<DatePicker> {
}
class _CalendarStyle {
- _CalendarStyle({
- required this.rowHeight,
- required this.dowHeight,
- required this.headerVisible,
- required this.headerStyle,
- required this.dowTextStyle,
- required this.selectedColor,
- required this.availableGestures,
- });
-
- final double rowHeight;
- final double dowHeight;
- final bool headerVisible;
- final HeaderStyle headerStyle;
- final TextStyle dowTextStyle;
- final Color selectedColor;
- final AvailableGestures availableGestures;
-
- _CalendarStyle.mobile({
- required this.dowTextStyle,
- }) : rowHeight = 48,
- dowHeight = 48,
- headerVisible = false,
- headerStyle = const HeaderStyle(),
- selectedColor = const Color(0xFF00BCF0),
- availableGestures = AvailableGestures.horizontalSwipe;
-
_CalendarStyle.desktop({
required TextStyle textStyle,
required this.selectedColor,
@@ -208,18 +181,37 @@ class _CalendarStyle {
titleTextStyle: textStyle,
leftChevronMargin: EdgeInsets.zero,
leftChevronPadding: EdgeInsets.zero,
- leftChevronIcon: FlowySvg(
- FlowySvgs.arrow_left_s,
- color: iconColor,
- ),
+ leftChevronIcon: FlowySvg(FlowySvgs.arrow_left_s, color: iconColor),
rightChevronPadding: EdgeInsets.zero,
rightChevronMargin: EdgeInsets.zero,
- rightChevronIcon: FlowySvg(
- FlowySvgs.arrow_right_s,
- color: iconColor,
- ),
- headerMargin: EdgeInsets.zero,
+ rightChevronIcon: FlowySvg(FlowySvgs.arrow_right_s, color: iconColor),
headerPadding: const EdgeInsets.only(bottom: 8.0),
),
availableGestures = AvailableGestures.all;
+
+ _CalendarStyle.mobile({required this.dowTextStyle})
+ : rowHeight = 48,
+ dowHeight = 48,
+ headerVisible = false,
+ headerStyle = const HeaderStyle(),
+ selectedColor = const Color(0xFF00BCF0),
+ availableGestures = AvailableGestures.horizontalSwipe;
+
+ _CalendarStyle({
+ required this.rowHeight,
+ required this.dowHeight,
+ required this.headerVisible,
+ required this.headerStyle,
+ required this.dowTextStyle,
+ required this.selectedColor,
+ required this.availableGestures,
+ });
+
+ final double rowHeight;
+ final double dowHeight;
+ final bool headerVisible;
+ final HeaderStyle headerStyle;
+ final TextStyle dowTextStyle;
+ final Color selectedColor;
+ final AvailableGestures availableGestures;
}
diff --git a/frontend/appflowy_flutter/lib/workspace/presentation/widgets/date_picker/widgets/mobile_date_header.dart b/frontend/appflowy_flutter/lib/workspace/presentation/widgets/date_picker/widgets/mobile_date_header.dart
index 833400c63f..1d7471dac0 100644
--- a/frontend/appflowy_flutter/lib/workspace/presentation/widgets/date_picker/widgets/mobile_date_header.dart
+++ b/frontend/appflowy_flutter/lib/workspace/presentation/widgets/date_picker/widgets/mobile_date_header.dart
@@ -6,7 +6,6 @@ import 'package:flowy_infra_ui/style_widget/text.dart';
import 'package:flutter/material.dart';
import 'package:go_router/go_router.dart';
-const _iconWidth = 30.0;
const _height = 44.0;
class MobileDateHeader extends StatelessWidget {
@@ -26,13 +25,10 @@ class MobileDateHeader extends StatelessWidget {
FlowySvgs.close_s,
size: Size.square(_height),
),
- width: _iconWidth,
- iconPadding: EdgeInsets.zero,
onPressed: () => context.pop(),
),
),
Align(
- alignment: Alignment.center,
child: FlowyText.medium(
LocaleKeys.grid_field_dateFieldName.tr(),
fontSize: 16,
diff --git a/frontend/appflowy_flutter/lib/workspace/presentation/widgets/dialogs.dart b/frontend/appflowy_flutter/lib/workspace/presentation/widgets/dialogs.dart
index f3cfdad0dc..4fcec48065 100644
--- a/frontend/appflowy_flutter/lib/workspace/presentation/widgets/dialogs.dart
+++ b/frontend/appflowy_flutter/lib/workspace/presentation/widgets/dialogs.dart
@@ -61,7 +61,6 @@ class _NavigatorTextFieldDialogState extends State<NavigatorTextFieldDialog> {
),
VSpace(Insets.m),
FlowyFormTextInput(
- textAlign: TextAlign.center,
hintText: LocaleKeys.dialogCreatePageNameHint.tr(),
controller: controller,
textStyle: Theme.of(context).textTheme.bodySmall?.copyWith(
@@ -96,17 +95,17 @@ class _NavigatorTextFieldDialogState extends State<NavigatorTextFieldDialog> {
}
class NavigatorAlertDialog extends StatefulWidget {
- final String title;
- final void Function()? cancel;
- final void Function()? confirm;
-
const NavigatorAlertDialog({
+ super.key,
required this.title,
- this.confirm,
this.cancel,
- super.key,
+ this.confirm,
});
+ final String title;
+ final void Function()? cancel;
+ final void Function()? confirm;
+
@override
State<NavigatorAlertDialog> createState() => _CreateFlowyAlertDialog();
}
@@ -159,14 +158,6 @@ class _CreateFlowyAlertDialog extends State<NavigatorAlertDialog> {
}
class NavigatorOkCancelDialog extends StatelessWidget {
- final VoidCallback? onOkPressed;
- final VoidCallback? onCancelPressed;
- final String? okTitle;
- final String? cancelTitle;
- final String? title;
- final String message;
- final double? maxWidth;
-
const NavigatorOkCancelDialog({
super.key,
this.onOkPressed,
@@ -178,6 +169,14 @@ class NavigatorOkCancelDialog extends StatelessWidget {
this.maxWidth,
});
+ final VoidCallback? onOkPressed;
+ final VoidCallback? onCancelPressed;
+ final String? okTitle;
+ final String? cancelTitle;
+ final String? title;
+ final String message;
+ final double? maxWidth;
+
@override
Widget build(BuildContext context) {
return StyledDialog(
@@ -218,14 +217,6 @@ class NavigatorOkCancelDialog extends StatelessWidget {
}
class OkCancelButton extends StatelessWidget {
- final VoidCallback? onOkPressed;
- final VoidCallback? onCancelPressed;
- final String? okTitle;
- final String? cancelTitle;
- final double? minHeight;
- final MainAxisAlignment alignment;
- final TextButtonMode mode;
-
const OkCancelButton({
super.key,
this.onOkPressed,
@@ -237,6 +228,14 @@ class OkCancelButton extends StatelessWidget {
this.mode = TextButtonMode.big,
});
+ final VoidCallback? onOkPressed;
+ final VoidCallback? onCancelPressed;
+ final String? okTitle;
+ final String? cancelTitle;
+ final double? minHeight;
+ final MainAxisAlignment alignment;
+ final TextButtonMode mode;
+
@override
Widget build(BuildContext context) {
return SizedBox(
diff --git a/frontend/appflowy_flutter/lib/workspace/presentation/widgets/edit_panel/edit_panel.dart b/frontend/appflowy_flutter/lib/workspace/presentation/widgets/edit_panel/edit_panel.dart
index 003fcf23bb..70d6479cf5 100644
--- a/frontend/appflowy_flutter/lib/workspace/presentation/widgets/edit_panel/edit_panel.dart
+++ b/frontend/appflowy_flutter/lib/workspace/presentation/widgets/edit_panel/edit_panel.dart
@@ -10,14 +10,15 @@ import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:appflowy/generated/locale_keys.g.dart';
class EditPanel extends StatelessWidget {
- final EditPanelContext panelContext;
- final VoidCallback onEndEdit;
const EditPanel({
super.key,
required this.panelContext,
required this.onEndEdit,
});
+ final EditPanelContext panelContext;
+ final VoidCallback onEndEdit;
+
@override
Widget build(BuildContext context) {
return Container(
@@ -43,8 +44,10 @@ class EditPanel extends StatelessWidget {
}
class EditPanelTopBar extends StatelessWidget {
- final VoidCallback onClose;
const EditPanelTopBar({super.key, required this.onClose});
+
+ final VoidCallback onClose;
+
@override
Widget build(BuildContext context) {
return SizedBox(
diff --git a/frontend/appflowy_flutter/lib/workspace/presentation/widgets/edit_panel/panel_animation.dart b/frontend/appflowy_flutter/lib/workspace/presentation/widgets/edit_panel/panel_animation.dart
index 2d7ba70518..1338048e1b 100644
--- a/frontend/appflowy_flutter/lib/workspace/presentation/widgets/edit_panel/panel_animation.dart
+++ b/frontend/appflowy_flutter/lib/workspace/presentation/widgets/edit_panel/panel_animation.dart
@@ -1,13 +1,6 @@
import 'package:flutter/material.dart';
class AnimatedPanel extends StatefulWidget {
- final bool isClosed;
- final double closedX;
- final double closedY;
- final double duration;
- final Curve? curve;
- final Widget? child;
-
const AnimatedPanel({
super.key,
this.isClosed = false,
@@ -18,6 +11,13 @@ class AnimatedPanel extends StatefulWidget {
this.child,
});
+ final bool isClosed;
+ final double closedX;
+ final double closedY;
+ final double duration;
+ final Curve? curve;
+ final Widget? child;
+
@override
AnimatedPanelState createState() => AnimatedPanelState();
}
@@ -40,7 +40,7 @@ class AnimatedPanelState extends State<AnimatedPanel> {
_isHidden =
widget.isClosed && value == Offset(widget.closedX, widget.closedY);
return _isHidden
- ? Container()
+ ? const SizedBox.shrink()
: Transform.translate(offset: value, child: c);
},
child: widget.child,
diff --git a/frontend/appflowy_flutter/lib/workspace/presentation/widgets/float_bubble/question_bubble.dart b/frontend/appflowy_flutter/lib/workspace/presentation/widgets/float_bubble/question_bubble.dart
index 99ba67144c..9f29ba200e 100644
--- a/frontend/appflowy_flutter/lib/workspace/presentation/widgets/float_bubble/question_bubble.dart
+++ b/frontend/appflowy_flutter/lib/workspace/presentation/widgets/float_bubble/question_bubble.dart
@@ -174,7 +174,6 @@ class FlowyVersionDescription extends CustomActionCell {
return SizedBox(
height: 30,
child: Column(
- mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Divider(
@@ -203,9 +202,9 @@ class FlowyVersionDescription extends CustomActionCell {
enum BubbleAction { whatsNews, help, debug, shortcuts, markdown, github }
class BubbleActionWrapper extends ActionCell {
- final BubbleAction inner;
-
BubbleActionWrapper(this.inner);
+
+ final BubbleAction inner;
@override
Widget? leftIcon(Color iconColor) => inner.emoji;
diff --git a/frontend/appflowy_flutter/lib/workspace/presentation/widgets/pop_up_action.dart b/frontend/appflowy_flutter/lib/workspace/presentation/widgets/pop_up_action.dart
index 1ebbc029ca..be91eb7c91 100644
--- a/frontend/appflowy_flutter/lib/workspace/presentation/widgets/pop_up_action.dart
+++ b/frontend/appflowy_flutter/lib/workspace/presentation/widgets/pop_up_action.dart
@@ -5,18 +5,8 @@ import 'package:flutter/material.dart';
import 'package:styled_widget/styled_widget.dart';
class PopoverActionList<T extends PopoverAction> extends StatefulWidget {
- final List<T> actions;
- final PopoverMutex? mutex;
- final Function(T, PopoverController) onSelected;
- final BoxConstraints constraints;
- final PopoverDirection direction;
- final Widget Function(PopoverController) buildChild;
- final VoidCallback? onPopupBuilder;
- final VoidCallback? onClosed;
- final bool asBarrier;
- final Offset offset;
-
const PopoverActionList({
+ super.key,
required this.actions,
required this.buildChild,
required this.onSelected,
@@ -31,9 +21,19 @@ class PopoverActionList<T extends PopoverAction> extends StatefulWidget {
maxWidth: 460,
maxHeight: 300,
),
- super.key,
});
+ final List<T> actions;
+ final Widget Function(PopoverController) buildChild;
+ final Function(T, PopoverController) onSelected;
+ final PopoverMutex? mutex;
+ final VoidCallback? onClosed;
+ final VoidCallback? onPopupBuilder;
+ final PopoverDirection direction;
+ final bool asBarrier;
+ final Offset offset;
+ final BoxConstraints constraints;
+
@override
State<PopoverActionList<T>> createState() => _PopoverActionListState<T>();
}
@@ -131,9 +131,6 @@ class ActionListSizes {
}
class ActionCellWidget<T extends PopoverAction> extends StatelessWidget {
- final T action;
- final Function(T) onSelected;
- final double itemHeight;
const ActionCellWidget({
super.key,
required this.action,
@@ -141,6 +138,10 @@ class ActionCellWidget<T extends PopoverAction> extends StatelessWidget {
required this.itemHeight,
});
+ final T action;
+ final Function(T) onSelected;
+ final double itemHeight;
+
@override
Widget build(BuildContext context) {
final actionCell = action as ActionCell;
diff --git a/frontend/appflowy_flutter/lib/workspace/presentation/widgets/tab_bar_item.dart b/frontend/appflowy_flutter/lib/workspace/presentation/widgets/tab_bar_item.dart
index 7a8e91e60a..1023553efb 100644
--- a/frontend/appflowy_flutter/lib/workspace/presentation/widgets/tab_bar_item.dart
+++ b/frontend/appflowy_flutter/lib/workspace/presentation/widgets/tab_bar_item.dart
@@ -4,12 +4,9 @@ import 'package:flowy_infra_ui/flowy_infra_ui.dart';
import 'package:flutter/material.dart';
class ViewTabBarItem extends StatefulWidget {
- final ViewPB view;
+ const ViewTabBarItem({super.key, required this.view});
- const ViewTabBarItem({
- super.key,
- required this.view,
- });
+ final ViewPB view;
@override
State<ViewTabBarItem> createState() => _ViewTabBarItemState();
diff --git a/frontend/appflowy_flutter/lib/workspace/presentation/widgets/toggle/toggle.dart b/frontend/appflowy_flutter/lib/workspace/presentation/widgets/toggle/toggle.dart
index a81db54d89..c788eaeea3 100644
--- a/frontend/appflowy_flutter/lib/workspace/presentation/widgets/toggle/toggle.dart
+++ b/frontend/appflowy_flutter/lib/workspace/presentation/widgets/toggle/toggle.dart
@@ -3,14 +3,6 @@ import 'package:flowy_infra/theme_extension.dart';
import 'package:flutter/material.dart';
class Toggle extends StatelessWidget {
- final ToggleStyle style;
- final bool value;
- final Color? thumbColor;
- final Color? activeBackgroundColor;
- final Color? inactiveBackgroundColor;
- final void Function(bool) onChanged;
- final EdgeInsets padding;
-
const Toggle({
super.key,
required this.value,
@@ -22,6 +14,14 @@ class Toggle extends StatelessWidget {
this.padding = const EdgeInsets.all(8.0),
});
+ final bool value;
+ final void Function(bool) onChanged;
+ final ToggleStyle style;
+ final Color? thumbColor;
+ final Color? activeBackgroundColor;
+ final Color? inactiveBackgroundColor;
+ final EdgeInsets padding;
+
@override
Widget build(BuildContext context) {
final backgroundColor = value
diff --git a/frontend/appflowy_flutter/lib/workspace/presentation/widgets/toggle/toggle_style.dart b/frontend/appflowy_flutter/lib/workspace/presentation/widgets/toggle/toggle_style.dart
index 165f0ad7bc..d11bb5e40e 100644
--- a/frontend/appflowy_flutter/lib/workspace/presentation/widgets/toggle/toggle_style.dart
+++ b/frontend/appflowy_flutter/lib/workspace/presentation/widgets/toggle/toggle_style.dart
@@ -1,15 +1,14 @@
class ToggleStyle {
- final double height;
- final double width;
-
- final double thumbRadius;
-
ToggleStyle({
required this.height,
required this.width,
required this.thumbRadius,
});
+ final double height;
+ final double width;
+ final double thumbRadius;
+
static ToggleStyle get big =>
ToggleStyle(height: 16, width: 27, thumbRadius: 14);
diff --git a/frontend/appflowy_flutter/lib/workspace/presentation/widgets/user_avatar.dart b/frontend/appflowy_flutter/lib/workspace/presentation/widgets/user_avatar.dart
index 31c84332cf..766f012af8 100644
--- a/frontend/appflowy_flutter/lib/workspace/presentation/widgets/user_avatar.dart
+++ b/frontend/appflowy_flutter/lib/workspace/presentation/widgets/user_avatar.dart
@@ -38,7 +38,7 @@ class UserAvatar extends StatelessWidget {
.where((element) => element.isNotEmpty)
.take(initialsCount)
.map((element) => element[0].toUpperCase())
- .join('');
+ .join();
return Container(
width: size,
diff --git a/frontend/appflowy_flutter/lib/workspace/presentation/widgets/view_title_bar.dart b/frontend/appflowy_flutter/lib/workspace/presentation/widgets/view_title_bar.dart
index d4f2d00368..45872b9bae 100644
--- a/frontend/appflowy_flutter/lib/workspace/presentation/widgets/view_title_bar.dart
+++ b/frontend/appflowy_flutter/lib/workspace/presentation/widgets/view_title_bar.dart
@@ -48,7 +48,7 @@ class _ViewTitleBarState extends State<ViewTitleBar> {
Widget build(BuildContext context) {
return FutureBuilder<List<ViewPB>>(
future: ancestors,
- builder: ((context, snapshot) {
+ builder: (context, snapshot) {
final ancestors = snapshot.data;
if (ancestors == null) {
return const SizedBox.shrink();
@@ -68,14 +68,13 @@ class _ViewTitleBarState extends State<ViewTitleBar> {
child: _ViewTitle(
key: ValueKey(ancestors.last),
view: ancestors.last,
- behavior: _ViewTitleBehavior.editable,
maxTitleWidth: constraints.maxWidth - 50.0,
onUpdated: () => setState(() => _reloadAncestors()),
),
);
},
);
- }),
+ },
);
}
@@ -258,7 +257,6 @@ class _ViewTitleState extends State<_ViewTitle> {
height: 36.0,
width: 220,
child: FlowyTextField(
- autoFocus: true,
controller: textEditingController,
onSubmitted: (text) async {
if (text.isNotEmpty && text != name) {
diff --git a/frontend/appflowy_flutter/packages/appflowy_popover/example/lib/main.dart b/frontend/appflowy_flutter/packages/appflowy_popover/example/lib/main.dart
index d5f55866b0..96c11dabbf 100644
--- a/frontend/appflowy_flutter/packages/appflowy_popover/example/lib/main.dart
+++ b/frontend/appflowy_flutter/packages/appflowy_popover/example/lib/main.dart
@@ -64,66 +64,68 @@ class _MyHomePageState extends State<MyHomePage> {
// the App.build method, and use it to set our appbar title.
title: Text(widget.title),
),
- body: Row(children: [
- Column(children: [
- const ExampleButton(
- label: "Left top",
- offset: Offset(0, 10),
- direction: PopoverDirection.bottomWithLeftAligned,
- ),
- Expanded(child: Container()),
- const ExampleButton(
- label: "Left bottom",
- offset: Offset(0, -10),
- direction: PopoverDirection.topWithLeftAligned,
+ body: const Row(
+ children: [
+ Column(children: [
+ ExampleButton(
+ label: "Left top",
+ offset: Offset(0, 10),
+ direction: PopoverDirection.bottomWithLeftAligned,
+ ),
+ Expanded(child: SizedBox.shrink()),
+ ExampleButton(
+ label: "Left bottom",
+ offset: Offset(0, -10),
+ direction: PopoverDirection.topWithLeftAligned,
+ ),
+ ]),
+ Expanded(
+ child: Column(
+ mainAxisAlignment: MainAxisAlignment.center,
+ children: [
+ ExampleButton(
+ label: "Top",
+ offset: Offset(0, 10),
+ direction: PopoverDirection.bottomWithCenterAligned,
+ ),
+ Expanded(
+ child: Column(
+ mainAxisAlignment: MainAxisAlignment.center,
+ crossAxisAlignment: CrossAxisAlignment.center,
+ children: [
+ ExampleButton(
+ label: "Central",
+ offset: Offset(0, 10),
+ direction: PopoverDirection.bottomWithCenterAligned,
+ ),
+ ],
+ ),
+ ),
+ ExampleButton(
+ label: "Bottom",
+ offset: Offset(0, -10),
+ direction: PopoverDirection.topWithCenterAligned,
+ ),
+ ],
+ ),
),
- ]),
- const Expanded(
- child: Column(
- mainAxisAlignment: MainAxisAlignment.center,
+ Column(
children: [
ExampleButton(
- label: "Top",
+ label: "Right top",
offset: Offset(0, 10),
- direction: PopoverDirection.bottomWithCenterAligned,
- ),
- Expanded(
- child: Column(
- mainAxisAlignment: MainAxisAlignment.center,
- crossAxisAlignment: CrossAxisAlignment.center,
- children: [
- ExampleButton(
- label: "Central",
- offset: Offset(0, 10),
- direction: PopoverDirection.bottomWithCenterAligned,
- ),
- ],
- ),
+ direction: PopoverDirection.bottomWithRightAligned,
),
+ Expanded(child: SizedBox.shrink()),
ExampleButton(
- label: "Bottom",
+ label: "Right bottom",
offset: Offset(0, -10),
- direction: PopoverDirection.topWithCenterAligned,
+ direction: PopoverDirection.topWithRightAligned,
),
],
- ),
- ),
- const Column(
- children: [
- ExampleButton(
- label: "Right top",
- offset: Offset(0, 10),
- direction: PopoverDirection.bottomWithRightAligned,
- ),
- Expanded(child: SizedBox.shrink()),
- ExampleButton(
- label: "Right bottom",
- offset: Offset(0, -10),
- direction: PopoverDirection.topWithRightAligned,
- ),
- ],
- )
- ]),
+ )
+ ],
+ ),
);
}
}
diff --git a/frontend/appflowy_flutter/packages/flowy_infra/lib/plugins/bloc/dynamic_plugin_bloc.dart b/frontend/appflowy_flutter/packages/flowy_infra/lib/plugins/bloc/dynamic_plugin_bloc.dart
index 1aaa75ef57..ee1adee332 100644
--- a/frontend/appflowy_flutter/packages/flowy_infra/lib/plugins/bloc/dynamic_plugin_bloc.dart
+++ b/frontend/appflowy_flutter/packages/flowy_infra/lib/plugins/bloc/dynamic_plugin_bloc.dart
@@ -3,6 +3,7 @@ import 'package:flowy_infra/plugins/service/models/exceptions.dart';
import 'package:flowy_infra/plugins/service/plugin_service.dart';
import '../../file_picker/file_picker_impl.dart';
+
import 'dynamic_plugin_event.dart';
import 'dynamic_plugin_state.dart';
diff --git a/frontend/appflowy_flutter/test/bloc_test/board_test/util.dart b/frontend/appflowy_flutter/test/bloc_test/board_test/util.dart
index 8bcbad60c6..0a5ba44d20 100644
--- a/frontend/appflowy_flutter/test/bloc_test/board_test/util.dart
+++ b/frontend/appflowy_flutter/test/bloc_test/board_test/util.dart
@@ -14,10 +14,10 @@ import '../../util.dart';
import '../grid_test/util.dart';
class AppFlowyBoardTest {
- final AppFlowyUnitTest unitTest;
-
AppFlowyBoardTest({required this.unitTest});
+ final AppFlowyUnitTest unitTest;
+
static Future<AppFlowyBoardTest> ensureInitialized() async {
final inner = await AppFlowyUnitTest.ensureInitialized();
return AppFlowyBoardTest(unitTest: inner);
@@ -51,7 +51,7 @@ class AppFlowyBoardTest {
}
Future<void> boardResponseFuture() {
- return Future.delayed(boardResponseDuration(milliseconds: 200));
+ return Future.delayed(boardResponseDuration());
}
Duration boardResponseDuration({int milliseconds = 200}) {
@@ -59,11 +59,11 @@ Duration boardResponseDuration({int milliseconds = 200}) {
}
class BoardTestContext {
+ BoardTestContext(this.gridView, this._boardDataController);
+
final ViewPB gridView;
final DatabaseController _boardDataController;
- BoardTestContext(this.gridView, this._boardDataController);
-
List<RowInfo> get rowInfos {
return _boardDataController.rowCache.rowInfos;
}
diff --git a/frontend/appflowy_flutter/test/bloc_test/grid_test/util.dart b/frontend/appflowy_flutter/test/bloc_test/grid_test/util.dart
index 62e50161f6..f6cb9308e9 100644
--- a/frontend/appflowy_flutter/test/bloc_test/grid_test/util.dart
+++ b/frontend/appflowy_flutter/test/bloc_test/grid_test/util.dart
@@ -14,11 +14,11 @@ import 'package:appflowy_backend/protobuf/flowy-database2/field_entities.pb.dart
import '../../util.dart';
class GridTestContext {
+ GridTestContext(this.gridView, this.gridController);
+
final ViewPB gridView;
final DatabaseController gridController;
- GridTestContext(this.gridView, this.gridController);
-
List<RowInfo> get rowInfos {
return gridController.rowCache.rowInfos;
}
@@ -112,10 +112,10 @@ Future<FieldEditorBloc> createFieldEditor({
/// Create a empty Grid for test
class AppFlowyGridTest {
- final AppFlowyUnitTest unitTest;
-
AppFlowyGridTest({required this.unitTest});
+ final AppFlowyUnitTest unitTest;
+
static Future<AppFlowyGridTest> ensureInitialized() async {
final inner = await AppFlowyUnitTest.ensureInitialized();
return AppFlowyGridTest(unitTest: inner);
@@ -151,9 +151,10 @@ class AppFlowyGridTest {
/// Create a new Grid for cell test
class AppFlowyGridCellTest {
+ AppFlowyGridCellTest({required this.gridTest});
+
late GridTestContext context;
final AppFlowyGridTest gridTest;
- AppFlowyGridCellTest({required this.gridTest});
static Future<AppFlowyGridCellTest> ensureInitialized() async {
final gridTest = await AppFlowyGridTest.ensureInitialized();
diff --git a/frontend/appflowy_flutter/test/bloc_test/home_test/home_bloc_test.dart b/frontend/appflowy_flutter/test/bloc_test/home_test/home_bloc_test.dart
index b6101b719d..ec7a357ee6 100644
--- a/frontend/appflowy_flutter/test/bloc_test/home_test/home_bloc_test.dart
+++ b/frontend/appflowy_flutter/test/bloc_test/home_test/home_bloc_test.dart
@@ -19,8 +19,7 @@ void main() {
.then((result) => result.fold((l) => l, (r) => throw Exception()));
await blocResponseFuture();
- final homeBloc = HomeBloc(testContext.userProfile, workspaceSetting)
- ..add(const HomeEvent.initial());
+ final homeBloc = HomeBloc(workspaceSetting)..add(const HomeEvent.initial());
await blocResponseFuture();
assert(homeBloc.state.workspaceSetting.hasLatestView());
@@ -32,8 +31,7 @@ void main() {
.then((result) => result.fold((l) => l, (r) => throw Exception()));
await blocResponseFuture();
- final homeBloc = HomeBloc(testContext.userProfile, workspaceSetting)
- ..add(const HomeEvent.initial());
+ final homeBloc = HomeBloc(workspaceSetting)..add(const HomeEvent.initial());
await blocResponseFuture();
final app = await testContext.createWorkspace();
diff --git a/frontend/appflowy_flutter/test/bloc_test/home_test/trash_bloc_test.dart b/frontend/appflowy_flutter/test/bloc_test/home_test/trash_bloc_test.dart
index 5fc2c546c2..0bd464e1b0 100644
--- a/frontend/appflowy_flutter/test/bloc_test/home_test/trash_bloc_test.dart
+++ b/frontend/appflowy_flutter/test/bloc_test/home_test/trash_bloc_test.dart
@@ -6,13 +6,13 @@ import 'package:flutter_test/flutter_test.dart';
import '../../util.dart';
class TrashTestContext {
+ TrashTestContext(this.unitTest);
+
late ViewPB view;
late ViewBloc viewBloc;
late List<ViewPB> allViews;
final AppFlowyUnitTest unitTest;
- TrashTestContext(this.unitTest);
-
Future<void> initialize() async {
view = await unitTest.createWorkspace();
viewBloc = ViewBloc(view: view)..add(const ViewEvent.initial());
@@ -64,7 +64,7 @@ void main() {
final context = TrashTestContext(unitTest);
await context.initialize();
final trashBloc = TrashBloc()..add(const TrashEvent.initial());
- await blocResponseFuture(millisecond: 200);
+ await blocResponseFuture();
// delete a view
final deletedView = context.viewBloc.state.view.childViews[0];
diff --git a/frontend/appflowy_flutter/test/unit_test/theme/theme_test.dart b/frontend/appflowy_flutter/test/unit_test/theme/theme_test.dart
index 405e10a6af..5563c93c15 100644
--- a/frontend/appflowy_flutter/test/unit_test/theme/theme_test.dart
+++ b/frontend/appflowy_flutter/test/unit_test/theme/theme_test.dart
@@ -70,7 +70,7 @@ void main() {
test('fromName throws error for non-existent theme', () async {
expect(
- () async => await AppTheme.fromName(
+ () async => AppTheme.fromName(
'bogus',
pluginService: MockPluginService(),
),
diff --git a/frontend/appflowy_flutter/test/util.dart b/frontend/appflowy_flutter/test/util.dart
index 51326c7586..57158a138d 100644
--- a/frontend/appflowy_flutter/test/util.dart
+++ b/frontend/appflowy_flutter/test/util.dart
@@ -114,7 +114,7 @@ void _pathProviderInitialized() {
class AppFlowyApplicationUniTest implements EntryPoint {
@override
Widget create(LaunchConfiguration config) {
- return Container();
+ return const SizedBox.shrink();
}
}