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.
Dart blogconfluence-alternativecontent-managementcontent-servicesdocumentationflutternote-takingnotion-alternativeproject-managementtask-managementteam-collaborationwiki
fix: incorrect colors for switch workspace button (#6228)
Richard Shiued1d485ee9435
diff --git a/frontend/appflowy_flutter/lib/workspace/presentation/home/menu/sidebar/shared/sidebar_setting.dart b/frontend/appflowy_flutter/lib/workspace/presentation/home/menu/sidebar/shared/sidebar_setting.dartindex db631d2b34..18552c887d 100644--- a/frontend/appflowy_flutter/lib/workspace/presentation/home/menu/sidebar/shared/sidebar_setting.dart+++ b/frontend/appflowy_flutter/lib/workspace/presentation/home/menu/sidebar/shared/sidebar_setting.dart@@ -43,9 +43,14 @@ HotKeyItem openSettingsHotKey();class UserSettingButton extends StatefulWidget {- const UserSettingButton({required this.userProfile, super.key});+ const UserSettingButton({+ super.key,+ required this.userProfile,+ this.isHover = false,+ });final UserProfilePB userProfile;+ final bool isHover;@overrideState<UserSettingButton> createState() => _UserSettingButtonState();@@ -79,8 +84,10 @@ class _UserSettingButtonState extends State<UserSettingButton> {_userWorkspaceBloc,),margin: EdgeInsets.zero,- text: const FlowySvg(+ text: FlowySvg(FlowySvgs.settings_s,+ color:+ widget.isHover ? Theme.of(context).colorScheme.onSurface : null,opacity: 0.7,),),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.dartindex f6b1931570..4b36b4a6a1 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@@ -63,23 +63,26 @@ class _SidebarWorkspaceState extends State<SidebarWorkspace> {? Theme.of(context).colorScheme.secondary: Colors.transparent,),- child: child,+ child: Row(+ children: [+ Expanded(+ child: SidebarSwitchWorkspaceButton(+ userProfile: widget.userProfile,+ currentWorkspace: currentWorkspace,+ isHover: onHover,+ ),+ ),+ UserSettingButton(+ userProfile: widget.userProfile,+ isHover: onHover,+ ),+ const HSpace(8.0),+ NotificationButton(isHover: onHover),+ const HSpace(4.0),+ ],+ ),);},- 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),- ],- ),),);},@@ -177,10 +180,12 @@ class SidebarSwitchWorkspaceButton extends StatefulWidget {super.key,required this.userProfile,required this.currentWorkspace,+ this.isHover = false,});final UserWorkspacePB currentWorkspace;final UserProfilePB userProfile;+ final bool isHover;@overrideState<SidebarSwitchWorkspaceButton> createState() =>@@ -189,7 +194,7 @@ class SidebarSwitchWorkspaceButton extends StatefulWidget {class _SidebarSwitchWorkspaceButtonStateextends State<SidebarSwitchWorkspaceButton> {- final ValueNotifier<bool> _isWorkSpaceMenuExpanded = ValueNotifier(false);+ final PopoverController _popoverController = PopoverController();@overrideWidget build(BuildContext context) {@@ -197,14 +202,14 @@ class _SidebarSwitchWorkspaceButtonStatedirection: PopoverDirection.bottomWithLeftAligned,offset: const Offset(0, 5),constraints: const BoxConstraints(maxWidth: 300, maxHeight: 600),+ controller: _popoverController,+ triggerActions: PopoverTriggerFlags.none,onOpen: () {- _isWorkSpaceMenuExpanded.value = true;context.read<UserWorkspaceBloc>().add(const UserWorkspaceEvent.fetchWorkspaces());},onClose: () {- _isWorkSpaceMenuExpanded.value = false;Log.info('close workspace menu');},popupBuilder: (_) {@@ -227,16 +232,40 @@ class _SidebarSwitchWorkspaceButtonState),);},- child: FlowyIconTextButton(- margin: EdgeInsets.zero,- hoverColor: Colors.transparent,- textBuilder: (onHover) => SizedBox(+ child: _SideBarSwitchWorkspaceButtonChild(+ currentWorkspace: widget.currentWorkspace,+ popoverController: _popoverController,+ isHover: widget.isHover,+ ),+ );+ }+}++class _SideBarSwitchWorkspaceButtonChild extends StatelessWidget {+ const _SideBarSwitchWorkspaceButtonChild({+ required this.popoverController,+ required this.currentWorkspace,+ required this.isHover,+ });++ final PopoverController popoverController;+ final UserWorkspacePB currentWorkspace;+ final bool isHover;++ @override+ Widget build(BuildContext context) {+ return MouseRegion(+ cursor: SystemMouseCursors.click,+ child: GestureDetector(+ onTap: () => popoverController.show(),+ behavior: HitTestBehavior.opaque,+ child: SizedBox(height: 30,child: Row(children: [const HSpace(4.0),WorkspaceIcon(- workspace: widget.currentWorkspace,+ workspace: currentWorkspace,iconSize: 24,fontSize: 16,emojiSize: 18,@@ -245,7 +274,7 @@ class _SidebarSwitchWorkspaceButtonStatefigmaLineHeight: 21.0,onSelected: (result) => context.read<UserWorkspaceBloc>().add(UserWorkspaceEvent.updateWorkspaceIcon(- widget.currentWorkspace.workspaceId,+ currentWorkspace.workspaceId,result.emoji,),),@@ -253,17 +282,22 @@ class _SidebarSwitchWorkspaceButtonStateconst HSpace(8),Flexible(child: FlowyText.medium(- widget.currentWorkspace.name,+ currentWorkspace.name,+ color:+ isHover ? Theme.of(context).colorScheme.onSurface : null,overflow: TextOverflow.ellipsis,withTooltip: true,fontSize: 15.0,),),- const HSpace(4),- if (onHover)- const FlowySvg(+ if (isHover) ...[+ const HSpace(4),+ FlowySvg(FlowySvgs.workspace_drop_down_menu_show_s,+ color:+ isHover ? Theme.of(context).colorScheme.onSurface : null,),+ ],],),),diff --git a/frontend/appflowy_flutter/lib/workspace/presentation/notifications/widgets/notification_button.dart b/frontend/appflowy_flutter/lib/workspace/presentation/notifications/widgets/notification_button.dartindex e0747fc684..f9398014df 100644--- a/frontend/appflowy_flutter/lib/workspace/presentation/notifications/widgets/notification_button.dart+++ b/frontend/appflowy_flutter/lib/workspace/presentation/notifications/widgets/notification_button.dart@@ -13,7 +13,12 @@ import 'package:flutter/material.dart';import 'package:flutter_bloc/flutter_bloc.dart';class NotificationButton extends StatefulWidget {- const NotificationButton({super.key});+ const NotificationButton({+ super.key,+ this.isHover = false,+ });++ final bool isHover;@overrideState<NotificationButton> createState() => _NotificationButtonState();@@ -81,9 +86,11 @@ class _NotificationButtonState extends State<NotificationButton> {Widget _buildNotificationIcon(BuildContext context, bool hasUnreads) {return Stack(children: [- const Center(+ Center(child: FlowySvg(FlowySvgs.notification_s,+ color:+ widget.isHover ? Theme.of(context).colorScheme.onSurface : null,opacity: 0.7,),),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.dartindex a35af6ce80..374be63abe 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@@ -226,7 +226,11 @@ class WorkspaceMemberBlocawait UserBackendService.getWorkspaceSubscriptionInfo(_workspaceId);result.fold(- (info) => add(WorkspaceMemberEvent.updateSubscriptionInfo(info)),+ (info) {+ if (!isClosed) {+ add(WorkspaceMemberEvent.updateSubscriptionInfo(info));+ }+ },(f) => Log.error('Failed to fetch subscription info: ${f.msg}', f),);}