AppFlowy/frontend/app_flowy/lib/plugins/trash/menu.dart

57 lines
2.0 KiB
Dart
Raw Normal View History

import 'package:app_flowy/startup/plugin/plugin.dart';
2021-10-12 08:58:05 +00:00
import 'package:app_flowy/startup/startup.dart';
2022-01-29 02:44:35 +00:00
import 'package:app_flowy/workspace/application/appearance.dart';
2022-03-01 08:05:45 +00:00
import 'package:app_flowy/workspace/presentation/home/home_stack.dart';
import 'package:app_flowy/workspace/presentation/home/menu/menu.dart';
2021-12-07 17:31:23 +00:00
import 'package:easy_localization/easy_localization.dart';
2021-10-12 08:58:05 +00:00
import 'package:flowy_infra/image.dart';
import 'package:flowy_infra_ui/style_widget/text.dart';
import 'package:flowy_infra_ui/widget/spacing.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
2021-12-07 17:31:23 +00:00
import 'package:app_flowy/generated/locale_keys.g.dart';
2022-01-09 11:22:17 +00:00
import 'package:flowy_infra/theme.dart';
2021-10-12 08:58:05 +00:00
class MenuTrash extends StatelessWidget {
const MenuTrash({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return SizedBox(
height: 26,
child: InkWell(
onTap: () {
2022-04-26 06:43:42 +00:00
getIt<MenuSharedState>().latestOpenView = null;
getIt<HomeStackManager>()
.setPlugin(makePlugin(pluginType: DefaultPlugin.trash.type()));
2021-10-12 08:58:05 +00:00
},
child: _render(context),
),
);
}
Widget _render(BuildContext context) {
return Row(children: [
2022-01-29 02:44:35 +00:00
ChangeNotifierProvider.value(
value: Provider.of<AppearanceSettingModel>(context, listen: true),
child: Selector<AppearanceSettingModel, AppTheme>(
selector: (ctx, notifier) => notifier.theme,
builder: (ctx, theme, child) => SizedBox(
width: 16,
height: 16,
child: svgWidget("home/trash", color: theme.iconColor)),
2022-01-29 02:44:35 +00:00
),
),
2021-10-12 08:58:05 +00:00
const HSpace(6),
2022-01-29 02:44:35 +00:00
ChangeNotifierProvider.value(
value: Provider.of<AppearanceSettingModel>(context, listen: true),
child: Selector<AppearanceSettingModel, Locale>(
selector: (ctx, notifier) => notifier.locale,
builder: (ctx, _, child) =>
FlowyText.medium(LocaleKeys.trash_text.tr(), fontSize: 12),
2022-01-29 02:44:35 +00:00
),
),
2021-10-12 08:58:05 +00:00
]);
}
}