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:
@@ -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),
|
||||
|
||||
Reference in New Issue
Block a user