service.dart 1.2 KB

1234567891011121314151617181920212223242526272829303132
  1. import 'package:flowy_editor/service/render_plugin_service.dart';
  2. import 'package:flowy_editor/service/toolbar_service.dart';
  3. import 'package:flowy_editor/service/selection_service.dart';
  4. import 'package:flutter/material.dart';
  5. class FlowyService {
  6. // selection service
  7. final selectionServiceKey = GlobalKey(debugLabel: 'flowy_selection_service');
  8. FlowySelectionService get selectionService {
  9. assert(selectionServiceKey.currentState != null &&
  10. selectionServiceKey.currentState is FlowySelectionService);
  11. return selectionServiceKey.currentState! as FlowySelectionService;
  12. }
  13. // keyboard service
  14. final keyboardServiceKey = GlobalKey(debugLabel: 'flowy_keyboard_service');
  15. // input service
  16. final inputServiceKey = GlobalKey(debugLabel: 'flowy_input_service');
  17. // render plugin service
  18. late FlowyRenderPlugin renderPluginService;
  19. // floating shortcut service
  20. final toolbarServiceKey =
  21. GlobalKey(debugLabel: 'flowy_floating_shortcut_service');
  22. ToolbarService get toolbarService {
  23. assert(toolbarServiceKey.currentState != null &&
  24. toolbarServiceKey.currentState is ToolbarService);
  25. return toolbarServiceKey.currentState! as ToolbarService;
  26. }
  27. }