service.dart 1.3 KB

12345678910111213141516171819202122232425262728293031323334
  1. import 'package:flowy_editor/service/render_plugin_service.dart';
  2. import 'package:flowy_editor/service/shortcut_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 floatingShortcutServiceKey =
  21. GlobalKey(debugLabel: 'flowy_floating_shortcut_service');
  22. FlowyFloatingShortcutService get floatingToolbarService {
  23. assert(floatingShortcutServiceKey.currentState != null &&
  24. floatingShortcutServiceKey.currentState
  25. is FlowyFloatingShortcutService);
  26. return floatingShortcutServiceKey.currentState!
  27. as FlowyFloatingShortcutService;
  28. }
  29. }