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,20 +141,23 @@ class _SidebarSpaceHeaderState extends State<SidebarSpaceHeader> {
|
|||||||
onAction: _onAction,
|
onAction: _onAction,
|
||||||
),
|
),
|
||||||
const HSpace(8.0),
|
const HSpace(8.0),
|
||||||
ViewAddButton(
|
FlowyTooltip(
|
||||||
parentViewId: widget.space.id,
|
message: LocaleKeys.sideBar_addAPage.tr(),
|
||||||
onEditing: (_) {},
|
child: ViewAddButton(
|
||||||
onSelected: (
|
parentViewId: widget.space.id,
|
||||||
pluginBuilder,
|
onEditing: (_) {},
|
||||||
name,
|
onSelected: (
|
||||||
initialDataBytes,
|
pluginBuilder,
|
||||||
openAfterCreated,
|
name,
|
||||||
createNewView,
|
initialDataBytes,
|
||||||
) {
|
openAfterCreated,
|
||||||
if (createNewView) {
|
createNewView,
|
||||||
widget.onAdded(pluginBuilder.layoutType!);
|
) {
|
||||||
}
|
if (createNewView) {
|
||||||
},
|
widget.onAdded(pluginBuilder.layoutType!);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
@ -29,6 +29,15 @@ class SidebarWorkspace extends StatefulWidget {
|
|||||||
class _SidebarWorkspaceState extends State<SidebarWorkspace> {
|
class _SidebarWorkspaceState extends State<SidebarWorkspace> {
|
||||||
Loading? loadingIndicator;
|
Loading? loadingIndicator;
|
||||||
|
|
||||||
|
final ValueNotifier<bool> onHover = ValueNotifier(false);
|
||||||
|
|
||||||
|
@override
|
||||||
|
void dispose() {
|
||||||
|
onHover.dispose();
|
||||||
|
|
||||||
|
super.dispose();
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return BlocConsumer<UserWorkspaceBloc, UserWorkspaceState>(
|
return BlocConsumer<UserWorkspaceBloc, UserWorkspaceState>(
|
||||||
@ -40,19 +49,38 @@ class _SidebarWorkspaceState extends State<SidebarWorkspace> {
|
|||||||
if (currentWorkspace == null) {
|
if (currentWorkspace == null) {
|
||||||
return const SizedBox.shrink();
|
return const SizedBox.shrink();
|
||||||
}
|
}
|
||||||
return Row(
|
return MouseRegion(
|
||||||
children: [
|
onEnter: (_) => onHover.value = true,
|
||||||
Expanded(
|
onExit: (_) => onHover.value = false,
|
||||||
child: SidebarSwitchWorkspaceButton(
|
child: ValueListenableBuilder(
|
||||||
userProfile: widget.userProfile,
|
valueListenable: onHover,
|
||||||
currentWorkspace: currentWorkspace,
|
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(
|
||||||
|
userProfile: widget.userProfile,
|
||||||
|
currentWorkspace: currentWorkspace,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
UserSettingButton(userProfile: widget.userProfile),
|
||||||
|
const HSpace(8.0),
|
||||||
|
const NotificationButton(),
|
||||||
|
const HSpace(4.0),
|
||||||
|
],
|
||||||
),
|
),
|
||||||
UserSettingButton(userProfile: widget.userProfile),
|
),
|
||||||
const HSpace(8.0),
|
|
||||||
const NotificationButton(),
|
|
||||||
const HSpace(12.0),
|
|
||||||
],
|
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
@ -201,6 +229,7 @@ class _SidebarSwitchWorkspaceButtonState
|
|||||||
},
|
},
|
||||||
child: FlowyIconTextButton(
|
child: FlowyIconTextButton(
|
||||||
margin: EdgeInsets.zero,
|
margin: EdgeInsets.zero,
|
||||||
|
hoverColor: Colors.transparent,
|
||||||
textBuilder: (onHover) => SizedBox(
|
textBuilder: (onHover) => SizedBox(
|
||||||
height: 30,
|
height: 30,
|
||||||
child: Row(
|
child: Row(
|
||||||
|
@ -268,8 +268,11 @@ class FlowyButton extends StatelessWidget {
|
|||||||
return Container(
|
return Container(
|
||||||
decoration: decoration,
|
decoration: decoration,
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding:
|
padding: margin ??
|
||||||
margin ?? const EdgeInsets.symmetric(horizontal: 6, vertical: 4),
|
const EdgeInsets.symmetric(
|
||||||
|
horizontal: 6,
|
||||||
|
vertical: 4,
|
||||||
|
),
|
||||||
child: child,
|
child: child,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
Loading…
Reference in New Issue
Block a user