04ba81e0ea
Keep chat and folder-picker UI on the Material path by removing obsolete Cupertino imports, icon metadata, flags, and alternate control handling while preserving existing behavior and focused test coverage.
70 lines
2.1 KiB
Dart
70 lines
2.1 KiB
Dart
part of 'screen.dart';
|
|
|
|
/// Floating a tiled pane into a window and docking it back (see
|
|
/// [ChatWindows] and `notes/chat-floating-pane.md`).
|
|
mixin _ChatScreenFloat on State<ChatScreen>, _ChatScreenWorkspace {
|
|
ChatTiling? _tiling;
|
|
|
|
void _bindWindows() {
|
|
final windows = widget.windows;
|
|
if (windows == null) return;
|
|
_workspace.showOutside = windows.show;
|
|
windows.tiling = _tiling = ChatTiling(
|
|
holds: _workspace.holdsSession,
|
|
dock: _dockSession,
|
|
canFloatActive: () {
|
|
final pane = _workspace.activePane;
|
|
return mounted &&
|
|
pane != null &&
|
|
_floatsHere &&
|
|
_workspaceVisible &&
|
|
_workspace.canFloat(pane.id) &&
|
|
_chatOwnsKeyboard();
|
|
},
|
|
floatActive: () {
|
|
final pane = _workspace.activePane;
|
|
if (pane != null) _floatPane(pane.id);
|
|
},
|
|
);
|
|
}
|
|
|
|
void _unbindWindows() {
|
|
final windows = widget.windows;
|
|
if (windows != null && identical(windows.tiling, _tiling)) {
|
|
windows.tiling = null;
|
|
}
|
|
_workspace.showOutside = null;
|
|
}
|
|
|
|
/// Panes float only on a wide layout, beside the chat list.
|
|
bool get _floatsHere =>
|
|
widget.windows != null && !_pageOpen && showsListBesideDetail(context);
|
|
|
|
/// The pane leaves the tiling and its live view moves into a window in
|
|
/// the same frame.
|
|
void _floatPane(String paneId) {
|
|
final pane = _workspace.detach(paneId);
|
|
if (pane != null) widget.windows?.float(pane.sessionId);
|
|
}
|
|
|
|
void _dockSession(String sessionId) {
|
|
if (!mounted) return;
|
|
_workspaceVisible = true;
|
|
if (!_pageOpen && showsListBesideDetail(context)) _usedWorkspace = true;
|
|
_workspace.dock(sessionId);
|
|
_composerFocus.request(sessionId);
|
|
}
|
|
|
|
/// The pane menu's Float choice, on a tiled pane that can.
|
|
List<Widget> _floatControls(ChatWorkspacePane pane) {
|
|
if (!_floatsHere || !_workspace.canFloat(pane.id)) return const [];
|
|
return [
|
|
ChatBarAction(
|
|
label: 'Float (${chatFloatShortcutLabel()})',
|
|
onPressed: () => _floatPane(pane.id),
|
|
materialIcon: Icons.picture_in_picture_alt_outlined,
|
|
),
|
|
];
|
|
}
|
|
}
|