diff --git a/lib/ui/app_shell.dart b/lib/ui/app_shell.dart index dea828b..8cc972f 100644 --- a/lib/ui/app_shell.dart +++ b/lib/ui/app_shell.dart @@ -238,7 +238,14 @@ class _AppShellState extends State { child: Container(color: t.canvas2, child: CanvasView(controller: c)), ), // 上层:信息浮层。 - Positioned.fill(child: CanvasOverlays(controller: c)), + Positioned.fill( + child: CanvasOverlays( + controller: c, + // 侧栏收起时让浮层避开边缘把手。 + leftInset: _leftRail ? 22 : 0, + rightInset: _rightRail ? 22 : 0, + ), + ), ], ), ), diff --git a/lib/ui/canvas_overlays.dart b/lib/ui/canvas_overlays.dart index 0144d08..45ea43c 100644 --- a/lib/ui/canvas_overlays.dart +++ b/lib/ui/canvas_overlays.dart @@ -19,11 +19,25 @@ import 'dialogs.dart'; /// 画布浮层容器:按响应式断点组合并定位各信息面板。 class CanvasOverlays extends StatelessWidget { /// 创建浮层容器,[controller] 为全局应用控制器。 - const CanvasOverlays({super.key, required this.controller}); + /// + /// [leftInset]/[rightInset]:侧栏收起后画布两侧的“把手”宽度, + /// 浮层据此内缩,避免被把手遮挡。 + const CanvasOverlays({ + super.key, + required this.controller, + this.leftInset = 0, + this.rightInset = 0, + }); /// 全局应用控制器,提供项目数据与编辑动作。 final AppController controller; + /// 左侧把手占用的宽度(0 表示无把手)。 + final double leftInset; + + /// 右侧把手占用的宽度(0 表示无把手)。 + final double rightInset; + /// 控制器快捷访问器。 AppController get c => controller; @@ -38,28 +52,31 @@ class CanvasOverlays extends StatelessWidget { final double w = constraints.maxWidth; final double h = constraints.maxHeight; // ---- 响应式断点:不同尺寸下显示不同的浮层组合 ---- + // 左右边距:在基础留白上叠加侧栏把手的宽度,避免被把手遮挡。 + final double left = 18 + leftInset; + final double right = 18 + rightInset; // 圆周视图左侧图例列:需要较宽较高的窗口。 - final bool showLeftColumn = circular && w >= 1500 && h >= 820; + final bool showLeftColumn = circular && w >= 1180 && h >= 760; // 条形视图统计卡片:中等尺寸以上显示。 - final bool showStats = !circular && w >= 900 && h >= 760; + final bool showStats = !circular && w >= 820 && h >= 700; // 编辑工具条:门槛最低,几乎始终显示。 - final bool showTools = w >= 760; - // 实时预览卡片:需要大屏才显示。 - final bool showPreview = w >= 1400 && h >= 760; + final bool showTools = w >= 700; + // 实时预览卡片:门槛放低,钉住侧栏后仍可见。 + final bool showPreview = w >= 1000 && h >= 680; // 浮层整体使用 Stack 叠加,各面板按断点条件选择性插入。 return Stack( children: [ // 顶部标题与副标题,横跨整个画布宽度,不拦截手势。 Positioned( - left: 18, + left: left, top: 12, - right: 18, + right: right, child: IgnorePointer(child: _Title(t: t, circular: circular, project: c.project)), ), // 圆周视图左侧信息列:图例 + 选中卡片 + 依赖图例。 if (showLeftColumn) Positioned( - left: 18, + left: left, top: 70, bottom: 12, width: 268, @@ -79,7 +96,7 @@ class CanvasOverlays extends StatelessWidget { // 条形视图左下角:节拍统计 + 编辑工具。 if (!circular && (showStats || showTools)) Positioned( - left: 18, + left: left, bottom: 12, child: Column( crossAxisAlignment: CrossAxisAlignment.start, @@ -96,7 +113,7 @@ class CanvasOverlays extends StatelessWidget { // 右下角实时预览:圆周视图显示条形缩略,反之亦然。 if (showPreview) Positioned( - right: 18, + right: right, bottom: 12, child: IgnorePointer( child: circular @@ -107,7 +124,7 @@ class CanvasOverlays extends StatelessWidget { // 圆周视图右侧浮动工具栏(添加/编辑/复制/删除/改层/对齐/帮助)。 if (circular) Positioned( - right: 16, + right: right - 2, top: 120, child: _FloatingToolbar(t: t, c: c), ), @@ -742,7 +759,7 @@ class _BarPreviewCard extends StatelessWidget { Widget build(BuildContext context) { return _Card( t: t, - width: 320, + width: 300, child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ @@ -822,7 +839,7 @@ class _CircularPreviewCard extends StatelessWidget { Widget build(BuildContext context) { return _Card( t: t, - width: 330, + width: 300, child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [