Merge commit '2e41717e83132e55d296853c0338bc2c7ed87b9d' into pipelines/run-20261111-1927-unify-chat-selectors-with-permission-men-e1a8
This commit is contained in:
@@ -82,6 +82,7 @@ class FilesHeader extends StatelessWidget {
|
||||
),
|
||||
AppOverflowMenu<FilesSortKey>(
|
||||
label: 'Sort',
|
||||
icon: const Icon(Icons.sort),
|
||||
onSelected: (_, key) =>
|
||||
controller.setSort(controller.sort.reverseOr(key)),
|
||||
actions: [
|
||||
|
||||
@@ -221,7 +221,7 @@ class ChatWindows {
|
||||
if (event is KeyDownEvent) tiling.floatActive();
|
||||
return KeyEventResult.handled;
|
||||
}
|
||||
if (event is KeyDownEvent) manager.toggleGroup(chatWindowKind);
|
||||
if (event is KeyDownEvent) manager.toggleOrRaiseGroup(chatWindowKind);
|
||||
return KeyEventResult.handled;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,16 +1,13 @@
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
|
||||
import '../../../ui/input/keyboard_owner.dart';
|
||||
|
||||
/// Whether [event] shows or hides the floating chats: Alt+Y (Option+Y),
|
||||
/// Ctrl+Y, and Cmd+Y on Apple platforms, matching the terminal's Alt+T. It is
|
||||
/// a global key handler like the terminal's toggle, so it works while a
|
||||
/// composer or the terminal has the keyboard; a plain Y (or Shift+Y) always
|
||||
/// types. Alt+Y is always the chord, as Alt+T is for the terminal. On Apple
|
||||
/// platforms Ctrl+Y inside a terminal is left to the shell (yank), since Cmd+Y
|
||||
/// is there; elsewhere Ctrl+Y is the chord, so it takes priority over the
|
||||
/// shell's yank.
|
||||
/// platforms Ctrl+Y is also the chord, so it takes priority over the shell's
|
||||
/// yank.
|
||||
///
|
||||
/// A held chord's repeats match too (and are swallowed); only its first
|
||||
/// press toggles.
|
||||
@@ -31,7 +28,7 @@ bool chatFloatShortcut(
|
||||
if (alt) return !control && !meta;
|
||||
if (control == meta) return false;
|
||||
if (!_apple(platform ?? defaultTargetPlatform)) return control;
|
||||
return meta || !primaryFocusIsTypingSurface();
|
||||
return control || meta;
|
||||
}
|
||||
|
||||
bool _apple(TargetPlatform platform) =>
|
||||
|
||||
@@ -128,6 +128,27 @@ class WindowFrame extends StatelessWidget {
|
||||
);
|
||||
}
|
||||
|
||||
/// The foreground edge of a floating window. This is separate from
|
||||
/// [WindowFrame] because the window body is painted by a later navigator
|
||||
/// child and may otherwise cover the card's decoration.
|
||||
class WindowOutline extends StatelessWidget {
|
||||
const WindowOutline({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final colors = Theme.of(context).colorScheme;
|
||||
return IgnorePointer(
|
||||
child: DecoratedBox(
|
||||
decoration: BoxDecoration(
|
||||
border: Border.all(color: colors.outlineVariant),
|
||||
borderRadius: BorderRadius.circular(windowCornerRadius),
|
||||
),
|
||||
child: const SizedBox.expand(),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/// The lower right corner of a window: drag to resize.
|
||||
class WindowResizeCorner extends StatelessWidget {
|
||||
const WindowResizeCorner({
|
||||
|
||||
@@ -300,6 +300,7 @@ class _WindowLayerState extends State<WindowLayer>
|
||||
onResizeEnd: _resizeEnded,
|
||||
),
|
||||
),
|
||||
Positioned.fromRect(rect: frame, child: const WindowOutline()),
|
||||
],
|
||||
);
|
||||
final center = widget.bounds.center(Offset.zero);
|
||||
|
||||
@@ -289,6 +289,20 @@ class WindowManager extends ChangeNotifier {
|
||||
return true;
|
||||
}
|
||||
|
||||
/// Hides the group when it is active; otherwise shows and raises its most
|
||||
/// recently used window. A global shortcut should bring a group forward when
|
||||
/// pressed from another window, rather than hide it behind that window.
|
||||
bool toggleOrRaiseGroup(String groupId) {
|
||||
final group = inGroup(groupId).toList();
|
||||
if (group.isEmpty) return false;
|
||||
if (group.any(isVisible) && active?.groupId == groupId) {
|
||||
setGroupShown(groupId, false);
|
||||
} else {
|
||||
show(group.last.id);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/// Brings the next ([step] 1) or previous (-1) visible window to the top.
|
||||
void cycle([int step = 1]) {
|
||||
final visible = windows.where(isVisible).toList();
|
||||
|
||||
@@ -33,6 +33,7 @@ class AppOverflowMenu<T> extends StatelessWidget {
|
||||
this.label = 'More actions',
|
||||
this.sheetTitle,
|
||||
this.enabled = true,
|
||||
this.icon = const Icon(Icons.more_vert),
|
||||
});
|
||||
|
||||
final List<AppMenuAction<T>> actions;
|
||||
@@ -48,6 +49,10 @@ class AppOverflowMenu<T> extends StatelessWidget {
|
||||
|
||||
final bool enabled;
|
||||
|
||||
/// The button glyph. Most callers use the default overflow icon; controls
|
||||
/// whose action has a distinct meaning can provide a matching Material icon.
|
||||
final Widget icon;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
if (actions.isEmpty) return const SizedBox.shrink();
|
||||
@@ -57,7 +62,7 @@ class AppOverflowMenu<T> extends StatelessWidget {
|
||||
child: Material(
|
||||
type: MaterialType.transparency,
|
||||
child: PopupMenuButton<T>(
|
||||
icon: const Icon(Icons.more_vert),
|
||||
icon: icon,
|
||||
tooltip: label,
|
||||
enabled: enabled,
|
||||
onSelected: (value) => onSelected(context, value),
|
||||
|
||||
Reference in New Issue
Block a user