service.dart 1.1 KB

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