Skip to content

Commit 4e0b9c8

Browse files
authored
feat: show menu as overlapping drawer on small screens (#1088)
* feat: show menu as overlapping drawer on small screens * refactor: simplify home page left offset ternary expression
1 parent 811dc46 commit 4e0b9c8

File tree

2 files changed

+16
-15
lines changed

2 files changed

+16
-15
lines changed

frontend/app_flowy/lib/workspace/presentation/home/home_layout.dart

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import 'home_sizes.dart';
1313
class HomeLayout {
1414
late double menuWidth;
1515
late bool showMenu;
16+
late bool menuIsDrawer;
1617
late bool showEditPanel;
1718
late double editPanelWidth;
1819
late double homePageLOffset;
@@ -36,10 +37,11 @@ class HomeLayout {
3637
if (forceCollapse) {
3738
showMenu = false;
3839
} else {
39-
showMenu = context.widthPx > PageBreaks.tabletPortrait;
40+
showMenu = true;
41+
menuIsDrawer = context.widthPx <= PageBreaks.tabletPortrait;
4042
}
4143

42-
homePageLOffset = showMenu ? menuWidth : 0.0;
44+
homePageLOffset = (showMenu && !menuIsDrawer) ? menuWidth : 0.0;
4345

4446
menuSpacing = !showMenu && Platform.isMacOS ? 80.0 : 0.0;
4547
animDuration = .35.seconds;

frontend/app_flowy/lib/workspace/presentation/home/home_screen.dart

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,6 @@ class _HomeScreenState extends State<HomeScreen> {
148148
return FocusTraversalGroup(child: RepaintBoundary(child: homeMenu));
149149
}
150150

151-
152151
Widget _buildEditPanel(
153152
{required HomeState homeState,
154153
required BuildContext context,
@@ -204,18 +203,6 @@ class _HomeScreenState extends State<HomeScreen> {
204203
}) {
205204
return Stack(
206205
children: [
207-
homeMenu
208-
.animatedPanelX(
209-
closeX: -layout.menuWidth,
210-
isClosed: !layout.showMenu,
211-
)
212-
.positioned(
213-
left: 0,
214-
top: 0,
215-
width: layout.menuWidth,
216-
bottom: 0,
217-
animate: true)
218-
.animate(layout.animDuration, Curves.easeOut),
219206
homeStack
220207
.constrained(minWidth: 500)
221208
.positioned(
@@ -241,6 +228,18 @@ class _HomeScreenState extends State<HomeScreen> {
241228
)
242229
.positioned(
243230
right: 0, top: 0, bottom: 0, width: layout.editPanelWidth),
231+
homeMenu
232+
.animatedPanelX(
233+
closeX: -layout.menuWidth,
234+
isClosed: !layout.showMenu,
235+
)
236+
.positioned(
237+
left: 0,
238+
top: 0,
239+
width: layout.menuWidth,
240+
bottom: 0,
241+
animate: true)
242+
.animate(layout.animDuration, Curves.easeOut),
244243
],
245244
);
246245
}

0 commit comments

Comments
 (0)