inline_actions_service.dart 790 B

1234567891011121314151617181920212223242526272829303132
  1. import 'package:appflowy/plugins/inline_actions/inline_actions_result.dart';
  2. import 'package:flutter/material.dart';
  3. typedef InlineActionsDelegate = Future<InlineActionsResult> Function([
  4. String? search,
  5. ]);
  6. abstract class _InlineActionsProvider {
  7. void dispose();
  8. }
  9. class InlineActionsService extends _InlineActionsProvider {
  10. InlineActionsService({
  11. required this.context,
  12. required this.handlers,
  13. });
  14. /// The [BuildContext] in which to show the [InlineActionsMenu]
  15. ///
  16. BuildContext? context;
  17. final List<InlineActionsDelegate> handlers;
  18. /// This is a workaround for not having a mounted check.
  19. /// Thus when the widget that uses the service is disposed,
  20. /// we set the [BuildContext] to null.
  21. ///
  22. @override
  23. void dispose() {
  24. context = null;
  25. }
  26. }