trash.dart 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. export "./src/sizes.dart";
  2. export "./src/trash_cell.dart";
  3. export "./src/trash_header.dart";
  4. import 'package:app_flowy/startup/plugin/plugin.dart';
  5. import 'package:app_flowy/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:app_flowy/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 =>
  40. FlowyText.medium(LocaleKeys.trash_text.tr(), fontSize: 12);
  41. @override
  42. Widget? get rightBarItem => null;
  43. @override
  44. Widget buildWidget(PluginContext context) => const TrashPage(
  45. key: ValueKey('TrashPage'),
  46. );
  47. @override
  48. List<NavigationItem> get navigationItems => [this];
  49. }