chore: rename flowy_x to appflowy_x

This commit is contained in:
Lucas.Xu 2022-08-18 16:13:53 +08:00
parent 51f100ca4b
commit 66275ca232
20 changed files with 66 additions and 65 deletions

View File

@ -15,7 +15,7 @@ import 'package:flutter/material.dart';
///
/// 4. override the getter `nodeValidator`
/// to verify the data structure in [Node].
/// 5. register the plugin with `type` to `flowy_editor` in `main.dart`.
/// 5. register the plugin with `type` to `AppFlowyEditor` in `main.dart`.
/// 6. Congratulations!
class ImageNodeBuilder extends NodeWidgetBuilder<Node> {

View File

@ -2,7 +2,7 @@ import 'package:appflowy_editor/appflowy_editor.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
FlowyKeyEventHandler underscoreToItalicHandler = (editorState, event) {
AppFlowyKeyEventHandler underscoreToItalicHandler = (editorState, event) {
// Since we only need to handler the input of `underscore`.
// All inputs except `underscore` will be ignored directly.
if (event.logicalKey != LogicalKeyboardKey.underscore) {

View File

@ -40,7 +40,7 @@ class AppFlowyEditor extends StatefulWidget {
final NodeWidgetBuilders customBuilders;
/// Keyboard event handlers.
final List<FlowyKeyEventHandler> keyEventHandlers;
final List<AppFlowyKeyEventHandler> keyEventHandlers;
@override
State<AppFlowyEditor> createState() => _AppFlowyEditorState();
@ -67,15 +67,15 @@ class _AppFlowyEditorState extends State<AppFlowyEditor> {
@override
Widget build(BuildContext context) {
return FlowyScroll(
return AppFlowyScroll(
key: editorState.service.scrollServiceKey,
child: FlowySelection(
child: AppFlowySelection(
key: editorState.service.selectionServiceKey,
editorState: editorState,
child: FlowyInput(
child: AppFlowyInput(
key: editorState.service.inputServiceKey,
editorState: editorState,
child: FlowyKeyboard(
child: AppFlowyKeyboard(
key: editorState.service.keyboardServiceKey,
handlers: [
...defaultKeyEventHandlers,
@ -99,7 +99,7 @@ class _AppFlowyEditorState extends State<AppFlowyEditor> {
));
}
FlowyRenderPlugin _createRenderPlugin() => FlowyRenderPlugin(
AppFlowyRenderPlugin _createRenderPlugin() => AppFlowyRenderPlugin(
editorState: editorState,
builders: {
...defaultBuilders,

View File

@ -7,7 +7,7 @@ import 'package:appflowy_editor/src/editor_state.dart';
import 'package:appflowy_editor/src/extensions/node_extensions.dart';
import 'package:appflowy_editor/src/operation/transaction_builder.dart';
/// [FlowyInputService] is responsible for processing text input,
/// [AppFlowyInputService] is responsible for processing text input,
/// including text insertion, deletion and replacement.
///
/// Usually, this service can be obtained by the following code.
@ -21,7 +21,7 @@ import 'package:appflowy_editor/src/operation/transaction_builder.dart';
/// inputService?.apply(...);
/// ```
///
abstract class FlowyInputService {
abstract class AppFlowyInputService {
/// Updates the [TextEditingValue] of the text currently being edited.
///
/// Note that if there are IME-related requirements,
@ -39,8 +39,8 @@ abstract class FlowyInputService {
}
/// Processes text input
class FlowyInput extends StatefulWidget {
const FlowyInput({
class AppFlowyInput extends StatefulWidget {
const AppFlowyInput({
Key? key,
required this.editorState,
required this.child,
@ -50,11 +50,11 @@ class FlowyInput extends StatefulWidget {
final Widget child;
@override
State<FlowyInput> createState() => _FlowyInputState();
State<AppFlowyInput> createState() => _AppFlowyInputState();
}
class _FlowyInputState extends State<FlowyInput>
implements FlowyInputService, DeltaTextInputClient {
class _AppFlowyInputState extends State<AppFlowyInput>
implements AppFlowyInputService, DeltaTextInputClient {
TextInputConnection? _textInputConnection;
TextRange? _composingTextRange;

View File

@ -103,7 +103,7 @@ KeyEventResult _handleShiftKey(EditorState editorState, RawKeyEvent event) {
return KeyEventResult.ignored;
}
FlowyKeyEventHandler arrowKeysHandler = (editorState, event) {
AppFlowyKeyEventHandler arrowKeysHandler = (editorState, event) {
if (event.isShiftPressed) {
return _handleShiftKey(editorState, event);
}

View File

@ -304,7 +304,7 @@ _deleteSelectedContent(EditorState editorState) {
tb.commit();
}
FlowyKeyEventHandler copyPasteKeysHandler = (editorState, event) {
AppFlowyKeyEventHandler copyPasteKeysHandler = (editorState, event) {
if (event.isMetaPressed && event.logicalKey == LogicalKeyboardKey.keyC) {
_handleCopy(editorState);
return KeyEventResult.handled;

View File

@ -10,7 +10,7 @@ import 'package:appflowy_editor/src/service/internal_key_event_handlers/select_a
import 'package:appflowy_editor/src/service/internal_key_event_handlers/page_up_down_handler.dart';
import 'package:appflowy_editor/src/service/keyboard_service.dart';
List<FlowyKeyEventHandler> defaultKeyEventHandlers = [
List<AppFlowyKeyEventHandler> defaultKeyEventHandlers = [
deleteTextHandler,
slashShortcutHandler,
arrowKeysHandler,

View File

@ -150,7 +150,7 @@ void _deleteNodes(TransactionBuilder transactionBuilder,
}
// Handle delete text.
FlowyKeyEventHandler deleteTextHandler = (editorState, event) {
AppFlowyKeyEventHandler deleteTextHandler = (editorState, event) {
if (event.logicalKey == LogicalKeyboardKey.backspace) {
return _handleBackspace(editorState, event);
}

View File

@ -18,7 +18,7 @@ import 'package:appflowy_editor/src/service/keyboard_service.dart';
/// 2. Single selection and the selected node is [TextNode]
/// 2.1 split the node into two nodes with style
/// 2.2 or insert a empty text node before.
FlowyKeyEventHandler enterWithoutShiftInTextNodesHandler =
AppFlowyKeyEventHandler enterWithoutShiftInTextNodesHandler =
(editorState, event) {
if (event.logicalKey != LogicalKeyboardKey.enter || event.isShiftPressed) {
return KeyEventResult.ignored;

View File

@ -2,7 +2,7 @@ import 'package:appflowy_editor/appflowy_editor.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
FlowyKeyEventHandler pageUpDownHandler = (editorState, event) {
AppFlowyKeyEventHandler pageUpDownHandler = (editorState, event) {
if (event.logicalKey == LogicalKeyboardKey.pageUp) {
final scrollHeight = editorState.service.scrollService?.onePageHeight;
final scrollService = editorState.service.scrollService;

View File

@ -2,7 +2,7 @@ import 'package:appflowy_editor/src/service/keyboard_service.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
FlowyKeyEventHandler redoUndoKeysHandler = (editorState, event) {
AppFlowyKeyEventHandler redoUndoKeysHandler = (editorState, event) {
if (event.isMetaPressed && event.logicalKey == LogicalKeyboardKey.keyZ) {
if (event.isShiftPressed) {
editorState.undoManager.redo();

View File

@ -18,7 +18,7 @@ KeyEventResult _selectAll(EditorState editorState) {
return KeyEventResult.handled;
}
FlowyKeyEventHandler selectAllHandler = (editorState, event) {
AppFlowyKeyEventHandler selectAllHandler = (editorState, event) {
if (event.isMetaPressed && event.logicalKey == LogicalKeyboardKey.keyA) {
return _selectAll(editorState);
}

View File

@ -67,7 +67,7 @@ final List<PopupListItem> _popupListItems = [
OverlayEntry? _popupListOverlay;
EditorState? _editorState;
bool _selectionChangeBySlash = false;
FlowyKeyEventHandler slashShortcutHandler = (editorState, event) {
AppFlowyKeyEventHandler slashShortcutHandler = (editorState, event) {
if (event.logicalKey != LogicalKeyboardKey.slash) {
return KeyEventResult.ignored;
}

View File

@ -5,7 +5,8 @@ import 'package:appflowy_editor/src/service/default_text_operations/format_rich_
import 'package:appflowy_editor/src/service/keyboard_service.dart';
import 'package:flutter/services.dart';
FlowyKeyEventHandler updateTextStyleByCommandXHandler = (editorState, event) {
AppFlowyKeyEventHandler updateTextStyleByCommandXHandler =
(editorState, event) {
if (!event.isMetaPressed) {
return KeyEventResult.ignored;
}

View File

@ -20,7 +20,7 @@ const _bulletedListSymbols = ['*', '-'];
const _checkboxListSymbols = ['[x]', '-[x]'];
const _unCheckboxListSymbols = ['[]', '-[]'];
FlowyKeyEventHandler whiteSpaceHandler = (editorState, event) {
AppFlowyKeyEventHandler whiteSpaceHandler = (editorState, event) {
if (event.logicalKey != LogicalKeyboardKey.space) {
return KeyEventResult.ignored;
}

View File

@ -3,7 +3,7 @@ import 'package:flutter/services.dart';
import 'package:flutter/material.dart';
/// [FlowyKeyboardService] is responsible for processing shortcut keys,
/// [AppFlowyKeyboardService] is responsible for processing shortcut keys,
/// like command, shift, control keys.
///
/// Usually, this service can be obtained by the following code.
@ -18,7 +18,7 @@ import 'package:flutter/material.dart';
/// keyboardService?.disable();
/// ```
///
abstract class FlowyKeyboardService {
abstract class AppFlowyKeyboardService {
/// Processes shortcut key input.
KeyEventResult onKey(RawKeyEvent event);
@ -35,14 +35,14 @@ abstract class FlowyKeyboardService {
void disable();
}
typedef FlowyKeyEventHandler = KeyEventResult Function(
typedef AppFlowyKeyEventHandler = KeyEventResult Function(
EditorState editorState,
RawKeyEvent event,
);
/// Process keyboard events
class FlowyKeyboard extends StatefulWidget {
const FlowyKeyboard({
class AppFlowyKeyboard extends StatefulWidget {
const AppFlowyKeyboard({
Key? key,
required this.handlers,
required this.editorState,
@ -51,14 +51,14 @@ class FlowyKeyboard extends StatefulWidget {
final EditorState editorState;
final Widget child;
final List<FlowyKeyEventHandler> handlers;
final List<AppFlowyKeyEventHandler> handlers;
@override
State<FlowyKeyboard> createState() => _FlowyKeyboardState();
State<AppFlowyKeyboard> createState() => _AppFlowyKeyboardState();
}
class _FlowyKeyboardState extends State<FlowyKeyboard>
implements FlowyKeyboardService {
class _AppFlowyKeyboardState extends State<AppFlowyKeyboard>
implements AppFlowyKeyboardService {
final FocusNode _focusNode = FocusNode(debugLabel: 'flowy_keyboard_service');
bool isFocus = true;

View File

@ -13,7 +13,7 @@ abstract class NodeWidgetBuilder<T extends Node> {
typedef NodeWidgetBuilders = Map<String, NodeWidgetBuilder>;
abstract class FlowyRenderPluginService {
abstract class AppFlowyRenderPluginService {
/// Register render plugin with specified [name].
///
/// [name] should be [Node].type
@ -55,8 +55,8 @@ class NodeWidgetContext<T extends Node> {
}
}
class FlowyRenderPlugin extends FlowyRenderPluginService {
FlowyRenderPlugin({
class AppFlowyRenderPlugin extends AppFlowyRenderPluginService {
AppFlowyRenderPlugin({
required this.editorState,
required NodeWidgetBuilders builders,
}) {

View File

@ -2,14 +2,14 @@ import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart';
import 'package:appflowy_editor/src/extensions/object_extensions.dart';
/// [FlowyScrollService] is responsible for processing document scrolling.
/// [AppFlowyScrollService] is responsible for processing document scrolling.
///
/// Usually, this service can be obtained by the following code.
/// ```dart
/// final keyboardService = editorState.service.scrollService;
/// ```
///
abstract class FlowyScrollService {
abstract class AppFlowyScrollService {
/// Returns the offset of the current document on the vertical axis.
double get dy;
@ -44,8 +44,8 @@ abstract class FlowyScrollService {
void disable();
}
class FlowyScroll extends StatefulWidget {
const FlowyScroll({
class AppFlowyScroll extends StatefulWidget {
const AppFlowyScroll({
Key? key,
required this.child,
}) : super(key: key);
@ -53,11 +53,11 @@ class FlowyScroll extends StatefulWidget {
final Widget child;
@override
State<FlowyScroll> createState() => _FlowyScrollState();
State<AppFlowyScroll> createState() => _AppFlowyScrollState();
}
class _FlowyScrollState extends State<FlowyScroll>
implements FlowyScrollService {
class _AppFlowyScrollState extends State<AppFlowyScroll>
implements AppFlowyScrollService {
final _scrollController = ScrollController();
final _scrollViewKey = GlobalKey();

View File

@ -13,7 +13,7 @@ import 'package:appflowy_editor/src/render/selection/selectable.dart';
import 'package:appflowy_editor/src/render/selection/selection_widget.dart';
import 'package:appflowy_editor/src/service/selection/selection_gesture.dart';
/// [FlowySelectionService] is responsible for processing
/// [AppFlowySelectionService] is responsible for processing
/// the [Selection] changes and updates.
///
/// Usually, this service can be obtained by the following code.
@ -27,7 +27,7 @@ import 'package:appflowy_editor/src/service/selection/selection_gesture.dart';
/// final nodes = selectionService.currentSelectedNodes;
/// ```
///
abstract class FlowySelectionService {
abstract class AppFlowySelectionService {
/// The current [Selection] in editor.
///
/// The value is null if there is no nodes are selected.
@ -75,8 +75,8 @@ abstract class FlowySelectionService {
List<Rect> get selectionRects;
}
class FlowySelection extends StatefulWidget {
const FlowySelection({
class AppFlowySelection extends StatefulWidget {
const AppFlowySelection({
Key? key,
this.cursorColor = Colors.black,
this.selectionColor = const Color.fromARGB(53, 111, 201, 231),
@ -90,12 +90,12 @@ class FlowySelection extends StatefulWidget {
final Color selectionColor;
@override
State<FlowySelection> createState() => _FlowySelectionState();
State<AppFlowySelection> createState() => _AppFlowySelectionState();
}
class _FlowySelectionState extends State<FlowySelection>
class _AppFlowySelectionState extends State<AppFlowySelection>
with WidgetsBindingObserver
implements FlowySelectionService {
implements AppFlowySelectionService {
final _cursorKey = GlobalKey(debugLabel: 'cursor');
@override

View File

@ -5,34 +5,34 @@ import 'package:flutter/material.dart';
class FlowyService {
// selection service
final selectionServiceKey = GlobalKey(debugLabel: 'flowy_selection_service');
FlowySelectionService get selectionService {
AppFlowySelectionService get selectionService {
assert(selectionServiceKey.currentState != null &&
selectionServiceKey.currentState is FlowySelectionService);
return selectionServiceKey.currentState! as FlowySelectionService;
selectionServiceKey.currentState is AppFlowySelectionService);
return selectionServiceKey.currentState! as AppFlowySelectionService;
}
// keyboard service
final keyboardServiceKey = GlobalKey(debugLabel: 'flowy_keyboard_service');
FlowyKeyboardService? get keyboardService {
AppFlowyKeyboardService? get keyboardService {
if (keyboardServiceKey.currentState != null &&
keyboardServiceKey.currentState is FlowyKeyboardService) {
return keyboardServiceKey.currentState! as FlowyKeyboardService;
keyboardServiceKey.currentState is AppFlowyKeyboardService) {
return keyboardServiceKey.currentState! as AppFlowyKeyboardService;
}
return null;
}
// input service
final inputServiceKey = GlobalKey(debugLabel: 'flowy_input_service');
FlowyInputService? get inputService {
AppFlowyInputService? get inputService {
if (inputServiceKey.currentState != null &&
inputServiceKey.currentState is FlowyInputService) {
return inputServiceKey.currentState! as FlowyInputService;
inputServiceKey.currentState is AppFlowyInputService) {
return inputServiceKey.currentState! as AppFlowyInputService;
}
return null;
}
// render plugin service
late FlowyRenderPlugin renderPluginService;
late AppFlowyRenderPlugin renderPluginService;
// toolbar service
final toolbarServiceKey = GlobalKey(debugLabel: 'flowy_toolbar_service');
@ -46,10 +46,10 @@ class FlowyService {
// scroll service
final scrollServiceKey = GlobalKey(debugLabel: 'flowy_scroll_service');
FlowyScrollService? get scrollService {
AppFlowyScrollService? get scrollService {
if (scrollServiceKey.currentState != null &&
scrollServiceKey.currentState is FlowyScrollService) {
return scrollServiceKey.currentState! as FlowyScrollService;
scrollServiceKey.currentState is AppFlowyScrollService) {
return scrollServiceKey.currentState! as AppFlowyScrollService;
}
return null;
}