menu.dart 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. import 'package:app_flowy/startup/plugin/plugin.dart';
  2. import 'package:app_flowy/startup/startup.dart';
  3. import 'package:app_flowy/workspace/application/appearance.dart';
  4. import 'package:app_flowy/workspace/presentation/home/home_stack.dart';
  5. import 'package:app_flowy/workspace/presentation/home/menu/menu.dart';
  6. import 'package:easy_localization/easy_localization.dart';
  7. import 'package:flowy_infra/image.dart';
  8. import 'package:flowy_infra_ui/style_widget/text.dart';
  9. import 'package:flowy_infra_ui/widget/spacing.dart';
  10. import 'package:flutter/material.dart';
  11. import 'package:provider/provider.dart';
  12. import 'package:app_flowy/generated/locale_keys.g.dart';
  13. import 'package:flowy_infra/theme.dart';
  14. class MenuTrash extends StatelessWidget {
  15. const MenuTrash({Key? key}) : super(key: key);
  16. @override
  17. Widget build(BuildContext context) {
  18. return SizedBox(
  19. height: 26,
  20. child: InkWell(
  21. onTap: () {
  22. getIt<MenuSharedState>().latestOpenView = null;
  23. getIt<HomeStackManager>()
  24. .setPlugin(makePlugin(pluginType: PluginType.trash));
  25. },
  26. child: _render(context),
  27. ),
  28. );
  29. }
  30. Widget _render(BuildContext context) {
  31. return Row(children: [
  32. ChangeNotifierProvider.value(
  33. value: Provider.of<AppearanceSettingModel>(context, listen: true),
  34. child: Selector<AppearanceSettingModel, AppTheme>(
  35. selector: (ctx, notifier) => notifier.theme,
  36. builder: (ctx, theme, child) => SizedBox(
  37. width: 16,
  38. height: 16,
  39. child: svgWidget("home/trash", color: theme.iconColor)),
  40. ),
  41. ),
  42. const HSpace(6),
  43. ChangeNotifierProvider.value(
  44. value: Provider.of<AppearanceSettingModel>(context, listen: true),
  45. child: Selector<AppearanceSettingModel, Locale>(
  46. selector: (ctx, notifier) => notifier.locale,
  47. builder: (ctx, _, child) =>
  48. FlowyText.medium(LocaleKeys.trash_text.tr(), fontSize: 12),
  49. ),
  50. ),
  51. ]);
  52. }
  53. }