trash.dart 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. export "./src/sizes.dart";
  2. export "./src/trash_cell.dart";
  3. export "./src/trash_header.dart";
  4. import 'package:appflowy/startup/plugin/plugin.dart';
  5. import 'package:appflowy/workspace/presentation/home/home_stack.dart';
  6. import 'package:easy_localization/easy_localization.dart';
  7. import 'package:flowy_infra_ui/style_widget/text.dart';
  8. import 'package:flutter/material.dart';
  9. import 'package:appflowy/generated/locale_keys.g.dart';
  10. import 'trash_page.dart';
  11. class TrashPluginBuilder extends PluginBuilder {
  12. @override
  13. Plugin build(dynamic data) {
  14. return TrashPlugin(pluginType: pluginType);
  15. }
  16. @override
  17. String get menuName => "TrashPB";
  18. @override
  19. String get menuIcon => "editor/delete";
  20. @override
  21. PluginType get pluginType => PluginType.trash;
  22. }
  23. class TrashPluginConfig implements PluginConfig {
  24. @override
  25. bool get creatable => false;
  26. }
  27. class TrashPlugin extends Plugin {
  28. final PluginType _pluginType;
  29. TrashPlugin({required PluginType pluginType}) : _pluginType = pluginType;
  30. @override
  31. PluginDisplay get display => TrashPluginDisplay();
  32. @override
  33. PluginId get id => "TrashStack";
  34. @override
  35. PluginType get ty => _pluginType;
  36. }
  37. class TrashPluginDisplay extends PluginDisplay {
  38. @override
  39. Widget get leftBarItem => FlowyText.medium(LocaleKeys.trash_text.tr());
  40. @override
  41. Widget? get rightBarItem => null;
  42. @override
  43. Widget buildWidget(PluginContext context) => const TrashPage(
  44. key: ValueKey('TrashPage'),
  45. );
  46. @override
  47. List<NavigationItem> get navigationItems => [this];
  48. }