Skip to content

Bring projects, wikis, and teams together with AI. AppFlowy is the AI collaborative workspace where you achieve more without losing control of your data. The leading open source Notion alternative.

fix: unable to expand sidebar on Windows (#7847)

Lucasfb33e4d5c317
diff --git a/frontend/appflowy_flutter/lib/workspace/presentation/home/home_stack.dart b/frontend/appflowy_flutter/lib/workspace/presentation/home/home_stack.dart
index e7b68a96d8..c5d51b9050 100644
--- a/frontend/appflowy_flutter/lib/workspace/presentation/home/home_stack.dart
+++ b/frontend/appflowy_flutter/lib/workspace/presentation/home/home_stack.dart
@@ -153,9 +153,14 @@ class _HomeStackState extends State<HomeStack> with WindowListener {
richMessage: textSpan,
child: Listener(
behavior: HitTestBehavior.translucent,
- onPointerDown: (_) => context
- .read<HomeSettingBloc>()
- .add(const HomeSettingEvent.changeMenuStatus(MenuStatus.hidden)),
+ onPointerDown: (_) {
+ final isMenuExpanded =
+ context.read<HomeSettingBloc>().isMenuExpanded;
+ final status = isMenuExpanded ? MenuStatus.hidden : MenuStatus.expanded;
+ context
+ .read<HomeSettingBloc>()
+ .add(HomeSettingEvent.changeMenuStatus(status));
+ },
child: FlowyHover(
child: Container(
width: 24,
diff --git a/frontend/appflowy_flutter/lib/workspace/presentation/home/menu/sidebar/workspace/sidebar_workspace.dart b/frontend/appflowy_flutter/lib/workspace/presentation/home/menu/sidebar/workspace/sidebar_workspace.dart
index 58dd5ffd23..eded83c6db 100644
--- a/frontend/appflowy_flutter/lib/workspace/presentation/home/menu/sidebar/workspace/sidebar_workspace.dart
+++ b/frontend/appflowy_flutter/lib/workspace/presentation/home/menu/sidebar/workspace/sidebar_workspace.dart
@@ -296,47 +296,44 @@ class _SidebarSwitchWorkspaceButtonState
@override
Widget build(BuildContext context) {
- return BlocProvider(
- create: (context) => context.read<UserWorkspaceBloc>(),
- child: AppFlowyPopover(
- direction: PopoverDirection.bottomWithCenterAligned,
- offset: const Offset(0, 5),
- constraints: const BoxConstraints(maxWidth: 300, maxHeight: 600),
- margin: EdgeInsets.zero,
- animationDuration: Durations.short3,
- beginScaleFactor: 1.0,
- beginOpacity: 0.8,
- controller: _popoverController,
- triggerActions: PopoverTriggerFlags.none,
- onOpen: () {
- context
- .read<UserWorkspaceBloc>()
- .add(const UserWorkspaceEvent.fetchWorkspaces());
- },
- popupBuilder: (_) {
- return BlocProvider<UserWorkspaceBloc>.value(
- value: context.read<UserWorkspaceBloc>(),
- child: BlocBuilder<UserWorkspaceBloc, UserWorkspaceState>(
- builder: (context, state) {
- final currentWorkspace = state.currentWorkspace;
- final workspaces = state.workspaces;
- if (currentWorkspace == null) {
- return const SizedBox.shrink();
- }
- return WorkspacesMenu(
- userProfile: widget.userProfile,
- currentWorkspace: currentWorkspace,
- workspaces: workspaces,
- );
- },
- ),
- );
- },
- child: _SideBarSwitchWorkspaceButtonChild(
- currentWorkspace: widget.currentWorkspace,
- popoverController: _popoverController,
- isHover: widget.isHover,
- ),
+ return AppFlowyPopover(
+ direction: PopoverDirection.bottomWithCenterAligned,
+ offset: const Offset(0, 5),
+ constraints: const BoxConstraints(maxWidth: 300, maxHeight: 600),
+ margin: EdgeInsets.zero,
+ animationDuration: Durations.short3,
+ beginScaleFactor: 1.0,
+ beginOpacity: 0.8,
+ controller: _popoverController,
+ triggerActions: PopoverTriggerFlags.none,
+ onOpen: () {
+ context
+ .read<UserWorkspaceBloc>()
+ .add(const UserWorkspaceEvent.fetchWorkspaces());
+ },
+ popupBuilder: (_) {
+ return BlocProvider<UserWorkspaceBloc>.value(
+ value: context.read<UserWorkspaceBloc>(),
+ child: BlocBuilder<UserWorkspaceBloc, UserWorkspaceState>(
+ builder: (context, state) {
+ final currentWorkspace = state.currentWorkspace;
+ final workspaces = state.workspaces;
+ if (currentWorkspace == null) {
+ return const SizedBox.shrink();
+ }
+ return WorkspacesMenu(
+ userProfile: widget.userProfile,
+ currentWorkspace: currentWorkspace,
+ workspaces: workspaces,
+ );
+ },
+ ),
+ );
+ },
+ child: _SideBarSwitchWorkspaceButtonChild(
+ currentWorkspace: widget.currentWorkspace,
+ popoverController: _popoverController,
+ isHover: widget.isHover,
),
);
}
diff --git a/frontend/appflowy_flutter/lib/workspace/presentation/settings/widgets/members/inivitation/member_http_service.dart b/frontend/appflowy_flutter/lib/workspace/presentation/settings/widgets/members/inivitation/member_http_service.dart
index dd8dae7d2e..bdd97f52e5 100644
--- a/frontend/appflowy_flutter/lib/workspace/presentation/settings/widgets/members/inivitation/member_http_service.dart
+++ b/frontend/appflowy_flutter/lib/workspace/presentation/settings/widgets/members/inivitation/member_http_service.dart
@@ -68,7 +68,7 @@ class MemberHttpService {
return result.fold(
(data) {
final code = data['data']['code'];
- if (code.isEmpty || code is! String) {
+ if (code is! String || code.isEmpty) {
return FlowyResult.failure(
FlowyError(msg: 'Failed to get invite code: $code'),
);
diff --git a/frontend/appflowy_flutter/lib/workspace/presentation/settings/widgets/members/workspace_member_bloc.dart b/frontend/appflowy_flutter/lib/workspace/presentation/settings/widgets/members/workspace_member_bloc.dart
index c9176edfd9..3cd6a68b38 100644
--- a/frontend/appflowy_flutter/lib/workspace/presentation/settings/widgets/members/workspace_member_bloc.dart
+++ b/frontend/appflowy_flutter/lib/workspace/presentation/settings/widgets/members/workspace_member_bloc.dart
@@ -371,7 +371,7 @@ class WorkspaceMemberBloc
add(WorkspaceMemberEvent.updateInviteLink(inviteLink));
}
},
- (e) => Log.info('Failed to get invite code: ${e.msg}', e),
+ (e) {},
),
);
} else {