From 0cf3ade332e64df953a45878dd02a35844364610 Mon Sep 17 00:00:00 2001 From: Richard Shiue <71320345+richardshiue@users.noreply.github.com> Date: Tue, 3 Dec 2024 22:20:30 +0800 Subject: [PATCH] fix(desktop): resize sidebar menu regression (#6897) --- .../lib/workspace/application/home/home_setting_bloc.dart | 2 +- .../lib/workspace/presentation/home/home_layout.dart | 7 ++++--- .../appflowy_flutter/packages/flowy_infra/lib/size.dart | 2 -- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/frontend/appflowy_flutter/lib/workspace/application/home/home_setting_bloc.dart b/frontend/appflowy_flutter/lib/workspace/application/home/home_setting_bloc.dart index 05418f3315..657f2592d7 100644 --- a/frontend/appflowy_flutter/lib/workspace/application/home/home_setting_bloc.dart +++ b/frontend/appflowy_flutter/lib/workspace/application/home/home_setting_bloc.dart @@ -86,7 +86,7 @@ class HomeSettingBloc extends Bloc { }, editPanelResized: (_EditPanelResized e) { final newPosition = - (e.offset + state.resizeStart).clamp(-50, 200).toDouble(); + (state.resizeStart + e.offset).clamp(0, 200).toDouble(); if (state.resizeOffset != newPosition) { emit(state.copyWith(resizeOffset: newPosition)); } diff --git a/frontend/appflowy_flutter/lib/workspace/presentation/home/home_layout.dart b/frontend/appflowy_flutter/lib/workspace/presentation/home/home_layout.dart index fb108b702e..98139f1db7 100644 --- a/frontend/appflowy_flutter/lib/workspace/presentation/home/home_layout.dart +++ b/frontend/appflowy_flutter/lib/workspace/presentation/home/home_layout.dart @@ -14,10 +14,11 @@ class HomeLayout { HomeLayout(BuildContext context) { final homeSetting = context.read().state; showEditPanel = homeSetting.panelContext != null; - menuWidth = Sizes.sideBarWidth; - menuWidth += homeSetting.resizeOffset; - menuWidth = max(menuWidth, HomeSizes.minimumSidebarWidth); + menuWidth = max( + HomeSizes.minimumSidebarWidth + homeSetting.resizeOffset, + HomeSizes.minimumSidebarWidth, + ); final screenWidthPx = context.widthPx; context diff --git a/frontend/appflowy_flutter/packages/flowy_infra/lib/size.dart b/frontend/appflowy_flutter/packages/flowy_infra/lib/size.dart index b9c6d565f8..f58dad95b5 100644 --- a/frontend/appflowy_flutter/packages/flowy_infra/lib/size.dart +++ b/frontend/appflowy_flutter/packages/flowy_infra/lib/size.dart @@ -57,8 +57,6 @@ class Sizes { static double get hit => 40 * hitScale; static double get iconMed => 20; - - static double get sideBarWidth => 250 * hitScale; } class Corners {