menu.dart 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. import 'package:appflowy/startup/plugin/plugin.dart';
  2. import 'package:appflowy/startup/startup.dart';
  3. import 'package:appflowy/workspace/presentation/home/home_stack.dart';
  4. import 'package:appflowy/workspace/presentation/home/menu/menu.dart';
  5. import 'package:easy_localization/easy_localization.dart';
  6. import 'package:flowy_infra/theme_extension.dart';
  7. import 'package:flowy_infra/image.dart';
  8. import 'package:flowy_infra/size.dart';
  9. import 'package:flowy_infra_ui/style_widget/extension.dart';
  10. import 'package:flowy_infra_ui/style_widget/hover.dart';
  11. import 'package:flowy_infra_ui/style_widget/text.dart';
  12. import 'package:flowy_infra_ui/widget/spacing.dart';
  13. import 'package:flutter/material.dart';
  14. import 'package:appflowy/generated/locale_keys.g.dart';
  15. class MenuTrash extends StatelessWidget {
  16. const MenuTrash({Key? key}) : super(key: key);
  17. @override
  18. Widget build(BuildContext context) {
  19. return ValueListenableBuilder(
  20. valueListenable: getIt<MenuSharedState>().notifier,
  21. builder: (context, value, child) {
  22. return FlowyHover(
  23. style: HoverStyle(
  24. hoverColor: AFThemeExtension.of(context).greySelect,
  25. ),
  26. isSelected: () => getIt<MenuSharedState>().latestOpenView == null,
  27. child: SizedBox(
  28. height: 26,
  29. child: InkWell(
  30. onTap: () {
  31. getIt<MenuSharedState>().latestOpenView = null;
  32. getIt<HomeStackManager>()
  33. .setPlugin(makePlugin(pluginType: PluginType.trash));
  34. },
  35. child: _render(context),
  36. ),
  37. ).padding(horizontal: Insets.l),
  38. ).padding(horizontal: 8);
  39. },
  40. );
  41. }
  42. Widget _render(BuildContext context) {
  43. return Row(
  44. children: [
  45. const FlowySvg(
  46. size: Size(16, 16),
  47. name: 'home/trash',
  48. ),
  49. const HSpace(6),
  50. FlowyText.medium(LocaleKeys.trash_text.tr()),
  51. ],
  52. );
  53. }
  54. }