Files
clide/lib/widgets/src/clide_resize_border.dart
T
jpmschweitzerandClaude Opus 4.8 76346122aa fix bottom input box alignment when status bar hidden (T-298)
The composer (and any bottom-most pane content) ran flush into the
window's bottom resize-drag strip when the status bar was hidden, since
the bar normally covers that edge. Reserve ClideResizeBorder.edgeThickness
as a bottom inset in RootLayout whenever the status bar is not visible, so
the interaction zone bottom-anchors consistently either way.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-09 23:36:13 +02:00

59 lines
2.4 KiB
Dart

import 'package:clide/kernel/src/window_controls.dart';
import 'package:flutter/widgets.dart';
class ClideResizeBorder extends StatelessWidget {
const ClideResizeBorder({super.key, required this.windowControls, required this.child});
final WindowControls windowControls;
final Widget child;
/// Thickness of the window-edge resize-drag strips. Exposed so layouts can
/// reserve a matching inset for bottom-most content that would otherwise sit
/// under the bottom drag zone when no chrome (e.g. the status bar) covers it
/// (T-298).
static const double edgeThickness = 6;
static const double _edge = edgeThickness;
static const double _corner = 12;
@override
Widget build(BuildContext context) {
return Stack(
children: [
Positioned.fill(child: child),
// Corners
_zone(Alignment.topLeft, _corner, _corner, SystemMouseCursors.resizeUpLeft, ResizeEdge.topLeft),
_zone(Alignment.topRight, _corner, _corner, SystemMouseCursors.resizeUpRight, ResizeEdge.topRight),
_zone(Alignment.bottomLeft, _corner, _corner, SystemMouseCursors.resizeDownLeft, ResizeEdge.bottomLeft),
_zone(Alignment.bottomRight, _corner, _corner, SystemMouseCursors.resizeDownRight, ResizeEdge.bottomRight),
// Edges
Positioned(top: _corner, bottom: _corner, left: 0, width: _edge, child: _edgeZone(SystemMouseCursors.resizeLeft, ResizeEdge.left)),
Positioned(top: _corner, bottom: _corner, right: 0, width: _edge, child: _edgeZone(SystemMouseCursors.resizeRight, ResizeEdge.right)),
Positioned(left: _corner, right: _corner, top: 0, height: _edge, child: _edgeZone(SystemMouseCursors.resizeUp, ResizeEdge.top)),
Positioned(left: _corner, right: _corner, bottom: 0, height: _edge, child: _edgeZone(SystemMouseCursors.resizeDown, ResizeEdge.bottom)),
],
);
}
Widget _zone(Alignment alignment, double w, double h, MouseCursor cursor, ResizeEdge edge) {
return Positioned(
left: alignment.x < 0 ? 0 : null,
right: alignment.x > 0 ? 0 : null,
top: alignment.y < 0 ? 0 : null,
bottom: alignment.y > 0 ? 0 : null,
width: w,
height: h,
child: _edgeZone(cursor, edge),
);
}
Widget _edgeZone(MouseCursor cursor, ResizeEdge edge) {
return MouseRegion(
cursor: cursor,
child: GestureDetector(
onPanStart: (_) => windowControls.startResize(edge),
child: const ColoredBox(color: Color(0x00000000)),
),
);
}
}