Make floating-window close buttons minimise

Remove the separate minimise control and make the title-bar X hide windows while preserving their state and reachability. Update window behavior documentation and focused tests for chat, terminal, and window layering.
This commit is contained in:
2026-11-12 01:45:42 +00:00
parent 2330f50268
commit e4f3ebdcab
12 changed files with 123 additions and 43 deletions
+1 -1
View File
@@ -37,7 +37,7 @@ class WindowEntry {
/// The saved frame; it is drawn fitted inside the window area.
final Rect frame;
/// Hidden by its minimise button; still listed and shown again with its
/// Hidden by the title bar's X; still listed and shown again with its
/// group.
final bool minimized;
final bool maximized;
+7 -11
View File
@@ -11,8 +11,9 @@ double windowTitleBarHeight(BuildContext context) =>
MediaQuery.textScalerOf(context).scale(40).clamp(40.0, 64.0);
/// A floating window's card and title bar: the title (drag to move, double
/// click to maximise), the kind's actions, then Minimise, Maximise and
/// Close. The content is drawn over the card's body by the window's
/// click to maximise), the kind's actions, then Maximise and the X. The X
/// minimises: it hides the window and keeps its state, like the chord does
/// in reverse. The content is drawn over the card's body by the window's
/// navigator.
class WindowFrame extends StatelessWidget {
const WindowFrame({
@@ -25,7 +26,6 @@ class WindowFrame extends StatelessWidget {
required this.onMoveEnd,
required this.onMinimize,
required this.onToggleMaximized,
required this.onClose,
});
final String title;
@@ -36,9 +36,10 @@ class WindowFrame extends StatelessWidget {
/// The drag's delta and the pointer's global position.
final void Function(Offset delta, Offset globalPosition) onMove;
final VoidCallback onMoveEnd;
/// The X: hides the window, keeping it listed and its state.
final VoidCallback onMinimize;
final VoidCallback onToggleMaximized;
final VoidCallback onClose;
@override
Widget build(BuildContext context) {
@@ -69,11 +70,6 @@ class WindowFrame extends StatelessWidget {
onPressed: action.onPressed,
icon: Icon(action.icon),
),
IconButton(
tooltip: 'Minimise',
onPressed: onMinimize,
icon: const Icon(Icons.minimize),
),
IconButton(
tooltip: maximized ? 'Restore size' : 'Maximise',
onPressed: onToggleMaximized,
@@ -82,8 +78,8 @@ class WindowFrame extends StatelessWidget {
),
),
IconButton(
tooltip: 'Close',
onPressed: onClose,
tooltip: 'Minimise',
onPressed: onMinimize,
icon: const Icon(Icons.close),
),
const SizedBox(width: 4),
+3 -3
View File
@@ -2,7 +2,7 @@ import 'package:flutter/widgets.dart';
import 'window_entry.dart';
/// One action in a window's title bar, before Minimise and Close (Dock on a
/// One action in a window's title bar, before Maximise and the X (Dock on a
/// chat, a kind's own menu).
class WindowAction {
const WindowAction({
@@ -42,7 +42,7 @@ abstract class WindowKind {
/// The window's content, below the title bar.
Widget build(BuildContext context, WindowEntry entry);
/// Title-bar actions before Minimise and Close.
/// Title-bar actions before Maximise and the X.
List<WindowAction> actions(BuildContext context, WindowEntry entry) =>
const [];
@@ -57,7 +57,7 @@ abstract class WindowKind {
/// as its window takes focus. The default leaves it on the window.
void focusContent(WindowEntry entry) {}
/// Called after the user closes the window (the X).
/// Called after the window is closed (Dock, Close all, a chat's /close).
void closed(WindowEntry entry) {}
/// Validates a saved window's [WindowEntry.data]; null drops the window.
-1
View File
@@ -259,7 +259,6 @@ class _WindowLayerState extends State<WindowLayer>
onMinimize: () => manager.setMinimized(_id, true),
onToggleMaximized: () =>
manager.setMaximized(_id, !entry.maximized),
onClose: () => manager.close(_id),
),
),
),