mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2024-08-30 18:12:39 +00:00
chore: optimize the workspace menu hover status (#5865)
This commit is contained in:
parent
e9fc003e10
commit
46bad4e7e8
@ -141,7 +141,9 @@ class _SidebarSpaceHeaderState extends State<SidebarSpaceHeader> {
|
||||
onAction: _onAction,
|
||||
),
|
||||
const HSpace(8.0),
|
||||
ViewAddButton(
|
||||
FlowyTooltip(
|
||||
message: LocaleKeys.sideBar_addAPage.tr(),
|
||||
child: ViewAddButton(
|
||||
parentViewId: widget.space.id,
|
||||
onEditing: (_) {},
|
||||
onSelected: (
|
||||
@ -156,6 +158,7 @@ class _SidebarSpaceHeaderState extends State<SidebarSpaceHeader> {
|
||||
}
|
||||
},
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
@ -29,6 +29,15 @@ class SidebarWorkspace extends StatefulWidget {
|
||||
class _SidebarWorkspaceState extends State<SidebarWorkspace> {
|
||||
Loading? loadingIndicator;
|
||||
|
||||
final ValueNotifier<bool> onHover = ValueNotifier(false);
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
onHover.dispose();
|
||||
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return BlocConsumer<UserWorkspaceBloc, UserWorkspaceState>(
|
||||
@ -40,7 +49,24 @@ class _SidebarWorkspaceState extends State<SidebarWorkspace> {
|
||||
if (currentWorkspace == null) {
|
||||
return const SizedBox.shrink();
|
||||
}
|
||||
return Row(
|
||||
return MouseRegion(
|
||||
onEnter: (_) => onHover.value = true,
|
||||
onExit: (_) => onHover.value = false,
|
||||
child: ValueListenableBuilder(
|
||||
valueListenable: onHover,
|
||||
builder: (_, onHover, child) {
|
||||
return Container(
|
||||
margin: const EdgeInsets.only(right: 8.0),
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(8.0),
|
||||
color: onHover
|
||||
? Theme.of(context).colorScheme.secondary
|
||||
: Colors.transparent,
|
||||
),
|
||||
child: child,
|
||||
);
|
||||
},
|
||||
child: Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: SidebarSwitchWorkspaceButton(
|
||||
@ -51,8 +77,10 @@ class _SidebarWorkspaceState extends State<SidebarWorkspace> {
|
||||
UserSettingButton(userProfile: widget.userProfile),
|
||||
const HSpace(8.0),
|
||||
const NotificationButton(),
|
||||
const HSpace(12.0),
|
||||
const HSpace(4.0),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
@ -201,6 +229,7 @@ class _SidebarSwitchWorkspaceButtonState
|
||||
},
|
||||
child: FlowyIconTextButton(
|
||||
margin: EdgeInsets.zero,
|
||||
hoverColor: Colors.transparent,
|
||||
textBuilder: (onHover) => SizedBox(
|
||||
height: 30,
|
||||
child: Row(
|
||||
|
@ -268,8 +268,11 @@ class FlowyButton extends StatelessWidget {
|
||||
return Container(
|
||||
decoration: decoration,
|
||||
child: Padding(
|
||||
padding:
|
||||
margin ?? const EdgeInsets.symmetric(horizontal: 6, vertical: 4),
|
||||
padding: margin ??
|
||||
const EdgeInsets.symmetric(
|
||||
horizontal: 6,
|
||||
vertical: 4,
|
||||
),
|
||||
child: child,
|
||||
),
|
||||
);
|
||||
|
Loading…
Reference in New Issue
Block a user