From 2c7aae06331c61df6cb406a09d9ab00df5a6b5ad Mon Sep 17 00:00:00 2001 From: Airyz <36567925+Airyzz@users.noreply.github.com> Date: Fri, 28 Jun 2024 18:00:52 +0930 Subject: [PATCH 1/2] Fix horizontal scrolling on overlapping panels --- .../lib/ui/molecules/overlapping_panels.dart | 98 +++++++++---------- .../ui/pages/main/main_page_view_mobile.dart | 12 +-- 2 files changed, 55 insertions(+), 55 deletions(-) diff --git a/commet/lib/ui/molecules/overlapping_panels.dart b/commet/lib/ui/molecules/overlapping_panels.dart index c1c4fb5a..c792d7ed 100644 --- a/commet/lib/ui/molecules/overlapping_panels.dart +++ b/commet/lib/ui/molecules/overlapping_panels.dart @@ -191,61 +191,61 @@ class OverlappingPanelsState extends State Widget build(BuildContext context) { double borderRadius = 20; - return Stack( - children: [ - Padding( - padding: EdgeInsets.fromLTRB(0, 0, widget.restWidth + 3, 0), - child: ClipRRect( - borderRadius: BorderRadius.only( - topRight: Radius.circular(borderRadius), - bottomRight: Radius.circular(borderRadius)), - child: Offstage( - offstage: translate < 0, - child: widget.left, + return GestureDetector( + behavior: HitTestBehavior.deferToChild, + onHorizontalDragStart: (details) { + widget.onDragStart?.call(); + }, + onHorizontalDragUpdate: (details) { + onTranslate(details.delta.dx); + }, + onHorizontalDragEnd: (details) { + _onApplyTranslation(); + }, + child: Stack( + children: [ + Padding( + padding: EdgeInsets.fromLTRB(0, 0, widget.restWidth + 3, 0), + child: ClipRRect( + borderRadius: BorderRadius.only( + topRight: Radius.circular(borderRadius), + bottomRight: Radius.circular(borderRadius)), + child: Offstage( + offstage: translate < 0, + child: widget.left, + ), + ), ), - ), - ), - Padding( - padding: EdgeInsets.fromLTRB(widget.restWidth + 3, 0, 0, 0), - child: ClipRRect( - borderRadius: BorderRadius.only( - topLeft: Radius.circular(borderRadius), - bottomLeft: Radius.circular(borderRadius)), - child: Offstage( - offstage: translate > 0, - child: widget.right, + Padding( + padding: EdgeInsets.fromLTRB(widget.restWidth + 3, 0, 0, 0), + child: ClipRRect( + borderRadius: BorderRadius.only( + topLeft: Radius.circular(borderRadius), + bottomLeft: Radius.circular(borderRadius)), + child: Offstage( + offstage: translate > 0, + child: widget.right, + ), + ), ), - ), - ), - Transform.translate( - offset: Offset(translate, 0), - child: Container( - clipBehavior: Clip.antiAlias, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular( - (translate.abs() * 0.1).clamp(0, 20)), - boxShadow: - Theme.of(context).extension()?.shadows ?? + Transform.translate( + offset: Offset(translate, 0), + child: Container( + clipBehavior: Clip.antiAlias, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular( + (translate.abs() * 0.1).clamp(0, 20)), + boxShadow: Theme.of(context) + .extension() + ?.shadows ?? [ BoxShadow( color: Colors.black.withAlpha(30), blurRadius: 20) ]), - child: widget.main), - ), - GestureDetector( - behavior: HitTestBehavior.translucent, - onHorizontalDragStart: (details) { - widget.onDragStart?.call(); - }, - onHorizontalDragUpdate: (details) { - onTranslate(details.delta.dx); - }, - onHorizontalDragEnd: (details) { - _onApplyTranslation(); - }, - ), - ], - ); + child: widget.main), + ) + ], + )); } } diff --git a/commet/lib/ui/pages/main/main_page_view_mobile.dart b/commet/lib/ui/pages/main/main_page_view_mobile.dart index df299c53..0b7a65e7 100644 --- a/commet/lib/ui/pages/main/main_page_view_mobile.dart +++ b/commet/lib/ui/pages/main/main_page_view_mobile.dart @@ -87,18 +87,18 @@ class _MainPageViewMobileState extends State { child: Foundation( child: OverlappingPanels( key: panelsKey, - left: navigation(context), - main: Foundation( - child: IgnorePointer( - ignoring: shouldMainIgnoreInput, - child: Container(key: mainPanelKey, child: mainPanel()), - )), onDragStart: () {}, onSideChange: (side) { setState(() { shouldMainIgnoreInput = side != RevealSide.main; }); }, + left: navigation(context), + main: Foundation( + child: IgnorePointer( + ignoring: shouldMainIgnoreInput, + child: Container(key: mainPanelKey, child: mainPanel()), + )), right: rightPanel(context), ))); } From 615914f5089d5debe6da72e8db8219df1dbb487d Mon Sep 17 00:00:00 2001 From: Airyz <36567925+Airyzz@users.noreply.github.com> Date: Fri, 28 Jun 2024 18:05:21 +0930 Subject: [PATCH 2/2] Update overlapping_panels.dart --- commet/lib/ui/molecules/overlapping_panels.dart | 1 - 1 file changed, 1 deletion(-) diff --git a/commet/lib/ui/molecules/overlapping_panels.dart b/commet/lib/ui/molecules/overlapping_panels.dart index c792d7ed..06acbf55 100644 --- a/commet/lib/ui/molecules/overlapping_panels.dart +++ b/commet/lib/ui/molecules/overlapping_panels.dart @@ -192,7 +192,6 @@ class OverlappingPanelsState extends State double borderRadius = 20; return GestureDetector( - behavior: HitTestBehavior.deferToChild, onHorizontalDragStart: (details) { widget.onDragStart?.call(); },