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.
Dart blogconfluence-alternativecontent-managementcontent-servicesdocumentationflutternote-takingnotion-alternativeproject-managementtask-managementteam-collaborationwiki
chore: refactor the service type
Lucas.Xu1eec97c761e7
diff --git a/frontend/app_flowy/packages/flowy_editor/lib/flowy_editor.dart b/frontend/app_flowy/packages/flowy_editor/lib/flowy_editor.dartindex 9e75790ea3..418b4d7ce0 100644--- a/frontend/app_flowy/packages/flowy_editor/lib/flowy_editor.dart+++ b/frontend/app_flowy/packages/flowy_editor/lib/flowy_editor.dart@@ -14,3 +14,7 @@ export 'src/render/selection/selectable.dart';export 'src/service/editor_service.dart';export 'src/service/render_plugin_service.dart';export 'src/service/service.dart';+export 'src/service/selection_service.dart';+export 'src/service/scroll_service.dart';+export 'src/service/keyboard_service.dart';+export 'src/service/input_service.dart';diff --git a/frontend/app_flowy/packages/flowy_editor/lib/src/service/input_service.dart b/frontend/app_flowy/packages/flowy_editor/lib/src/service/input_service.dartindex c52a411905..da755ab346 100644--- a/frontend/app_flowy/packages/flowy_editor/lib/src/service/input_service.dart+++ b/frontend/app_flowy/packages/flowy_editor/lib/src/service/input_service.dart@@ -7,7 +7,7 @@ import 'package:flowy_editor/src/editor_state.dart';import 'package:flowy_editor/src/extensions/node_extensions.dart';import 'package:flowy_editor/src/operation/transaction_builder.dart';-mixin FlowyInputService {+abstract class FlowyInputService {void attach(TextEditingValue textEditingValue);void apply(List<TextEditingDelta> deltas);void close();@@ -29,8 +29,7 @@ class FlowyInput extends StatefulWidget {}class _FlowyInputState extends State<FlowyInput>- with FlowyInputService- implements DeltaTextInputClient {+ implements FlowyInputService, DeltaTextInputClient {TextInputConnection? _textInputConnection;TextRange? _composingTextRange;diff --git a/frontend/app_flowy/packages/flowy_editor/lib/src/service/keyboard_service.dart b/frontend/app_flowy/packages/flowy_editor/lib/src/service/keyboard_service.dartindex 81ce8348a4..ef8165049b 100644--- a/frontend/app_flowy/packages/flowy_editor/lib/src/service/keyboard_service.dart+++ b/frontend/app_flowy/packages/flowy_editor/lib/src/service/keyboard_service.dart@@ -3,7 +3,7 @@ import 'package:flutter/services.dart';import 'package:flutter/material.dart';-mixin FlowyKeyboardService<T extends StatefulWidget> on State<T> {+abstract class FlowyKeyboardService {void enable();void disable();}@@ -31,7 +31,7 @@ class FlowyKeyboard extends StatefulWidget {}class _FlowyKeyboardState extends State<FlowyKeyboard>- with FlowyKeyboardService {+ implements FlowyKeyboardService {final FocusNode _focusNode = FocusNode(debugLabel: 'flowy_keyboard_service');bool isFocus = true;diff --git a/frontend/app_flowy/packages/flowy_editor/lib/src/service/scroll_service.dart b/frontend/app_flowy/packages/flowy_editor/lib/src/service/scroll_service.dartindex af48a78c49..5201a18942 100644--- a/frontend/app_flowy/packages/flowy_editor/lib/src/service/scroll_service.dart+++ b/frontend/app_flowy/packages/flowy_editor/lib/src/service/scroll_service.dart@@ -1,7 +1,7 @@import 'package:flutter/gestures.dart';import 'package:flutter/material.dart';-mixin FlowyScrollService<T extends StatefulWidget> on State<T> {+abstract class FlowyScrollService {double get dy;void scrollTo(double dy);@@ -22,7 +22,8 @@ class FlowyScroll extends StatefulWidget {State<FlowyScroll> createState() => _FlowyScrollState();}-class _FlowyScrollState extends State<FlowyScroll> with FlowyScrollService {+class _FlowyScrollState extends State<FlowyScroll>+ implements FlowyScrollService {final _scrollController = ScrollController();final _scrollViewKey = GlobalKey();diff --git a/frontend/app_flowy/packages/flowy_editor/lib/src/service/selection_service.dart b/frontend/app_flowy/packages/flowy_editor/lib/src/service/selection_service.dartindex 368bac9c92..56bcb07cd1 100644--- a/frontend/app_flowy/packages/flowy_editor/lib/src/service/selection_service.dart+++ b/frontend/app_flowy/packages/flowy_editor/lib/src/service/selection_service.dart@@ -29,7 +29,7 @@ import 'package:flowy_editor/src/render/selection/selection_widget.dart';/// final nodes = selectionService.currentSelectedNodes;/// ```///-mixin FlowySelectionService<T extends StatefulWidget> on State<T> {+abstract class FlowySelectionService {/// The current [Selection] in editor.////// The value is null if there is no nodes are selected.@@ -90,7 +90,8 @@ class FlowySelection extends StatefulWidget {}class _FlowySelectionState extends State<FlowySelection>- with FlowySelectionService, WidgetsBindingObserver {+ with WidgetsBindingObserver+ implements FlowySelectionService {final _cursorKey = GlobalKey(debugLabel: 'cursor');final List<OverlayEntry> _selectionOverlays = [];diff --git a/frontend/app_flowy/packages/flowy_editor/lib/src/service/toolbar_service.dart b/frontend/app_flowy/packages/flowy_editor/lib/src/service/toolbar_service.dartindex a45fe8b778..aaf52bc20c 100644--- a/frontend/app_flowy/packages/flowy_editor/lib/src/service/toolbar_service.dart+++ b/frontend/app_flowy/packages/flowy_editor/lib/src/service/toolbar_service.dart@@ -3,7 +3,7 @@ import 'package:flutter/material.dart';import 'package:flowy_editor/flowy_editor.dart';import 'package:flowy_editor/src/render/selection/toolbar_widget.dart';-mixin FlowyToolbarService {+abstract class FlowyToolbarService {/// Show the toolbar widget beside the offset.void showInOffset(Offset offset, LayerLink layerLink);@@ -25,7 +25,8 @@ class FlowyToolbar extends StatefulWidget {State<FlowyToolbar> createState() => _FlowyToolbarState();}-class _FlowyToolbarState extends State<FlowyToolbar> with FlowyToolbarService {+class _FlowyToolbarState extends State<FlowyToolbar>+ implements FlowyToolbarService {OverlayEntry? _toolbarOverlay;@override