Skip to content

Commit 9711d67

Browse files
authored
feat: add hover effect when trash icon is selected or hovered. (#1513)
1 parent 442dfe7 commit 9711d67

File tree

2 files changed

+28
-12
lines changed

2 files changed

+28
-12
lines changed

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

Lines changed: 26 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,11 @@ import 'package:app_flowy/startup/startup.dart';
33
import 'package:app_flowy/workspace/presentation/home/home_stack.dart';
44
import 'package:app_flowy/workspace/presentation/home/menu/menu.dart';
55
import 'package:easy_localization/easy_localization.dart';
6+
import 'package:flowy_infra/color_extension.dart';
67
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';
711
import 'package:flowy_infra_ui/style_widget/text.dart';
812
import 'package:flowy_infra_ui/widget/spacing.dart';
913
import 'package:flutter/material.dart';
@@ -14,16 +18,27 @@ class MenuTrash extends StatelessWidget {
1418

1519
@override
1620
Widget build(BuildContext context) {
17-
return SizedBox(
18-
height: 26,
19-
child: InkWell(
20-
onTap: () {
21-
getIt<MenuSharedState>().latestOpenView = null;
22-
getIt<HomeStackManager>()
23-
.setPlugin(makePlugin(pluginType: PluginType.trash));
24-
},
25-
child: _render(context),
26-
),
21+
return ValueListenableBuilder(
22+
valueListenable: getIt<MenuSharedState>().notifier,
23+
builder: (context, value, child) {
24+
return FlowyHover(
25+
style: HoverStyle(
26+
hoverColor: AFThemeExtension.of(context).greySelect,
27+
),
28+
isSelected: () => getIt<MenuSharedState>().latestOpenView == null,
29+
child: SizedBox(
30+
height: 26,
31+
child: InkWell(
32+
onTap: () {
33+
getIt<MenuSharedState>().latestOpenView = null;
34+
getIt<HomeStackManager>()
35+
.setPlugin(makePlugin(pluginType: PluginType.trash));
36+
},
37+
child: _render(context),
38+
),
39+
).padding(horizontal: Insets.l),
40+
).padding(horizontal: 8);
41+
},
2742
);
2843
}
2944

@@ -43,4 +58,4 @@ class MenuTrash extends StatelessWidget {
4358
],
4459
);
4560
}
46-
}
61+
}

frontend/app_flowy/lib/workspace/presentation/home/menu/menu.dart

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ class HomeMenu extends StatelessWidget {
104104
).padding(horizontal: Insets.l),
105105
),
106106
const VSpace(20),
107-
const MenuTrash().padding(horizontal: Insets.l),
107+
const MenuTrash(),
108108
const VSpace(20),
109109
_renderNewAppButton(context),
110110
],
@@ -178,6 +178,7 @@ class MenuSharedState {
178178
}
179179

180180
ViewPB? get latestOpenView => _latestOpenView.value;
181+
ValueNotifier<ViewPB?> get notifier => _latestOpenView;
181182

182183
set latestOpenView(ViewPB? view) {
183184
if (_latestOpenView.value != view) {

0 commit comments

Comments
 (0)