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: dart code cleanup (#4484)

Richard Shiue6591d5de52c5
diff --git a/frontend/appflowy_flutter/integration_test/document/document_alignment_test.dart b/frontend/appflowy_flutter/integration_test/document/document_alignment_test.dart
index 7ce09c559d..2bf621dda0 100644
--- a/frontend/appflowy_flutter/integration_test/document/document_alignment_test.dart
+++ b/frontend/appflowy_flutter/integration_test/document/document_alignment_test.dart
@@ -57,7 +57,7 @@ void main() {
final editorState = tester.editor.getCurrentEditorState();
final first = editorState.getNodeAtPath([0])!;
-
+
// expect to see text aligned to the right
await FlowyTestKeyboard.simulateKeyDownEvent(
[
diff --git a/frontend/appflowy_flutter/lib/mobile/presentation/database/board/widgets/mobile_hidden_groups_column.dart b/frontend/appflowy_flutter/lib/mobile/presentation/database/board/widgets/mobile_hidden_groups_column.dart
index 996ceba8f6..520dfff0d9 100644
--- a/frontend/appflowy_flutter/lib/mobile/presentation/database/board/widgets/mobile_hidden_groups_column.dart
+++ b/frontend/appflowy_flutter/lib/mobile/presentation/database/board/widgets/mobile_hidden_groups_column.dart
@@ -160,7 +160,9 @@ class MobileHiddenGroup extends StatelessWidget {
final cells = group.rows.map(
(item) {
final cellContext =
- databaseController.rowCache.loadCells(item)[primaryField.id]!;
+ databaseController.rowCache.loadCells(item).firstWhere(
+ (cellContext) => cellContext.fieldId == primaryField.id,
+ );
return TextButton(
style: TextButton.styleFrom(
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 c3e385b4e7..a2f96b70a4 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
@@ -29,7 +29,8 @@ class SelectOptionCellBackendService {
final payload = RepeatedSelectOptionPayload()
..viewId = viewId
..fieldId = fieldId
- ..rowId = rowId..items.add(option);
+ ..rowId = rowId
+ ..items.add(option);
return DatabaseEventInsertOrUpdateSelectOption(payload).send();
},
@@ -47,7 +48,7 @@ class SelectOptionCellBackendService {
..viewId = viewId
..fieldId = fieldId
..rowId = rowId;
-
+
return DatabaseEventInsertOrUpdateSelectOption(payload).send();
}
diff --git a/frontend/appflowy_flutter/lib/plugins/database/application/defines.dart b/frontend/appflowy_flutter/lib/plugins/database/application/defines.dart
index a7f5b862d9..d21f533f42 100644
--- a/frontend/appflowy_flutter/lib/plugins/database/application/defines.dart
+++ b/frontend/appflowy_flutter/lib/plugins/database/application/defines.dart
@@ -8,7 +8,6 @@ import 'package:appflowy_backend/protobuf/flowy-error/errors.pb.dart';
import 'package:dartz/dartz.dart';
import 'package:freezed_annotation/freezed_annotation.dart';
-import 'cell/cell_controller.dart';
import 'field/field_info.dart';
import 'row/row_cache.dart';
import 'row/row_service.dart';
@@ -34,8 +33,6 @@ typedef OnNumOfRowsChanged = void Function(
typedef OnError = void Function(FlowyError);
-typedef CellContextByFieldId = LinkedHashMap<String, CellContext>;
-
@freezed
class LoadingState with _$LoadingState {
const factory LoadingState.idle() = _Idle;
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 da0e945f05..ebf5a20b8f 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
@@ -168,7 +168,11 @@ class FieldBackendService {
Future<Either<Unit, FlowyError>> updateType({
required FieldType fieldType,
}) {
- return updateFieldType(viewId: viewId, fieldId: fieldId, fieldType: fieldType);
+ return updateFieldType(
+ viewId: viewId,
+ fieldId: fieldId,
+ fieldType: fieldType,
+ );
}
Future<Either<Unit, FlowyError>> delete() {
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 e30e2ef507..6e1d1b5cde 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
@@ -8,7 +8,6 @@ import 'package:freezed_annotation/freezed_annotation.dart';
import '../cell/cell_cache.dart';
import '../cell/cell_controller.dart';
-import '../defines.dart';
import 'row_list.dart';
import 'row_service.dart';
@@ -189,7 +188,7 @@ class RowCache {
RowUpdateCallback addListener({
required RowId rowId,
- void Function(CellContextByFieldId, ChangedReason)? onRowChanged,
+ void Function(List<CellContext>, ChangedReason)? onRowChanged,
}) {
void listenerHandler() async {
if (onRowChanged != null) {
@@ -209,7 +208,7 @@ class RowCache {
_changedNotifier.removeListener(callback);
}
- CellContextByFieldId loadCells(RowMetaPB rowMeta) {
+ List<CellContext> loadCells(RowMetaPB rowMeta) {
final rowInfo = _rowList.get(rowMeta.id);
if (rowInfo == null) {
_loadRow(rowMeta.id);
@@ -241,16 +240,15 @@ class RowCache {
);
}
- CellContextByFieldId _makeCells(RowMetaPB rowMeta) {
- // TODO(RS): no need to use HashMap
- final cellContextMap = CellContextByFieldId();
- for (final fieldInfo in _fieldDelegate.fieldInfos) {
- cellContextMap[fieldInfo.id] = CellContext(
- rowId: rowMeta.id,
- fieldId: fieldInfo.id,
- );
- }
- return cellContextMap;
+ List<CellContext> _makeCells(RowMetaPB rowMeta) {
+ return _fieldDelegate.fieldInfos
+ .map(
+ (fieldInfo) => CellContext(
+ rowId: rowMeta.id,
+ fieldId: fieldInfo.id,
+ ),
+ )
+ .toList();
}
RowInfo buildGridRow(RowMetaPB rowMetaPB) {
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 5fc751c380..0212c28f51 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
@@ -2,10 +2,10 @@ import 'package:appflowy_backend/protobuf/flowy-database2/row_entities.pb.dart';
import 'package:flutter/material.dart';
import '../cell/cell_cache.dart';
-import '../defines.dart';
+import '../cell/cell_controller.dart';
import 'row_cache.dart';
-typedef OnRowChanged = void Function(CellContextByFieldId, ChangedReason);
+typedef OnRowChanged = void Function(List<CellContext>, ChangedReason);
class RowController {
final RowMetaPB rowMeta;
@@ -25,7 +25,7 @@ class RowController {
this.groupId,
}) : _rowCache = rowCache;
- CellContextByFieldId loadData() {
+ List<CellContext> loadData() {
return _rowCache.loadCells(rowMeta);
}
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 a0c89721f7..fca7e01520 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
@@ -386,7 +386,9 @@ class HiddenGroupPopupItemList extends StatelessWidget {
context.read<BoardBloc>().databaseController;
return HiddenGroupPopupItem(
- cellContext: rowCache.loadCells(item)[primaryFieldId]!,
+ cellContext: rowCache.loadCells(item).firstWhere(
+ (cellContext) => cellContext.fieldId == primaryFieldId,
+ ),
rowController: rowController,
rowMeta: item,
cellBuilder: CardCellBuilder(
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 9d6e36caa9..5a5a47b34f 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
@@ -30,7 +30,6 @@ class CalendarEventEditorBloc
.id;
final cells = rowController
.loadData()
- .values
.where(
(cellContext) =>
_filterCellContext(cellContext, primaryFieldId),
@@ -61,7 +60,7 @@ class CalendarEventEditorBloc
final primaryFieldId = fieldController.fieldInfos
.firstWhere((fieldInfo) => fieldInfo.isPrimary)
.id;
- final cellData = cells.values
+ final cellData = cells
.where(
(cellContext) => _filterCellContext(cellContext, primaryFieldId),
)
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 2fc7f2fc79..85b55e671f 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,8 +1,6 @@
import 'dart:async';
-import 'dart:collection';
import 'package:appflowy/plugins/database/application/cell/cell_controller.dart';
-import 'package:appflowy/plugins/database/application/defines.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';
@@ -48,17 +46,19 @@ class RowBloc extends Bloc<RowEvent, RowState> {
createRow: () {
_rowBackendSvc.createRowAfter(rowId);
},
- didReceiveCells: (CellContextByFieldId cellByFieldId, reason) {
- cellByFieldId.removeWhere(
- (_, cellContext) => !fieldController
- .getField(cellContext.fieldId)!
- .fieldSettings!
- .visibility
- .isVisibleState(),
- );
+ didReceiveCells: (List<CellContext> cellContexts, reason) {
+ final visibleCellContexts = cellContexts
+ .where(
+ (cellContext) => fieldController
+ .getField(cellContext.fieldId)!
+ .fieldSettings!
+ .visibility
+ .isVisibleState(),
+ )
+ .toList();
emit(
state.copyWith(
- cellByFieldId: cellByFieldId,
+ cellContexts: visibleCellContexts,
changeReason: reason,
),
);
@@ -92,7 +92,7 @@ class RowBloc extends Bloc<RowEvent, RowState> {
class RowEvent with _$RowEvent {
const factory RowEvent.createRow() = _CreateRow;
const factory RowEvent.didReceiveCells(
- CellContextByFieldId cellsByFieldId,
+ List<CellContext> cellsByFieldId,
ChangedReason reason,
) = _DidReceiveCells;
}
@@ -100,13 +100,13 @@ class RowEvent with _$RowEvent {
@freezed
class RowState with _$RowState {
const factory RowState({
- required CellContextByFieldId cellByFieldId,
+ required List<CellContext> cellContexts,
ChangedReason? changeReason,
}) = _RowState;
factory RowState.initial() {
- return RowState(
- cellByFieldId: CellContextByFieldId(),
+ return const RowState(
+ cellContexts: [],
changeReason: null,
);
}
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 aa05bec883..48abad2f0a 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
@@ -92,7 +92,7 @@ class RowDetailBloc extends Bloc<RowDetailEvent, RowDetailState> {
return;
}
allCells.clear();
- allCells.addAll(cellMap.values);
+ allCells.addAll(cellMap);
int numHiddenFields = 0;
final visibleCells = <CellContext>[];
@@ -125,7 +125,7 @@ class RowDetailBloc extends Bloc<RowDetailEvent, RowDetailState> {
}
void _init() {
- allCells.addAll(rowController.loadData().values);
+ allCells.addAll(rowController.loadData());
int numHiddenFields = 0;
final visibleCells = <CellContext>[];
for (final cell in allCells) {
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 eba7341ab1..b75f8b8d72 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
@@ -1,6 +1,6 @@
import 'package:appflowy/generated/flowy_svgs.g.dart';
+import 'package:appflowy/plugins/database/application/cell/cell_controller.dart';
import 'package:appflowy/plugins/database/application/database_controller.dart';
-import 'package:appflowy/plugins/database/application/defines.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_controller.dart';
@@ -130,7 +130,7 @@ class RowContent extends StatelessWidget {
child: Row(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
- ..._makeCells(context, state.cellByFieldId),
+ ..._makeCells(context, state.cellContexts),
_finalCellDecoration(context),
],
),
@@ -141,9 +141,9 @@ class RowContent extends StatelessWidget {
List<Widget> _makeCells(
BuildContext context,
- CellContextByFieldId cellByFieldId,
+ List<CellContext> cellContexts,
) {
- return cellByFieldId.values.map(
+ return cellContexts.map(
(cellContext) {
final fieldInfo = fieldController.getField(cellContext.fieldId)!;
final EditableCellWidget child = builder.buildStyled(
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 3d7b7b783b..d13bce5290 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
@@ -1,8 +1,8 @@
+import 'package:appflowy/plugins/database/application/cell/cell_controller.dart';
import 'package:flutter/material.dart';
import 'package:appflowy/generated/flowy_svgs.g.dart';
import "package:appflowy/generated/locale_keys.g.dart";
-import 'package:appflowy/plugins/database/application/defines.dart';
import 'package:appflowy/plugins/database/application/field/field_controller.dart';
import 'package:appflowy/plugins/database/application/row/row_controller.dart';
import 'package:appflowy/plugins/database/application/row/row_service.dart';
@@ -229,7 +229,7 @@ class RowContent extends StatelessWidget {
child: Row(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
- ..._makeCells(context, state.cellByFieldId),
+ ..._makeCells(context, state.cellContexts),
_finalCellDecoration(context),
],
),
@@ -240,9 +240,9 @@ class RowContent extends StatelessWidget {
List<Widget> _makeCells(
BuildContext context,
- CellContextByFieldId cellByFieldId,
+ List<CellContext> cellContexts,
) {
- return cellByFieldId.values.map(
+ return cellContexts.map(
(cellContext) {
final fieldInfo = fieldController.getField(cellContext.fieldId)!;
final EditableCellWidget child = cellBuilder.buildStyled(
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 9d1459f891..9c920d86aa 100644
--- a/frontend/appflowy_flutter/lib/plugins/database/widgets/card/card.dart
+++ b/frontend/appflowy_flutter/lib/plugins/database/widgets/card/card.dart
@@ -10,7 +10,6 @@ import 'package:appflowy_popover/appflowy_popover.dart';
import 'package:collection/collection.dart';
import 'package:flowy_infra_ui/flowy_infra_ui.dart';
import 'package:flowy_infra_ui/style_widget/hover.dart';
-import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
@@ -107,17 +106,6 @@ class _RowCardState extends State<RowCard> {
return BlocProvider.value(
value: _cardBloc,
child: BlocBuilder<CardBloc, CardState>(
- buildWhen: (previous, current) {
- // Rebuild when:
- // 1. If the length of the cells is not the same or isEditing changed
- if (previous.cells.length != current.cells.length ||
- previous.isEditing != current.isEditing) {
- return true;
- }
-
- // 2. the content of the cells changed
- return !listEquals(previous.cells, current.cells);
- },
builder: (context, state) =>
PlatformExtension.isMobile ? _mobile(state) : _desktop(state),
),
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 9a7b7f265d..2ece69fdb8 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,7 +1,6 @@
import 'dart:async';
import 'package:appflowy/plugins/database/application/cell/cell_controller.dart';
-import 'package:appflowy/plugins/database/application/defines.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';
@@ -103,16 +102,16 @@ class CardBloc extends Bloc<CardEvent, CardState> {
List<CellContext> _makeCells(
FieldController fieldController,
String? groupFieldId,
- CellContextByFieldId cellMap,
+ List<CellContext> cellContexts,
) {
// Only show the non-hidden cells and cells that aren't of the grouping field
- cellMap.removeWhere((_, cellContext) {
+ cellContexts.removeWhere((cellContext) {
final fieldInfo = fieldController.getField(cellContext.fieldId);
return fieldInfo == null ||
!fieldInfo.fieldSettings!.visibility.isVisibleState() ||
(groupFieldId != null && cellContext.fieldId == groupFieldId);
});
- return cellMap.values.toList();
+ return cellContexts.toList();
}
@freezed
diff --git a/frontend/appflowy_flutter/lib/plugins/database/widgets/cell/cell.dart b/frontend/appflowy_flutter/lib/plugins/database/widgets/cell/cell.dart
deleted file mode 100644
index e69de29bb2..0000000000
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 ab0844a7e5..3a89208626 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,6 +1,7 @@
import 'dart:async';
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.pb.dart';
import 'package:dartz/dartz.dart';
@@ -8,8 +9,6 @@ import 'package:flutter/widgets.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:freezed_annotation/freezed_annotation.dart';
-import '../../../../application/cell/select_option_cell_service.dart';
-
part 'select_option_editor_bloc.freezed.dart';
class SelectOptionCellEditorBloc
@@ -29,47 +28,47 @@ class SelectOptionCellEditorBloc
super(SelectOptionEditorState.initial(cellController)) {
on<SelectOptionEditorEvent>(
(event, emit) async {
- await event.map(
- initial: (_Initial value) async {
+ await event.when(
+ initial: () async {
_startListening();
await _loadOptions();
},
- didReceiveOptions: (_DidReceiveOptions value) {
- final result = _makeOptions(state.filter, value.options);
+ didReceiveOptions: (options, selectedOptions) {
+ final result = _makeOptions(state.filter, options);
emit(
state.copyWith(
- allOptions: value.options,
+ allOptions: options,
options: result.options,
createOption: result.createOption,
- selectedOptions: value.selectedOptions,
+ selectedOptions: selectedOptions,
),
);
},
- newOption: (_NewOption value) async {
- await _createOption(value.optionName);
+ newOption: (optionName) async {
+ await _createOption(optionName);
emit(
state.copyWith(
filter: none(),
),
);
},
- deleteOption: (_DeleteOption value) async {
- await _deleteOption([value.option]);
+ deleteOption: (option) async {
+ await _deleteOption([option]);
},
- deleteAllOptions: (_DeleteAllOptions value) async {
+ deleteAllOptions: () async {
if (state.allOptions.isNotEmpty) {
await _deleteOption(state.allOptions);
}
},
- updateOption: (_UpdateOption value) async {
- await _updateOption(value.option);
+ updateOption: (option) async {
+ await _updateOption(option);
},
- selectOption: (_SelectOption value) async {
- await _selectOptionService.select(optionIds: [value.optionId]);
+ selectOption: (optionId) async {
+ await _selectOptionService.select(optionIds: [optionId]);
final selectedOption = [
...state.selectedOptions,
state.options.firstWhere(
- (element) => element.id == value.optionId,
+ (element) => element.id == optionId,
),
];
emit(
@@ -78,27 +77,27 @@ class SelectOptionCellEditorBloc
),
);
},
- unSelectOption: (_UnSelectOption value) async {
- await _selectOptionService.unSelect(optionIds: [value.optionId]);
+ unSelectOption: (optionId) async {
+ await _selectOptionService.unSelect(optionIds: [optionId]);
final selectedOptions = [...state.selectedOptions]
- ..removeWhere((e) => e.id == value.optionId);
+ ..removeWhere((e) => e.id == optionId);
emit(
state.copyWith(
selectedOptions: selectedOptions,
),
);
},
- trySelectOption: (_TrySelectOption value) {
- _trySelectOption(value.optionName, emit);
+ trySelectOption: (optionName) {
+ _trySelectOption(optionName, emit);
},
- selectMultipleOptions: (_SelectMultipleOptions value) {
- if (value.optionNames.isNotEmpty) {
- _selectMultipleOptions(value.optionNames);
+ selectMultipleOptions: (optionNames, remainder) {
+ if (optionNames.isNotEmpty) {
+ _selectMultipleOptions(optionNames);
}
- _filterOption(value.remainder, emit);
+ _filterOption(remainder, emit);
},
- filterOption: (_SelectOptionFilter value) {
- _filterOption(value.optionName, emit);
+ filterOption: (optionName) {
+ _filterOption(optionName, emit);
},
);
},
diff --git a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/align_toolbar_item/align_toolbar_item.dart b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/align_toolbar_item/align_toolbar_item.dart
index 52cc4f39ba..a20618f961 100644
--- a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/align_toolbar_item/align_toolbar_item.dart
+++ b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/align_toolbar_item/align_toolbar_item.dart
@@ -9,7 +9,7 @@ import 'package:flutter/material.dart';
const String leftAlignmentKey = 'left';
const String centerAlignmentKey = 'center';
-const String rightAlignmentKey = 'right';
+const String rightAlignmentKey = 'right';
final alignToolbarItem = ToolbarItem(
id: 'editor.align',
diff --git a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/align_toolbar_item/custom_text_align_command.dart b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/align_toolbar_item/custom_text_align_command.dart
index 620dbc335c..621a33b70d 100644
--- a/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/align_toolbar_item/custom_text_align_command.dart
+++ b/frontend/appflowy_flutter/lib/plugins/document/presentation/editor_plugins/align_toolbar_item/custom_text_align_command.dart
@@ -56,7 +56,7 @@ KeyEventResult _textAlignHandler(EditorState editorState, String align) {
if (selection == null) {
return KeyEventResult.ignored;
}
-
+
editorState.updateNode(
selection,
(node) => node.copyWith(