mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2024-08-30 18:12:39 +00:00
fix: only rebuild the sidebar header when needed
This commit is contained in:
parent
ddf68b010d
commit
63c76f6843
@ -275,7 +275,6 @@ class _SidebarState extends State<_Sidebar> {
|
|||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
const menuHorizontalInset = EdgeInsets.symmetric(horizontal: 8);
|
const menuHorizontalInset = EdgeInsets.symmetric(horizontal: 8);
|
||||||
final userState = context.read<UserWorkspaceBloc>().state;
|
|
||||||
return MouseRegion(
|
return MouseRegion(
|
||||||
onEnter: (_) => _isHovered.value = true,
|
onEnter: (_) => _isHovered.value = true,
|
||||||
onExit: (_) => _isHovered.value = false,
|
onExit: (_) => _isHovered.value = false,
|
||||||
@ -297,15 +296,19 @@ class _SidebarState extends State<_Sidebar> {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
// user or workspace, setting
|
// user or workspace, setting
|
||||||
Container(
|
BlocBuilder<UserWorkspaceBloc, UserWorkspaceState>(
|
||||||
|
builder: (context, state) {
|
||||||
|
return Container(
|
||||||
height: HomeSizes.workspaceSectionHeight,
|
height: HomeSizes.workspaceSectionHeight,
|
||||||
padding: menuHorizontalInset - const EdgeInsets.only(right: 6),
|
padding:
|
||||||
|
menuHorizontalInset - const EdgeInsets.only(right: 6),
|
||||||
child:
|
child:
|
||||||
// if the workspaces are empty, show the user profile instead
|
// if the workspaces are empty, show the user profile instead
|
||||||
userState.isCollabWorkspaceOn &&
|
state.isCollabWorkspaceOn && state.workspaces.isNotEmpty
|
||||||
userState.workspaces.isNotEmpty
|
|
||||||
? SidebarWorkspace(userProfile: widget.userProfile)
|
? SidebarWorkspace(userProfile: widget.userProfile)
|
||||||
: SidebarUser(userProfile: widget.userProfile),
|
: SidebarUser(userProfile: widget.userProfile),
|
||||||
|
);
|
||||||
|
},
|
||||||
),
|
),
|
||||||
if (FeatureFlag.search.isOn) ...[
|
if (FeatureFlag.search.isOn) ...[
|
||||||
const VSpace(6),
|
const VSpace(6),
|
||||||
|
Loading…
Reference in New Issue
Block a user