Skip to content

Commit fb33e4d

Browse files
authored
fix: unable to expand sidebar on Windows (#7847)
* fix: unable to collapse sidebar * fix: unable to expand workspace menu
1 parent 807aa74 commit fb33e4d

File tree

4 files changed

+48
-46
lines changed

4 files changed

+48
-46
lines changed

frontend/appflowy_flutter/lib/workspace/presentation/home/home_stack.dart

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -153,9 +153,14 @@ class _HomeStackState extends State<HomeStack> with WindowListener {
153153
richMessage: textSpan,
154154
child: Listener(
155155
behavior: HitTestBehavior.translucent,
156-
onPointerDown: (_) => context
157-
.read<HomeSettingBloc>()
158-
.add(const HomeSettingEvent.changeMenuStatus(MenuStatus.hidden)),
156+
onPointerDown: (_) {
157+
final isMenuExpanded =
158+
context.read<HomeSettingBloc>().isMenuExpanded;
159+
final status = isMenuExpanded ? MenuStatus.hidden : MenuStatus.expanded;
160+
context
161+
.read<HomeSettingBloc>()
162+
.add(HomeSettingEvent.changeMenuStatus(status));
163+
},
159164
child: FlowyHover(
160165
child: Container(
161166
width: 24,

frontend/appflowy_flutter/lib/workspace/presentation/home/menu/sidebar/workspace/sidebar_workspace.dart

Lines changed: 38 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -296,47 +296,44 @@ class _SidebarSwitchWorkspaceButtonState
296296

297297
@override
298298
Widget build(BuildContext context) {
299-
return BlocProvider(
300-
create: (context) => context.read<UserWorkspaceBloc>(),
301-
child: AppFlowyPopover(
302-
direction: PopoverDirection.bottomWithCenterAligned,
303-
offset: const Offset(0, 5),
304-
constraints: const BoxConstraints(maxWidth: 300, maxHeight: 600),
305-
margin: EdgeInsets.zero,
306-
animationDuration: Durations.short3,
307-
beginScaleFactor: 1.0,
308-
beginOpacity: 0.8,
309-
controller: _popoverController,
310-
triggerActions: PopoverTriggerFlags.none,
311-
onOpen: () {
312-
context
313-
.read<UserWorkspaceBloc>()
314-
.add(const UserWorkspaceEvent.fetchWorkspaces());
315-
},
316-
popupBuilder: (_) {
317-
return BlocProvider<UserWorkspaceBloc>.value(
318-
value: context.read<UserWorkspaceBloc>(),
319-
child: BlocBuilder<UserWorkspaceBloc, UserWorkspaceState>(
320-
builder: (context, state) {
321-
final currentWorkspace = state.currentWorkspace;
322-
final workspaces = state.workspaces;
323-
if (currentWorkspace == null) {
324-
return const SizedBox.shrink();
325-
}
326-
return WorkspacesMenu(
327-
userProfile: widget.userProfile,
328-
currentWorkspace: currentWorkspace,
329-
workspaces: workspaces,
330-
);
331-
},
332-
),
333-
);
334-
},
335-
child: _SideBarSwitchWorkspaceButtonChild(
336-
currentWorkspace: widget.currentWorkspace,
337-
popoverController: _popoverController,
338-
isHover: widget.isHover,
339-
),
299+
return AppFlowyPopover(
300+
direction: PopoverDirection.bottomWithCenterAligned,
301+
offset: const Offset(0, 5),
302+
constraints: const BoxConstraints(maxWidth: 300, maxHeight: 600),
303+
margin: EdgeInsets.zero,
304+
animationDuration: Durations.short3,
305+
beginScaleFactor: 1.0,
306+
beginOpacity: 0.8,
307+
controller: _popoverController,
308+
triggerActions: PopoverTriggerFlags.none,
309+
onOpen: () {
310+
context
311+
.read<UserWorkspaceBloc>()
312+
.add(const UserWorkspaceEvent.fetchWorkspaces());
313+
},
314+
popupBuilder: (_) {
315+
return BlocProvider<UserWorkspaceBloc>.value(
316+
value: context.read<UserWorkspaceBloc>(),
317+
child: BlocBuilder<UserWorkspaceBloc, UserWorkspaceState>(
318+
builder: (context, state) {
319+
final currentWorkspace = state.currentWorkspace;
320+
final workspaces = state.workspaces;
321+
if (currentWorkspace == null) {
322+
return const SizedBox.shrink();
323+
}
324+
return WorkspacesMenu(
325+
userProfile: widget.userProfile,
326+
currentWorkspace: currentWorkspace,
327+
workspaces: workspaces,
328+
);
329+
},
330+
),
331+
);
332+
},
333+
child: _SideBarSwitchWorkspaceButtonChild(
334+
currentWorkspace: widget.currentWorkspace,
335+
popoverController: _popoverController,
336+
isHover: widget.isHover,
340337
),
341338
);
342339
}

frontend/appflowy_flutter/lib/workspace/presentation/settings/widgets/members/inivitation/member_http_service.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ class MemberHttpService {
6868
return result.fold(
6969
(data) {
7070
final code = data['data']['code'];
71-
if (code.isEmpty || code is! String) {
71+
if (code is! String || code.isEmpty) {
7272
return FlowyResult.failure(
7373
FlowyError(msg: 'Failed to get invite code: $code'),
7474
);

frontend/appflowy_flutter/lib/workspace/presentation/settings/widgets/members/workspace_member_bloc.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -371,7 +371,7 @@ class WorkspaceMemberBloc
371371
add(WorkspaceMemberEvent.updateInviteLink(inviteLink));
372372
}
373373
},
374-
(e) => Log.info('Failed to get invite code: ${e.msg}', e),
374+
(e) {},
375375
),
376376
);
377377
} else {

0 commit comments

Comments
 (0)