Merge current main and preserve Material chat cleanup
This commit is contained in:
@@ -1,4 +1,3 @@
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../../../ui/adaptive/glass_bar.dart';
|
||||
@@ -200,7 +199,6 @@ class _IconActions extends StatelessWidget {
|
||||
key: const Key('artifact-download'),
|
||||
label: 'Download',
|
||||
icon: Icons.download_outlined,
|
||||
cupertinoIcon: CupertinoIcons.arrow_down_to_line,
|
||||
busy: busy,
|
||||
onPressed: busy ? null : controller.download,
|
||||
),
|
||||
@@ -209,7 +207,6 @@ class _IconActions extends StatelessWidget {
|
||||
key: const Key('artifact-share'),
|
||||
label: 'Share',
|
||||
icon: Icons.share_outlined,
|
||||
cupertinoIcon: CupertinoIcons.share,
|
||||
onPressed: busy ? null : controller.share,
|
||||
),
|
||||
],
|
||||
@@ -223,7 +220,6 @@ class ArtifactIconAction extends StatelessWidget {
|
||||
super.key,
|
||||
required this.label,
|
||||
required this.icon,
|
||||
required this.cupertinoIcon,
|
||||
required this.onPressed,
|
||||
this.busy = false,
|
||||
});
|
||||
@@ -231,9 +227,6 @@ class ArtifactIconAction extends StatelessWidget {
|
||||
final String label;
|
||||
final IconData icon;
|
||||
|
||||
/// Retained for callers that still pass the Cupertino glyph; the Material
|
||||
/// action always draws [icon].
|
||||
final IconData cupertinoIcon;
|
||||
final VoidCallback? onPressed;
|
||||
final bool busy;
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
@@ -34,7 +33,7 @@ class ArtifactFullscreenScope extends InheritedWidget {
|
||||
/// [cupertino] is retained for callers that still pass it; the route is always
|
||||
/// the Material one.
|
||||
Route<void> artifactFullscreenRoute({
|
||||
required bool cupertino,
|
||||
bool? cupertino,
|
||||
required WidgetBuilder builder,
|
||||
}) => MaterialPageRoute<void>(fullscreenDialog: true, builder: builder);
|
||||
|
||||
@@ -74,7 +73,6 @@ List<Widget> artifactHtmlZoomActions(ValueNotifier<double> zoom) {
|
||||
Key key,
|
||||
String label,
|
||||
IconData icon,
|
||||
IconData cupertinoIcon,
|
||||
VoidCallback? onPressed,
|
||||
) => SegmentedOverflowAction(
|
||||
key: key,
|
||||
@@ -83,12 +81,7 @@ List<Widget> artifactHtmlZoomActions(ValueNotifier<double> zoom) {
|
||||
icon: icon,
|
||||
onPressed: onPressed,
|
||||
),
|
||||
child: ArtifactIconAction(
|
||||
label: label,
|
||||
icon: icon,
|
||||
cupertinoIcon: cupertinoIcon,
|
||||
onPressed: onPressed,
|
||||
),
|
||||
child: ArtifactIconAction(label: label, icon: icon, onPressed: onPressed),
|
||||
);
|
||||
final value = zoom.value;
|
||||
return [
|
||||
@@ -96,21 +89,18 @@ List<Widget> artifactHtmlZoomActions(ValueNotifier<double> zoom) {
|
||||
artifactZoomOutKey,
|
||||
'Zoom out',
|
||||
Icons.zoom_out,
|
||||
CupertinoIcons.zoom_out,
|
||||
value > artifactHtmlZoomSteps.first + 0.001 ? () => step(-1) : null,
|
||||
),
|
||||
action(
|
||||
artifactZoomResetKey,
|
||||
'Actual size ($percent)',
|
||||
Icons.restart_alt,
|
||||
CupertinoIcons.arrow_counterclockwise,
|
||||
(value - 1).abs() > 0.001 ? () => zoom.value = 1 : null,
|
||||
),
|
||||
action(
|
||||
artifactZoomInKey,
|
||||
'Zoom in',
|
||||
Icons.zoom_in,
|
||||
CupertinoIcons.zoom_in,
|
||||
value < artifactHtmlZoomSteps.last - 0.001 ? () => step(1) : null,
|
||||
),
|
||||
];
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import 'dart:math' as math;
|
||||
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../../../ui/adaptive/glass_bar.dart';
|
||||
@@ -131,14 +130,12 @@ class ArtifactViewerBar extends StatelessWidget {
|
||||
key: const Key('artifact-open'),
|
||||
label: 'Open in browser',
|
||||
icon: Icons.open_in_new,
|
||||
cupertinoIcon: CupertinoIcons.arrow_up_right_square,
|
||||
onPressed: onOpen,
|
||||
),
|
||||
ArtifactIconAction(
|
||||
key: const Key('artifact-copy-link'),
|
||||
label: 'Copy link',
|
||||
icon: Icons.link,
|
||||
cupertinoIcon: CupertinoIcons.link,
|
||||
onPressed: onCopy,
|
||||
),
|
||||
],
|
||||
@@ -147,9 +144,6 @@ class ArtifactViewerBar extends StatelessWidget {
|
||||
key: artifactFullscreenKey,
|
||||
label: fullscreen ? 'Exit full screen' : 'Full screen',
|
||||
icon: fullscreen ? Icons.fullscreen_exit : Icons.fullscreen,
|
||||
cupertinoIcon: fullscreen
|
||||
? CupertinoIcons.fullscreen_exit
|
||||
: CupertinoIcons.fullscreen,
|
||||
onPressed: toggle,
|
||||
),
|
||||
];
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import 'dart:typed_data';
|
||||
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../../../ui/adaptive/floating_bar_layout.dart';
|
||||
@@ -187,7 +186,6 @@ class ArtifactViewerInfoAction extends StatelessWidget {
|
||||
key: const Key('artifact-info'),
|
||||
label: 'Details',
|
||||
icon: Icons.info_outline,
|
||||
cupertinoIcon: CupertinoIcons.info,
|
||||
onPressed: () => _show(context),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -831,8 +831,7 @@ class _ChatComposerBarState extends State<ChatComposerBar> {
|
||||
// inside the glass with the field, as one floating composer; only the
|
||||
// command palette, a separate menu, floats above it.
|
||||
final extras = <Widget>[
|
||||
if (chatDraftIsShell(composer.draft))
|
||||
ChatShellModeIndicator(cupertino: false),
|
||||
if (chatDraftIsShell(composer.draft)) ChatShellModeIndicator(),
|
||||
if (!_attachments.isEmpty) _attachmentStrip(context),
|
||||
if (_uploading)
|
||||
_notice(
|
||||
|
||||
@@ -4,7 +4,7 @@ import 'package:flutter/material.dart';
|
||||
|
||||
import '../../../core/api_gateway.dart';
|
||||
import '../../../core/error_reason.dart';
|
||||
import '../../../ui/adaptive/app_menu_anchor.dart';
|
||||
import '../../../ui/adaptive/app_popups.dart';
|
||||
import 'chat_bar_control_style.dart';
|
||||
import 'chat_efforts.dart';
|
||||
import 'chat_models.dart';
|
||||
@@ -92,9 +92,13 @@ class _ChatEffortControlState extends State<ChatEffortControl> {
|
||||
}
|
||||
|
||||
Future<void> _chooseFromMenu(ChatEffortLevel level) async {
|
||||
if (level.id == _state.effort) return;
|
||||
if (level.id == _state.effort || level.id == _state.current) {
|
||||
Navigator.of(context).pop();
|
||||
return;
|
||||
}
|
||||
try {
|
||||
await _choose(level);
|
||||
if (mounted) Navigator.of(context).pop();
|
||||
} catch (error) {
|
||||
if (!mounted) return;
|
||||
ScaffoldMessenger.maybeOf(context)?.showSnackBar(
|
||||
@@ -128,57 +132,62 @@ class _ChatEffortControlState extends State<ChatEffortControl> {
|
||||
],
|
||||
);
|
||||
const key = Key('chat-effort');
|
||||
return AppMenuAnchor(
|
||||
menuChildren: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.fromLTRB(12, 8, 12, 4),
|
||||
child: ConstrainedBox(
|
||||
constraints: const BoxConstraints(maxWidth: 280),
|
||||
return Semantics(
|
||||
container: true,
|
||||
button: true,
|
||||
label: 'Change thinking level, currently ${_state.currentName}',
|
||||
onTap: _open,
|
||||
child: ExcludeSemantics(
|
||||
child: Tooltip(
|
||||
message: 'Change thinking level (currently ${_state.currentName})',
|
||||
child: TextButton(
|
||||
key: key,
|
||||
style: chatBarTextButtonStyle(context, compact: iconOnly),
|
||||
onPressed: _open,
|
||||
child: content,
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Future<void> _open() async {
|
||||
await showAppChoiceMenu<void>(
|
||||
context,
|
||||
width: 320,
|
||||
semanticLabel: 'Change thinking level',
|
||||
builder: (_) => ListView(
|
||||
key: const Key('chat-effort-menu'),
|
||||
shrinkWrap: true,
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.fromLTRB(16, 0, 16, 8),
|
||||
child: Text(
|
||||
chatEffortNote(running: widget.running),
|
||||
key: const Key('chat-effort-note'),
|
||||
style: Theme.of(context).textTheme.bodySmall,
|
||||
),
|
||||
),
|
||||
),
|
||||
for (final level in _state.levels)
|
||||
MenuItemButton(
|
||||
key: ValueKey<String>('chat-effort-option-${level.id}'),
|
||||
trailingIcon: level.id == _state.current
|
||||
? const Icon(Icons.check)
|
||||
: null,
|
||||
onPressed: () => unawaited(_chooseFromMenu(level)),
|
||||
child: level.description.isEmpty
|
||||
? Text(level.name)
|
||||
: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Text(level.name),
|
||||
Text(
|
||||
level.description,
|
||||
style: Theme.of(context).textTheme.bodySmall,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
builder: (context, menu, _) => Semantics(
|
||||
container: true,
|
||||
button: true,
|
||||
label: 'Change thinking level, currently ${_state.currentName}',
|
||||
onTap: () => menu.isOpen ? menu.close() : menu.open(),
|
||||
child: ExcludeSemantics(
|
||||
child: Tooltip(
|
||||
message: 'Change thinking level (currently ${_state.currentName})',
|
||||
child: TextButton(
|
||||
key: key,
|
||||
style: chatBarTextButtonStyle(context),
|
||||
onPressed: () => menu.isOpen ? menu.close() : menu.open(),
|
||||
child: content,
|
||||
for (final level in _state.levels)
|
||||
AppChoiceMenuItem(
|
||||
key: ValueKey<String>('chat-effort-option-${level.id}'),
|
||||
selected: level.id == _state.current,
|
||||
onTap: () => unawaited(_chooseFromMenu(level)),
|
||||
child: level.description.isEmpty
|
||||
? Text(level.name)
|
||||
: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Text(level.name),
|
||||
Text(
|
||||
level.description,
|
||||
style: Theme.of(context).textTheme.bodySmall,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -249,17 +249,23 @@ class _ChatModePickerState extends State<_ChatModePicker> {
|
||||
)
|
||||
else
|
||||
for (final mode in modes)
|
||||
ListTile(
|
||||
AppChoiceMenuItem(
|
||||
key: ValueKey<String>('chat-mode-option-${mode.id}'),
|
||||
enabled: !_busy,
|
||||
title: Text(mode.name),
|
||||
subtitle: mode.description.isEmpty
|
||||
? null
|
||||
: Text(mode.description),
|
||||
trailing: mode.id == _current
|
||||
? Icon(Icons.check, color: theme.colorScheme.primary)
|
||||
: null,
|
||||
onTap: () => _choose(mode),
|
||||
selected: mode.id == _current,
|
||||
onTap: _busy ? null : () => _choose(mode),
|
||||
child: mode.description.isEmpty
|
||||
? Text(mode.name)
|
||||
: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Text(mode.name),
|
||||
Text(
|
||||
mode.description,
|
||||
style: theme.textTheme.bodySmall,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
@@ -4,6 +4,7 @@ import 'package:flutter/material.dart';
|
||||
|
||||
import '../../../core/api_gateway.dart';
|
||||
import '../../../core/error_reason.dart';
|
||||
import '../../../ui/adaptive/app_popups.dart';
|
||||
import '../data/chat_repository.dart';
|
||||
import 'chat_models.dart';
|
||||
|
||||
@@ -22,7 +23,6 @@ class ChatModelChooser extends StatefulWidget {
|
||||
required this.backend,
|
||||
required this.currentProvider,
|
||||
required this.currentModel,
|
||||
required this.cupertino,
|
||||
required this.onAccepted,
|
||||
});
|
||||
|
||||
@@ -31,7 +31,6 @@ class ChatModelChooser extends StatefulWidget {
|
||||
final String backend;
|
||||
final String currentProvider;
|
||||
final String currentModel;
|
||||
final bool cupertino;
|
||||
final ValueChanged<ChatModelSelection> onAccepted;
|
||||
|
||||
@override
|
||||
@@ -92,6 +91,10 @@ class _ChatModelChooserState extends State<ChatModelChooser> {
|
||||
|
||||
Future<void> _choose(JsonMap model) async {
|
||||
if (_busy) return;
|
||||
if (_isCurrent(model)) {
|
||||
Navigator.of(context).pop();
|
||||
return;
|
||||
}
|
||||
setState(() {
|
||||
_busy = true;
|
||||
_error = null;
|
||||
@@ -147,95 +150,105 @@ class _ChatModelChooserState extends State<ChatModelChooser> {
|
||||
final secondary = theme.colorScheme.onSurfaceVariant;
|
||||
final matches = filterChatModels(_models, _search.text);
|
||||
final needle = _search.text.trim();
|
||||
return SimpleDialog(
|
||||
key: const Key('chat-model-chooser'),
|
||||
title: const Text('Change model'),
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsetsDirectional.fromSTEB(24, 0, 24, 8),
|
||||
child: Text(
|
||||
chatModelSelectionNote(widget.backend),
|
||||
style: theme.textTheme.bodySmall?.copyWith(color: secondary),
|
||||
),
|
||||
),
|
||||
if (_loading)
|
||||
Padding(
|
||||
padding: const EdgeInsetsDirectional.fromSTEB(24, 8, 24, 8),
|
||||
child: Row(
|
||||
children: [
|
||||
const CircularProgressIndicator(),
|
||||
const SizedBox(width: 12),
|
||||
const Expanded(child: Text('Loading models…')),
|
||||
],
|
||||
return SafeArea(
|
||||
child: SingleChildScrollView(
|
||||
key: const Key('chat-model-chooser'),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
const Padding(
|
||||
padding: EdgeInsets.fromLTRB(16, 0, 16, 8),
|
||||
child: Text('Change model'),
|
||||
),
|
||||
)
|
||||
else if (_error != null)
|
||||
Padding(
|
||||
padding: const EdgeInsetsDirectional.fromSTEB(24, 0, 24, 8),
|
||||
child: Text(
|
||||
_error!,
|
||||
key: const Key('chat-model-error'),
|
||||
style: theme.textTheme.bodyMedium?.copyWith(
|
||||
color: theme.colorScheme.error,
|
||||
),
|
||||
),
|
||||
)
|
||||
else if (_models.isEmpty)
|
||||
Padding(
|
||||
padding: const EdgeInsetsDirectional.fromSTEB(24, 0, 24, 8),
|
||||
child: Text(
|
||||
'No models are available for this chat.',
|
||||
style: theme.textTheme.bodyMedium?.copyWith(color: secondary),
|
||||
),
|
||||
)
|
||||
else ...[
|
||||
Padding(
|
||||
padding: const EdgeInsetsDirectional.fromSTEB(24, 0, 24, 8),
|
||||
child: TextField(
|
||||
key: const Key('chat-model-search'),
|
||||
controller: _search,
|
||||
onChanged: (_) => setState(() {}),
|
||||
decoration: const InputDecoration(
|
||||
prefixIcon: Icon(Icons.search),
|
||||
hintText: 'Search models',
|
||||
),
|
||||
),
|
||||
),
|
||||
for (final model in matches)
|
||||
SimpleDialogOption(
|
||||
key: _optionKey(model),
|
||||
onPressed: _busy ? null : () => _choose(model),
|
||||
child: _optionRow(context, model),
|
||||
),
|
||||
if (matches.isEmpty && needle.isNotEmpty)
|
||||
Padding(
|
||||
padding: const EdgeInsetsDirectional.fromSTEB(24, 0, 24, 8),
|
||||
padding: const EdgeInsetsDirectional.fromSTEB(16, 0, 16, 8),
|
||||
child: Text(
|
||||
'No models match "$needle".',
|
||||
key: const Key('chat-model-no-match'),
|
||||
style: theme.textTheme.bodyMedium?.copyWith(color: secondary),
|
||||
chatModelSelectionNote(widget.backend),
|
||||
style: theme.textTheme.bodySmall?.copyWith(color: secondary),
|
||||
),
|
||||
),
|
||||
],
|
||||
Padding(
|
||||
padding: const EdgeInsetsDirectional.fromSTEB(16, 4, 16, 8),
|
||||
child: Align(
|
||||
alignment: AlignmentDirectional.centerEnd,
|
||||
child: TextButton(
|
||||
key: const Key('chat-model-cancel'),
|
||||
onPressed: () => Navigator.of(context).pop(),
|
||||
child: const Text('Cancel'),
|
||||
if (_loading)
|
||||
Padding(
|
||||
padding: const EdgeInsetsDirectional.fromSTEB(16, 8, 16, 8),
|
||||
child: Row(
|
||||
children: [
|
||||
const CircularProgressIndicator(),
|
||||
const SizedBox(width: 12),
|
||||
const Expanded(child: Text('Loading models…')),
|
||||
],
|
||||
),
|
||||
)
|
||||
else if (_error != null)
|
||||
Padding(
|
||||
padding: const EdgeInsetsDirectional.fromSTEB(16, 0, 16, 8),
|
||||
child: Text(
|
||||
_error!,
|
||||
key: const Key('chat-model-error'),
|
||||
style: theme.textTheme.bodyMedium?.copyWith(
|
||||
color: theme.colorScheme.error,
|
||||
),
|
||||
),
|
||||
)
|
||||
else if (_models.isEmpty)
|
||||
Padding(
|
||||
padding: const EdgeInsetsDirectional.fromSTEB(16, 0, 16, 8),
|
||||
child: Text(
|
||||
'No models are available for this chat.',
|
||||
style: theme.textTheme.bodyMedium?.copyWith(color: secondary),
|
||||
),
|
||||
)
|
||||
else ...[
|
||||
Padding(
|
||||
padding: const EdgeInsetsDirectional.fromSTEB(16, 0, 16, 8),
|
||||
child: TextField(
|
||||
key: const Key('chat-model-search'),
|
||||
controller: _search,
|
||||
onChanged: (_) => setState(() {}),
|
||||
decoration: const InputDecoration(
|
||||
prefixIcon: Icon(Icons.search),
|
||||
hintText: 'Search models',
|
||||
),
|
||||
),
|
||||
),
|
||||
for (final model in matches)
|
||||
AppChoiceMenuItem(
|
||||
key: _optionKey(model),
|
||||
selected: _isCurrent(model),
|
||||
onTap: _busy ? null : () => _choose(model),
|
||||
child: _optionRow(context, model),
|
||||
),
|
||||
if (matches.isEmpty && needle.isNotEmpty)
|
||||
Padding(
|
||||
padding: const EdgeInsetsDirectional.fromSTEB(16, 0, 16, 8),
|
||||
child: Text(
|
||||
'No models match "$needle".',
|
||||
key: const Key('chat-model-no-match'),
|
||||
style: theme.textTheme.bodyMedium?.copyWith(
|
||||
color: secondary,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
Padding(
|
||||
padding: const EdgeInsetsDirectional.fromSTEB(16, 4, 16, 8),
|
||||
child: Align(
|
||||
alignment: AlignmentDirectional.centerEnd,
|
||||
child: TextButton(
|
||||
key: const Key('chat-model-cancel'),
|
||||
onPressed: () => Navigator.of(context).pop(),
|
||||
child: const Text('Cancel'),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _optionRow(BuildContext context, JsonMap model) {
|
||||
final selected = _isCurrent(model);
|
||||
final secondary = Theme.of(context).colorScheme.onSurfaceVariant;
|
||||
final accent = Theme.of(context).colorScheme.primary;
|
||||
final provider = '${model['provider'] ?? ''}'.trim();
|
||||
return Semantics(
|
||||
selected: selected,
|
||||
@@ -252,7 +265,7 @@ class _ChatModelChooserState extends State<ChatModelChooser> {
|
||||
],
|
||||
),
|
||||
),
|
||||
if (selected) Icon(Icons.check, color: accent),
|
||||
// The shared menu row supplies the check mark.
|
||||
],
|
||||
),
|
||||
);
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../../../core/api_gateway.dart';
|
||||
import '../../../ui/adaptive/app_popups.dart';
|
||||
import 'chat_bar_control_style.dart';
|
||||
import 'chat_model_chooser.dart';
|
||||
import 'chat_models.dart';
|
||||
@@ -79,10 +80,14 @@ class _ChatModelControlState extends State<ChatModelControl> {
|
||||
backend: '${widget.session['backend'] ?? ''}'.trim(),
|
||||
currentProvider: _provider,
|
||||
currentModel: _model,
|
||||
cupertino: false,
|
||||
onAccepted: _accept,
|
||||
);
|
||||
await showDialog<void>(context: context, builder: (_) => chooser);
|
||||
await showAppChoiceMenu<void>(
|
||||
context,
|
||||
width: 420,
|
||||
semanticLabel: 'Change model',
|
||||
builder: (_) => chooser,
|
||||
);
|
||||
}
|
||||
|
||||
void _accept(ChatModelSelection applied) {
|
||||
|
||||
@@ -1470,12 +1470,7 @@ class _ChatThreadViewState extends State<ChatThreadView> {
|
||||
);
|
||||
|
||||
void _runShellFromMenu() => unawaited(
|
||||
runChatShellFromMenu(
|
||||
context,
|
||||
_shellRuns,
|
||||
cupertino: false,
|
||||
showNotice: _showCommandNotice,
|
||||
),
|
||||
runChatShellFromMenu(context, _shellRuns, showNotice: _showCommandNotice),
|
||||
);
|
||||
|
||||
void _dismissFinishedShellRuns() => unawaited(
|
||||
@@ -1483,7 +1478,6 @@ class _ChatThreadViewState extends State<ChatThreadView> {
|
||||
context,
|
||||
_shellRuns,
|
||||
_shellRuns.finishedIds,
|
||||
cupertino: false,
|
||||
onRefused: (refusal) => _showCommandNotice(
|
||||
"Couldn't dismiss the commands: $refusal",
|
||||
failed: true,
|
||||
|
||||
@@ -22,13 +22,11 @@ class ChatShellCardActions extends StatefulWidget {
|
||||
super.key,
|
||||
required this.run,
|
||||
required this.controller,
|
||||
required this.cupertino,
|
||||
required this.onFullScreen,
|
||||
});
|
||||
|
||||
final ChatShellRun run;
|
||||
final ChatShellRunsController controller;
|
||||
final bool cupertino;
|
||||
final VoidCallback onFullScreen;
|
||||
|
||||
@override
|
||||
|
||||
@@ -10,13 +10,8 @@ const String chatShellDismissAllLabel = 'Dismiss all finished commands';
|
||||
|
||||
/// The card's Dismiss button, offered once the command has finished.
|
||||
class ChatShellDismissButton extends StatelessWidget {
|
||||
const ChatShellDismissButton({
|
||||
super.key,
|
||||
required this.cupertino,
|
||||
required this.onPressed,
|
||||
});
|
||||
const ChatShellDismissButton({super.key, required this.onPressed});
|
||||
|
||||
final bool cupertino;
|
||||
final VoidCallback onPressed;
|
||||
|
||||
@override
|
||||
@@ -48,7 +43,6 @@ Future<void> dismissChatShellRuns(
|
||||
BuildContext context,
|
||||
ChatShellRunsController controller,
|
||||
List<String> ids, {
|
||||
required bool cupertino,
|
||||
void Function(String refusal)? onRefused,
|
||||
}) async {
|
||||
if (ids.isEmpty) return;
|
||||
|
||||
@@ -36,7 +36,7 @@ class ChatShellHistoryChip extends StatelessWidget {
|
||||
);
|
||||
}
|
||||
|
||||
Future<void> _open(BuildContext context, bool cupertino) {
|
||||
Future<void> _open(BuildContext context, bool _) {
|
||||
// A dialog in the tiled app on a wide layout. A phone keeps the
|
||||
// full-screen page, and a floating window opens it as a page of that
|
||||
// window, so what it opens next (a diff, a command's output) stays in
|
||||
|
||||
@@ -17,13 +17,9 @@ Future<void> openChatShellHistoryOutput(
|
||||
BuildContext context, {
|
||||
required ChatShellRunsController controller,
|
||||
required String runId,
|
||||
required bool cupertino,
|
||||
}) {
|
||||
Widget page(BuildContext _) => ChatShellHistoryOutputPage(
|
||||
controller: controller,
|
||||
runId: runId,
|
||||
cupertino: cupertino,
|
||||
);
|
||||
Widget page(BuildContext _) =>
|
||||
ChatShellHistoryOutputPage(controller: controller, runId: runId);
|
||||
return Navigator.push<void>(context, MaterialPageRoute<void>(builder: page));
|
||||
}
|
||||
|
||||
@@ -35,12 +31,10 @@ class ChatShellHistoryOutputPage extends StatefulWidget {
|
||||
super.key,
|
||||
required this.controller,
|
||||
required this.runId,
|
||||
required this.cupertino,
|
||||
});
|
||||
|
||||
final ChatShellRunsController controller;
|
||||
final String runId;
|
||||
final bool cupertino;
|
||||
|
||||
@override
|
||||
State<ChatShellHistoryOutputPage> createState() =>
|
||||
@@ -138,7 +132,7 @@ class _ChatShellHistoryOutputPageState
|
||||
runSpacing: 4,
|
||||
crossAxisAlignment: WrapCrossAlignment.center,
|
||||
children: [
|
||||
ChatShellStatus(run: full, cupertino: false),
|
||||
ChatShellStatus(run: full),
|
||||
if (full.directory.isNotEmpty)
|
||||
Text(
|
||||
full.directory,
|
||||
@@ -154,11 +148,7 @@ class _ChatShellHistoryOutputPageState
|
||||
key: const Key('chat-shell-output-empty'),
|
||||
style: chatCardSecondaryStyle(context, false),
|
||||
)
|
||||
: ChatShellTerminalView(
|
||||
session: session,
|
||||
cupertino: false,
|
||||
fill: true,
|
||||
),
|
||||
: ChatShellTerminalView(session: session, fill: true),
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
ListenableBuilder(
|
||||
|
||||
@@ -118,7 +118,7 @@ class _ChatShellHistoryViewState extends State<ChatShellHistoryView> {
|
||||
runSpacing: 4,
|
||||
crossAxisAlignment: WrapCrossAlignment.center,
|
||||
children: [
|
||||
ChatShellStatus(run: run, cupertino: false),
|
||||
ChatShellStatus(run: run),
|
||||
Text(chatShellRunTime(context, run.startedAt), style: secondary),
|
||||
if (run.purged) Text(chatShellOutputNotKept, style: secondary),
|
||||
if (refusal != null)
|
||||
@@ -151,7 +151,6 @@ class _ChatShellHistoryViewState extends State<ChatShellHistoryView> {
|
||||
context,
|
||||
controller: widget.controller,
|
||||
runId: run.id,
|
||||
cupertino: false,
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
@@ -6,9 +6,7 @@ import 'chat_shell_command.dart';
|
||||
/// Shown inside the composer while its draft starts with `!`: the draft is a
|
||||
/// shell command for this chat's folder, not a message to the agent.
|
||||
class ChatShellModeIndicator extends StatelessWidget {
|
||||
const ChatShellModeIndicator({super.key, required this.cupertino});
|
||||
|
||||
final bool cupertino;
|
||||
const ChatShellModeIndicator({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
|
||||
@@ -14,14 +14,12 @@ class ChatShellOutputView extends StatelessWidget {
|
||||
super.key,
|
||||
required this.run,
|
||||
required this.controller,
|
||||
required this.cupertino,
|
||||
required this.viewKey,
|
||||
required this.fullScreen,
|
||||
});
|
||||
|
||||
final ChatShellRun run;
|
||||
final ChatShellRunsController controller;
|
||||
final bool cupertino;
|
||||
|
||||
/// Replaced when the full-screen view closes, so the card's view sizes the
|
||||
/// terminal to itself again.
|
||||
@@ -47,7 +45,6 @@ class ChatShellOutputView extends StatelessWidget {
|
||||
ChatShellTerminalView(
|
||||
key: viewKey,
|
||||
session: session,
|
||||
cupertino: false,
|
||||
autoResize: !fullScreen,
|
||||
),
|
||||
if (session.live && !fullScreen)
|
||||
@@ -55,7 +52,6 @@ class ChatShellOutputView extends StatelessWidget {
|
||||
padding: const EdgeInsets.only(top: 8),
|
||||
child: ChatShellTerminalKeys(
|
||||
session: session,
|
||||
cupertino: false,
|
||||
field: chatShellTouchFirst(),
|
||||
),
|
||||
),
|
||||
|
||||
@@ -46,7 +46,6 @@ class _ChatShellRunCardState extends State<ChatShellRunCard> {
|
||||
context,
|
||||
controller: widget.controller,
|
||||
runId: widget.runId,
|
||||
cupertino: false,
|
||||
);
|
||||
if (!mounted) return;
|
||||
setState(() {
|
||||
@@ -113,15 +112,12 @@ class _ChatShellRunCardState extends State<ChatShellRunCard> {
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 8),
|
||||
ChatShellStatus(run: run, cupertino: false),
|
||||
ChatShellStatus(run: run),
|
||||
if (!run.running)
|
||||
ChatShellDismissButton(
|
||||
cupertino: false,
|
||||
onPressed: () => unawaited(
|
||||
// A refusal brings the card back with the server's reason.
|
||||
dismissChatShellRuns(context, controller, [
|
||||
run.id,
|
||||
], cupertino: false),
|
||||
dismissChatShellRuns(context, controller, [run.id]),
|
||||
),
|
||||
),
|
||||
],
|
||||
@@ -130,7 +126,6 @@ class _ChatShellRunCardState extends State<ChatShellRunCard> {
|
||||
ChatShellOutputView(
|
||||
run: run,
|
||||
controller: controller,
|
||||
cupertino: false,
|
||||
viewKey: ValueKey<int>(_viewGeneration),
|
||||
fullScreen: _fullScreen,
|
||||
),
|
||||
@@ -146,7 +141,6 @@ class _ChatShellRunCardState extends State<ChatShellRunCard> {
|
||||
ChatShellCardActions(
|
||||
run: run,
|
||||
controller: controller,
|
||||
cupertino: false,
|
||||
onFullScreen: () => _openFullScreen(),
|
||||
),
|
||||
if (error != null)
|
||||
|
||||
@@ -5,18 +5,14 @@ import 'chat_shell_command.dart';
|
||||
|
||||
/// The chat actions menu's "Run command…": a small host dialog with one
|
||||
/// command field. Returns the trimmed command, or null when cancelled.
|
||||
Future<String?> showChatShellRunDialog(
|
||||
BuildContext context, {
|
||||
required bool cupertino,
|
||||
}) => showDialog<String>(
|
||||
context: context,
|
||||
builder: (_) => const ChatShellRunDialog(cupertino: false),
|
||||
);
|
||||
Future<String?> showChatShellRunDialog(BuildContext context) =>
|
||||
showDialog<String>(
|
||||
context: context,
|
||||
builder: (_) => const ChatShellRunDialog(),
|
||||
);
|
||||
|
||||
class ChatShellRunDialog extends StatefulWidget {
|
||||
const ChatShellRunDialog({super.key, required this.cupertino});
|
||||
|
||||
final bool cupertino;
|
||||
const ChatShellRunDialog({super.key});
|
||||
|
||||
@override
|
||||
State<ChatShellRunDialog> createState() => _ChatShellRunDialogState();
|
||||
|
||||
@@ -8,14 +8,9 @@ import 'chat_shell_run.dart';
|
||||
/// while it runs, then a status chip (exit code, stopped, interrupted) with
|
||||
/// how long it ran. The words carry the state; colour only repeats it.
|
||||
class ChatShellStatus extends StatelessWidget {
|
||||
const ChatShellStatus({
|
||||
super.key,
|
||||
required this.run,
|
||||
required this.cupertino,
|
||||
});
|
||||
const ChatShellStatus({super.key, required this.run});
|
||||
|
||||
final ChatShellRun run;
|
||||
final bool cupertino;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
|
||||
@@ -71,12 +71,10 @@ class ChatShellTerminalKeys extends StatefulWidget {
|
||||
const ChatShellTerminalKeys({
|
||||
super.key,
|
||||
required this.session,
|
||||
required this.cupertino,
|
||||
required this.field,
|
||||
});
|
||||
|
||||
final ChatShellTerminalSession session;
|
||||
final bool cupertino;
|
||||
final bool field;
|
||||
|
||||
@override
|
||||
|
||||
@@ -12,13 +12,9 @@ Future<void> openChatShellTerminalPage(
|
||||
BuildContext context, {
|
||||
required ChatShellRunsController controller,
|
||||
required String runId,
|
||||
required bool cupertino,
|
||||
}) {
|
||||
Widget page(BuildContext _) => ChatShellTerminalPage(
|
||||
controller: controller,
|
||||
runId: runId,
|
||||
cupertino: cupertino,
|
||||
);
|
||||
Widget page(BuildContext _) =>
|
||||
ChatShellTerminalPage(controller: controller, runId: runId);
|
||||
return Navigator.push<void>(context, MaterialPageRoute<void>(builder: page));
|
||||
}
|
||||
|
||||
@@ -27,12 +23,10 @@ class ChatShellTerminalPage extends StatelessWidget {
|
||||
super.key,
|
||||
required this.controller,
|
||||
required this.runId,
|
||||
required this.cupertino,
|
||||
});
|
||||
|
||||
final ChatShellRunsController controller;
|
||||
final String runId;
|
||||
final bool cupertino;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@@ -58,7 +52,6 @@ class ChatShellTerminalPage extends StatelessWidget {
|
||||
Expanded(
|
||||
child: ChatShellTerminalView(
|
||||
session: session,
|
||||
cupertino: false,
|
||||
fill: true,
|
||||
autofocus: true,
|
||||
),
|
||||
@@ -68,7 +61,6 @@ class ChatShellTerminalPage extends StatelessWidget {
|
||||
padding: const EdgeInsets.only(top: 8),
|
||||
child: ChatShellTerminalKeys(
|
||||
session: session,
|
||||
cupertino: false,
|
||||
field: chatShellTouchFirst(),
|
||||
),
|
||||
),
|
||||
|
||||
@@ -10,7 +10,7 @@ import '../conversation/chat_card_styles.dart';
|
||||
/// background, the body text colour as foreground, the accent as cursor and
|
||||
/// selection. The sixteen ANSI colours are the emulator's standard palette,
|
||||
/// darkened on a light surface so coloured output stays readable.
|
||||
TerminalTheme chatShellTerminalTheme(BuildContext context, bool cupertino) {
|
||||
TerminalTheme chatShellTerminalTheme(BuildContext context) {
|
||||
final dark = Theme.of(context).brightness == Brightness.dark;
|
||||
final background = chatCardFillColor(context, false);
|
||||
final foreground = Theme.of(context).colorScheme.onSurface;
|
||||
@@ -54,7 +54,7 @@ TerminalTheme chatShellTerminalTheme(BuildContext context, bool cupertino) {
|
||||
}
|
||||
|
||||
/// The terminal's text: the host's monospace family at the card body size.
|
||||
TerminalStyle chatShellTerminalStyle(BuildContext context, bool cupertino) {
|
||||
TerminalStyle chatShellTerminalStyle(BuildContext context) {
|
||||
final body = chatCardBodyStyle(context, false) ?? const TextStyle();
|
||||
return TerminalStyle(
|
||||
fontFamily: appMonospaceFamily,
|
||||
|
||||
@@ -74,14 +74,12 @@ class ChatShellTerminalView extends StatefulWidget {
|
||||
const ChatShellTerminalView({
|
||||
super.key,
|
||||
required this.session,
|
||||
required this.cupertino,
|
||||
this.fill = false,
|
||||
this.autofocus = false,
|
||||
this.autoResize = true,
|
||||
});
|
||||
|
||||
final ChatShellTerminalSession session;
|
||||
final bool cupertino;
|
||||
final bool fill;
|
||||
final bool autofocus;
|
||||
|
||||
@@ -155,7 +153,7 @@ class _ChatShellTerminalViewState extends State<ChatShellTerminalView> {
|
||||
Widget build(BuildContext context) {
|
||||
final session = widget.session;
|
||||
final live = session.live;
|
||||
final style = chatShellTerminalStyle(context, false);
|
||||
final style = chatShellTerminalStyle(context);
|
||||
const padding = EdgeInsets.all(8);
|
||||
Widget view = Semantics(
|
||||
identifier: 'chat-shell-terminal',
|
||||
@@ -168,7 +166,7 @@ class _ChatShellTerminalViewState extends State<ChatShellTerminalView> {
|
||||
focusNode: _focus,
|
||||
autofocus: widget.autofocus && live,
|
||||
autoResize: widget.autoResize,
|
||||
theme: chatShellTerminalTheme(context, false),
|
||||
theme: chatShellTerminalTheme(context),
|
||||
textStyle: style,
|
||||
padding: padding,
|
||||
readOnly: !live,
|
||||
|
||||
@@ -22,10 +22,9 @@ Widget chatShellRunMenuAction({required VoidCallback onPressed}) =>
|
||||
Future<void> runChatShellFromMenu(
|
||||
BuildContext context,
|
||||
ChatShellRunsController controller, {
|
||||
required bool cupertino,
|
||||
required void Function(String text, {bool failed}) showNotice,
|
||||
}) async {
|
||||
final command = await showChatShellRunDialog(context, cupertino: cupertino);
|
||||
final command = await showChatShellRunDialog(context);
|
||||
if (command == null) return;
|
||||
final refusal = await controller.start(command);
|
||||
if (refusal != null) {
|
||||
|
||||
@@ -16,7 +16,7 @@ class ChatCodeHover {
|
||||
Object token,
|
||||
String text,
|
||||
Offset pointer, {
|
||||
required bool cupertino,
|
||||
bool? cupertino,
|
||||
}) {
|
||||
if (_disposed) return;
|
||||
hide();
|
||||
@@ -64,11 +64,7 @@ class ChatCodeHover {
|
||||
child: Material(
|
||||
elevation: 3,
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
child: ChatCopyButton(
|
||||
text: text,
|
||||
cupertino: false,
|
||||
showLabel: true,
|
||||
),
|
||||
child: ChatCopyButton(text: text, showLabel: true),
|
||||
),
|
||||
),
|
||||
),
|
||||
@@ -132,12 +128,12 @@ class ChatCodeCopyRegion extends StatefulWidget {
|
||||
const ChatCodeCopyRegion({
|
||||
super.key,
|
||||
required this.code,
|
||||
required this.cupertino,
|
||||
this.cupertino,
|
||||
required this.label,
|
||||
required this.child,
|
||||
});
|
||||
final String code;
|
||||
final bool cupertino;
|
||||
final bool? cupertino;
|
||||
final Widget label, child;
|
||||
@override
|
||||
State<ChatCodeCopyRegion> createState() => _ChatCodeCopyRegionState();
|
||||
@@ -170,7 +166,6 @@ class _ChatCodeCopyRegionState extends State<ChatCodeCopyRegion> {
|
||||
child: SelectionContainer.disabled(
|
||||
child: ChatCopyButton(
|
||||
text: widget.code,
|
||||
cupertino: widget.cupertino,
|
||||
showLabel: true,
|
||||
),
|
||||
),
|
||||
|
||||
@@ -12,15 +12,9 @@ const String chatCopiedLabel = 'Copied';
|
||||
/// the clipboard. It shows a check for a moment after copying, so the operator
|
||||
/// sees the copy landed without a separate toast.
|
||||
class ChatCopyButton extends StatefulWidget {
|
||||
const ChatCopyButton({
|
||||
super.key,
|
||||
required this.text,
|
||||
required this.cupertino,
|
||||
this.showLabel = false,
|
||||
});
|
||||
const ChatCopyButton({super.key, required this.text, this.showLabel = false});
|
||||
|
||||
final String text;
|
||||
final bool cupertino;
|
||||
final bool showLabel;
|
||||
|
||||
@override
|
||||
|
||||
@@ -202,7 +202,6 @@ class _ChatMarkdownViewState extends State<ChatMarkdownView> {
|
||||
);
|
||||
return ChatCodeCopyRegion(
|
||||
code: code,
|
||||
cupertino: false,
|
||||
label: Text(markdownCodeLabel(language), style: labelStyle),
|
||||
child: DecoratedBox(
|
||||
decoration: BoxDecoration(color: _codeFill(context)),
|
||||
@@ -274,13 +273,7 @@ class _ChatMarkdownViewState extends State<ChatMarkdownView> {
|
||||
),
|
||||
onEnter: (event) {
|
||||
if (_route?.isCurrent != false) {
|
||||
_codeHover.show(
|
||||
context,
|
||||
token,
|
||||
text,
|
||||
event.position,
|
||||
cupertino: false,
|
||||
);
|
||||
_codeHover.show(context, token, text, event.position);
|
||||
}
|
||||
},
|
||||
onExit: (_) => _codeHover.scheduleHide(token),
|
||||
|
||||
@@ -31,13 +31,8 @@ Color chatBubbleFill(BuildContext context, Color base) {
|
||||
/// in the host's own surface roles. The agent's turn has no bubble at all; its
|
||||
/// text sits on the page, so only the operator's words are enclosed.
|
||||
class ChatUserBubble extends StatelessWidget {
|
||||
const ChatUserBubble({
|
||||
super.key,
|
||||
required this.cupertino,
|
||||
required this.child,
|
||||
});
|
||||
const ChatUserBubble({super.key, required this.child});
|
||||
|
||||
final bool cupertino;
|
||||
final Widget child;
|
||||
|
||||
static const BorderRadius _radius = BorderRadius.all(Radius.circular(20));
|
||||
@@ -65,13 +60,8 @@ class ChatUserBubble extends StatelessWidget {
|
||||
/// The agent's answer drawn straight on the page. Material keeps a transparent
|
||||
/// surface so disclosure ListTiles still paint their ink.
|
||||
class ChatAgentSurface extends StatelessWidget {
|
||||
const ChatAgentSurface({
|
||||
super.key,
|
||||
required this.cupertino,
|
||||
required this.child,
|
||||
});
|
||||
const ChatAgentSurface({super.key, required this.child});
|
||||
|
||||
final bool cupertino;
|
||||
final Widget child;
|
||||
|
||||
@override
|
||||
@@ -81,7 +71,7 @@ class ChatAgentSurface extends StatelessWidget {
|
||||
|
||||
/// The transcript's reading text: the host's large body role, so answers read
|
||||
/// at a comfortable size and still follow the operator's text scaling.
|
||||
TextStyle? chatMessageTextStyle(BuildContext context, bool cupertino) =>
|
||||
TextStyle? chatMessageTextStyle(BuildContext context, [bool? cupertino]) =>
|
||||
Theme.of(context).textTheme.bodyLarge;
|
||||
|
||||
/// The empty-line gap between two paragraphs of a reply: about one line of
|
||||
|
||||
@@ -87,7 +87,7 @@ class ChatMessageView extends StatelessWidget {
|
||||
: _agentRow(
|
||||
context,
|
||||
content,
|
||||
ChatAgentSurface(cupertino: false, child: body),
|
||||
ChatAgentSurface(child: body),
|
||||
gutter,
|
||||
),
|
||||
),
|
||||
@@ -117,7 +117,7 @@ class ChatMessageView extends StatelessWidget {
|
||||
);
|
||||
final hasTimestamp = chatMessageCreatedAt(_userMessage) != null;
|
||||
if (thumbnails.isEmpty && footer.isEmpty && !hasTimestamp) {
|
||||
return ChatUserBubble(cupertino: false, child: body);
|
||||
return ChatUserBubble(child: body);
|
||||
}
|
||||
return Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
@@ -132,7 +132,7 @@ class ChatMessageView extends StatelessWidget {
|
||||
if (thumbnails.isNotEmpty && content.isNotEmpty)
|
||||
const SizedBox(height: 6),
|
||||
if (content.isNotEmpty || thumbnails.isEmpty)
|
||||
ChatUserBubble(cupertino: false, child: body),
|
||||
ChatUserBubble(child: body),
|
||||
if (footer.isNotEmpty) ...[
|
||||
const SizedBox(height: 2),
|
||||
Wrap(
|
||||
@@ -181,9 +181,7 @@ class ChatMessageView extends StatelessWidget {
|
||||
double gutter,
|
||||
) {
|
||||
final copyText = row['streaming'] == true ? '' : _answerText(_partsOf(row));
|
||||
final copy = copyText.isEmpty
|
||||
? null
|
||||
: ChatCopyButton(text: copyText, cupertino: false);
|
||||
final copy = copyText.isEmpty ? null : ChatCopyButton(text: copyText);
|
||||
if (gutter <= 0) return _agentTurn(context, content, answer, copy);
|
||||
return ChatCopyGutterRow(
|
||||
width: gutter,
|
||||
|
||||
@@ -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) =>
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../../../../ui/input/app_search_field.dart';
|
||||
@@ -19,20 +18,19 @@ class ScheduleRefreshAction extends StatelessWidget {
|
||||
const ScheduleRefreshAction({
|
||||
super.key,
|
||||
required this.controller,
|
||||
required this.cupertino,
|
||||
this.cupertino,
|
||||
required this.onRefresh,
|
||||
});
|
||||
|
||||
final SchedulesController controller;
|
||||
final bool cupertino;
|
||||
final bool? cupertino;
|
||||
final VoidCallback onRefresh;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) => BarIconButton(
|
||||
key: controller.isLoading ? null : scheduleRefreshKey,
|
||||
cupertino: false,
|
||||
icon: Icons.refresh,
|
||||
cupertinoIcon: CupertinoIcons.refresh,
|
||||
cupertinoIcon: Icons.refresh,
|
||||
label: 'Refresh schedules',
|
||||
busy: controller.isLoading,
|
||||
busyLabel: 'Refreshing schedules',
|
||||
@@ -51,13 +49,13 @@ class ScheduleListToolbar extends StatelessWidget {
|
||||
super.key,
|
||||
required this.controller,
|
||||
required this.searchController,
|
||||
required this.cupertino,
|
||||
this.cupertino,
|
||||
this.onRefresh,
|
||||
});
|
||||
|
||||
final SchedulesController controller;
|
||||
final TextEditingController searchController;
|
||||
final bool cupertino;
|
||||
final bool? cupertino;
|
||||
final VoidCallback? onRefresh;
|
||||
|
||||
@override
|
||||
@@ -69,7 +67,6 @@ class ScheduleListToolbar extends StatelessWidget {
|
||||
final refresh = switch (onRefresh) {
|
||||
final refresh? => ScheduleRefreshAction(
|
||||
controller: controller,
|
||||
cupertino: false,
|
||||
onRefresh: refresh,
|
||||
),
|
||||
null => null,
|
||||
@@ -119,7 +116,6 @@ class ScheduleListToolbar extends StatelessWidget {
|
||||
Widget _search(BuildContext context) => AppSearchField(
|
||||
fieldKey: scheduleSearchFieldKey,
|
||||
controller: searchController,
|
||||
cupertino: false,
|
||||
placeholder: 'Search schedules',
|
||||
onChanged: controller.setQuery,
|
||||
onCleared: controller.clearQuery,
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../../../ui/input/app_search_field.dart';
|
||||
@@ -21,7 +20,7 @@ const searchTokenHint =
|
||||
class SearchBarControls extends StatelessWidget {
|
||||
const SearchBarControls({
|
||||
super.key,
|
||||
required this.cupertino,
|
||||
this.cupertino,
|
||||
required this.text,
|
||||
required this.kind,
|
||||
required this.onChanged,
|
||||
@@ -32,7 +31,7 @@ class SearchBarControls extends StatelessWidget {
|
||||
this.focusNode,
|
||||
});
|
||||
|
||||
final bool cupertino;
|
||||
final bool? cupertino;
|
||||
final TextEditingController text;
|
||||
final SearchKind kind;
|
||||
final ValueChanged<String> onChanged;
|
||||
@@ -59,7 +58,6 @@ class SearchBarControls extends StatelessWidget {
|
||||
autofocus: autofocus,
|
||||
focusNode: focusNode,
|
||||
inBar: true,
|
||||
cupertino: false,
|
||||
placeholder: 'Search pipelines, runs, artifacts and chats',
|
||||
onChanged: onChanged,
|
||||
onSubmitted: (_) => onSubmitted(),
|
||||
@@ -67,14 +65,13 @@ class SearchBarControls extends StatelessWidget {
|
||||
),
|
||||
),
|
||||
),
|
||||
SearchKindButton(cupertino: false, kind: kind, onSelected: onKind),
|
||||
SearchKindButton(kind: kind, onSelected: onKind),
|
||||
BarIconButton(
|
||||
key: searchHelpKey,
|
||||
cupertino: false,
|
||||
icon: Icons.info_outline,
|
||||
cupertinoIcon: CupertinoIcons.info_circle,
|
||||
cupertinoIcon: Icons.info_outline,
|
||||
label: 'Search syntax',
|
||||
onPressed: () => showSearchHelp(context, cupertino: false),
|
||||
onPressed: () => showSearchHelp(context),
|
||||
),
|
||||
],
|
||||
),
|
||||
@@ -86,12 +83,12 @@ class SearchBarControls extends StatelessWidget {
|
||||
class SearchKindButton extends StatelessWidget {
|
||||
const SearchKindButton({
|
||||
super.key,
|
||||
required this.cupertino,
|
||||
this.cupertino,
|
||||
required this.kind,
|
||||
required this.onSelected,
|
||||
});
|
||||
|
||||
final bool cupertino;
|
||||
final bool? cupertino;
|
||||
final SearchKind kind;
|
||||
final ValueChanged<SearchKind> onSelected;
|
||||
|
||||
@@ -131,7 +128,7 @@ class SearchKindButton extends StatelessWidget {
|
||||
}
|
||||
|
||||
/// The query syntax, on demand instead of a paragraph above the results.
|
||||
Future<void> showSearchHelp(BuildContext context, {required bool cupertino}) {
|
||||
Future<void> showSearchHelp(BuildContext context, {bool? cupertino}) {
|
||||
return showDialog<void>(
|
||||
context: context,
|
||||
builder: (context) => AlertDialog(
|
||||
|
||||
@@ -0,0 +1,114 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../../ui/adaptive/app_popups.dart';
|
||||
import 'keyboard_shortcuts_registry.dart';
|
||||
|
||||
const keyboardShortcutsLabel = 'Keyboard shortcuts';
|
||||
|
||||
Future<void> showKeyboardShortcutsHelp(BuildContext context) =>
|
||||
showAppDetails<void>(
|
||||
context,
|
||||
maxWidth: 640,
|
||||
builder: (_) => const KeyboardShortcutsHelp(),
|
||||
);
|
||||
|
||||
class KeyboardShortcutsHelp extends StatelessWidget {
|
||||
const KeyboardShortcutsHelp({super.key, this.registry});
|
||||
|
||||
final KeyboardShortcutRegistry? registry;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final entries = (registry ?? KeyboardShortcutRegistry.current()).entries;
|
||||
final content = Semantics(
|
||||
scopesRoute: true,
|
||||
namesRoute: true,
|
||||
explicitChildNodes: true,
|
||||
label: 'Keyboard shortcuts help',
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.fromLTRB(24, 8, 24, 24),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: Text(
|
||||
keyboardShortcutsLabel,
|
||||
style: Theme.of(context).textTheme.headlineSmall,
|
||||
),
|
||||
),
|
||||
IconButton(
|
||||
tooltip: 'Close keyboard shortcuts',
|
||||
onPressed: () => Navigator.of(context).pop(),
|
||||
icon: const Icon(Icons.close),
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
Text(
|
||||
'Shortcuts available in the current app and browser environment.',
|
||||
style: Theme.of(context).textTheme.bodyMedium,
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
for (final (index, entry) in entries.indexed) ...[
|
||||
if (index > 0) const Divider(height: 1),
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 12),
|
||||
child: _ShortcutRow(entry: entry),
|
||||
),
|
||||
],
|
||||
const SizedBox(height: 4),
|
||||
Text(
|
||||
'On macOS, Option is shown for Alt. Browsers can reserve system or tab shortcuts.',
|
||||
style: Theme.of(context).textTheme.bodySmall,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
// The desktop details dialog supplies its own bounded scroll view. The
|
||||
// narrow details sheet does not, so keep the help readable at large text
|
||||
// scales and on short phone screens there as well.
|
||||
return usesDesktopPopups(context)
|
||||
? content
|
||||
: SingleChildScrollView(child: content);
|
||||
}
|
||||
}
|
||||
|
||||
class _ShortcutRow extends StatelessWidget {
|
||||
const _ShortcutRow({required this.entry});
|
||||
|
||||
final KeyboardShortcutEntry entry;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) => Semantics(
|
||||
container: true,
|
||||
label:
|
||||
'${entry.action}: ${entry.keys}${entry.caveat == null ? '' : '. ${entry.caveat}'}',
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: [
|
||||
Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Expanded(child: Text(entry.action)),
|
||||
const SizedBox(width: 16),
|
||||
Flexible(
|
||||
child: Text(
|
||||
entry.keys,
|
||||
textAlign: TextAlign.end,
|
||||
style: const TextStyle(fontWeight: FontWeight.w600),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
if (entry.caveat case final caveat?) ...[
|
||||
const SizedBox(height: 4),
|
||||
Text(caveat, style: Theme.of(context).textTheme.bodySmall),
|
||||
],
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,92 @@
|
||||
import 'package:flutter/foundation.dart';
|
||||
|
||||
import '../chat/workspace/chat_center_stage_controller.dart';
|
||||
import '../chat/workspace/chat_float_shortcut.dart';
|
||||
import '../terminal/terminal_shortcuts.dart';
|
||||
import '../../shell/windows/window_shortcuts.dart';
|
||||
import '../../shell/shell_search_shortcut_labels.dart';
|
||||
|
||||
/// A shortcut entry shown in the in-app help. Keeping these entries together
|
||||
/// prevents the help page from inventing chords that the handlers do not use.
|
||||
class KeyboardShortcutEntry {
|
||||
const KeyboardShortcutEntry({
|
||||
required this.action,
|
||||
required this.keys,
|
||||
this.caveat,
|
||||
});
|
||||
|
||||
final String action;
|
||||
final String keys;
|
||||
final String? caveat;
|
||||
}
|
||||
|
||||
class KeyboardShortcutRegistry {
|
||||
const KeyboardShortcutRegistry({required this.platform, required this.web});
|
||||
|
||||
factory KeyboardShortcutRegistry.current() =>
|
||||
KeyboardShortcutRegistry(platform: defaultTargetPlatform, web: kIsWeb);
|
||||
|
||||
final TargetPlatform platform;
|
||||
final bool web;
|
||||
|
||||
bool get _apple =>
|
||||
platform == TargetPlatform.macOS || platform == TargetPlatform.iOS;
|
||||
|
||||
bool get _macOS => platform == TargetPlatform.macOS;
|
||||
|
||||
List<KeyboardShortcutEntry> get entries => [
|
||||
KeyboardShortcutEntry(
|
||||
action: 'Show or hide terminal',
|
||||
keys: TerminalShortcutLabels(
|
||||
web: web,
|
||||
platform: platform,
|
||||
).toggle.join(', '),
|
||||
caveat: web
|
||||
? 'Browser tab shortcuts such as Cmd+T are not available to the app.'
|
||||
: null,
|
||||
),
|
||||
KeyboardShortcutEntry(
|
||||
action: 'Show or hide floating chats',
|
||||
keys: _apple
|
||||
? '${chatFloatShortcutLabel(platform)}, Ctrl+Y, Cmd+Y'
|
||||
: '${chatFloatShortcutLabel(platform)}, Ctrl+Y',
|
||||
caveat:
|
||||
'Brings a chat forward from Terminal and focuses its message input.',
|
||||
),
|
||||
KeyboardShortcutEntry(
|
||||
action: 'Toggle Center Stage',
|
||||
keys:
|
||||
'${chatCenterStageShortcutLabel(platform)}${_apple ? ', Cmd+E' : ', Ctrl+E'}',
|
||||
),
|
||||
KeyboardShortcutEntry(
|
||||
action: 'Open Search',
|
||||
keys: shellSearchShortcutLabels(platform).join(', '),
|
||||
caveat: web ? 'The browser may reserve some keyboard shortcuts.' : null,
|
||||
),
|
||||
KeyboardShortcutEntry(
|
||||
action: 'Cycle floating windows',
|
||||
keys:
|
||||
'${windowCycleShortcutLabel(platform)}, ${windowCycleShortcutLabel(platform)} with Shift',
|
||||
),
|
||||
KeyboardShortcutEntry(
|
||||
action: 'Open a chat list item',
|
||||
keys: _macOS ? 'Cmd+1…9' : 'Ctrl+1…9',
|
||||
caveat:
|
||||
'Available when the Chat list is mounted; numbers select its visible item.',
|
||||
),
|
||||
KeyboardShortcutEntry(
|
||||
action: 'Focus the active chat composer',
|
||||
keys: '/',
|
||||
caveat: 'Only outside text fields and other popup surfaces.',
|
||||
),
|
||||
KeyboardShortcutEntry(
|
||||
action: 'Send a chat message',
|
||||
keys: _apple ? 'Cmd+Enter' : 'Ctrl+Enter',
|
||||
),
|
||||
if (!web)
|
||||
const KeyboardShortcutEntry(
|
||||
action: 'Move between terminal tabs',
|
||||
keys: 'Ctrl+Tab, Ctrl+Shift+Tab',
|
||||
),
|
||||
];
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'keyboard_shortcuts_help.dart';
|
||||
import 'settings_keys.dart';
|
||||
import 'settings_row.dart';
|
||||
|
||||
class SettingsKeyboardShortcutsSection extends StatelessWidget {
|
||||
const SettingsKeyboardShortcutsSection({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) => SettingsRow(
|
||||
key: SettingsKeys.keyboardShortcuts,
|
||||
leading: const Icon(Icons.keyboard_outlined),
|
||||
title: const Text(keyboardShortcutsLabel),
|
||||
subtitle: const Text('See the shortcuts available on this platform.'),
|
||||
chevron: true,
|
||||
onTap: () => showKeyboardShortcutsHelp(context),
|
||||
);
|
||||
}
|
||||
@@ -11,4 +11,7 @@ abstract final class SettingsKeys {
|
||||
static const saveWorkspace = ValueKey<String>('settings.saveWorkspace');
|
||||
static const templates = ValueKey<String>('settings.templates');
|
||||
static const schedules = ValueKey<String>('settings.schedules');
|
||||
static const keyboardShortcuts = ValueKey<String>(
|
||||
'settings.keyboardShortcuts',
|
||||
);
|
||||
}
|
||||
|
||||
@@ -37,6 +37,7 @@ import 'settings_templates_section.dart';
|
||||
import 'server_connections.dart';
|
||||
import 'saved_servers_section.dart';
|
||||
import 'managed_connection_section.dart';
|
||||
import 'settings_keyboard_shortcuts_section.dart';
|
||||
|
||||
part 'settings_topic_pages.dart';
|
||||
|
||||
|
||||
@@ -82,6 +82,11 @@ extension _SettingsTopicPages on _SettingsScreenState {
|
||||
SettingsStorageSection(gateway: widget.client),
|
||||
),
|
||||
_single('Server', SettingsHealthSection(gateway: widget.client)),
|
||||
SettingsGroup(
|
||||
title: 'Help',
|
||||
leadingRows: true,
|
||||
children: const [SettingsKeyboardShortcutsSection()],
|
||||
),
|
||||
if (widget.onOpenSchedules != null || widget.onOpenTemplates != null)
|
||||
SettingsGroup(
|
||||
title: 'Library',
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../../../shell/shell_bar.dart';
|
||||
@@ -88,7 +87,7 @@ class TemplatesFrame extends StatelessWidget {
|
||||
key: templatesRefreshKey,
|
||||
cupertino: false,
|
||||
icon: Icons.refresh,
|
||||
cupertinoIcon: CupertinoIcons.refresh,
|
||||
cupertinoIcon: Icons.refresh,
|
||||
label: 'Refresh',
|
||||
onPressed: refreshing ? null : onRefresh,
|
||||
);
|
||||
|
||||
@@ -15,13 +15,11 @@ class TerminalBody extends StatelessWidget {
|
||||
const TerminalBody({
|
||||
super.key,
|
||||
required this.hub,
|
||||
required this.cupertino,
|
||||
this.keys = false,
|
||||
this.focus,
|
||||
});
|
||||
|
||||
final TerminalHub hub;
|
||||
final bool cupertino;
|
||||
final bool keys;
|
||||
final FocusScopeNode? focus;
|
||||
|
||||
@@ -52,7 +50,6 @@ class TerminalBody extends StatelessWidget {
|
||||
child: ChatShellTerminalView(
|
||||
key: ValueKey('terminal-view-${tab.key}'),
|
||||
session: tab.session,
|
||||
cupertino: cupertino,
|
||||
fill: true,
|
||||
autofocus: true,
|
||||
),
|
||||
@@ -68,7 +65,6 @@ class TerminalBody extends StatelessWidget {
|
||||
padding: const EdgeInsets.fromLTRB(8, 0, 8, 8),
|
||||
child: ChatShellTerminalKeys(
|
||||
session: tab.session,
|
||||
cupertino: cupertino,
|
||||
field: chatShellTouchFirst(),
|
||||
),
|
||||
),
|
||||
@@ -77,10 +73,10 @@ class TerminalBody extends StatelessWidget {
|
||||
);
|
||||
}
|
||||
|
||||
TextStyle? _noteStyle(BuildContext context) =>
|
||||
Theme.of(context).textTheme.bodySmall?.copyWith(
|
||||
color: Theme.of(context).colorScheme.onSurfaceVariant,
|
||||
);
|
||||
TextStyle? _noteStyle(BuildContext context) => Theme.of(context)
|
||||
.textTheme
|
||||
.bodySmall
|
||||
?.copyWith(color: Theme.of(context).colorScheme.onSurfaceVariant);
|
||||
|
||||
Widget _closeEnded(TerminalTab tab) {
|
||||
void close() => unawaited(hub.close(tab));
|
||||
|
||||
@@ -15,19 +15,15 @@ class TerminalChoice<T> {
|
||||
class TerminalMenuButton<T> extends StatelessWidget {
|
||||
const TerminalMenuButton({
|
||||
super.key,
|
||||
required this.cupertino,
|
||||
required this.label,
|
||||
required this.icon,
|
||||
required this.cupertinoIcon,
|
||||
required this.choices,
|
||||
required this.onSelected,
|
||||
this.info,
|
||||
});
|
||||
|
||||
final bool cupertino;
|
||||
final String label;
|
||||
final IconData icon;
|
||||
final IconData cupertinoIcon;
|
||||
final List<TerminalChoice<T>> choices;
|
||||
final ValueChanged<T> onSelected;
|
||||
|
||||
|
||||
@@ -12,10 +12,8 @@ import 'terminal_tab_strip.dart';
|
||||
PageRoute<void> terminalPageRoute({
|
||||
required TerminalHub hub,
|
||||
required TerminalLayout layout,
|
||||
required bool cupertino,
|
||||
}) {
|
||||
Widget page(BuildContext _) =>
|
||||
TerminalPage(hub: hub, layout: layout, cupertino: cupertino);
|
||||
Widget page(BuildContext _) => TerminalPage(hub: hub, layout: layout);
|
||||
return MaterialPageRoute<void>(builder: page);
|
||||
}
|
||||
|
||||
@@ -32,14 +30,9 @@ class TerminalPageToggle {
|
||||
BuildContext context, {
|
||||
required TerminalHub hub,
|
||||
required TerminalLayout layout,
|
||||
required bool cupertino,
|
||||
}) async {
|
||||
if (_route != null) return;
|
||||
final route = _route = terminalPageRoute(
|
||||
hub: hub,
|
||||
layout: layout,
|
||||
cupertino: cupertino,
|
||||
);
|
||||
final route = _route = terminalPageRoute(hub: hub, layout: layout);
|
||||
try {
|
||||
await Navigator.of(context).push(route);
|
||||
} finally {
|
||||
@@ -59,16 +52,10 @@ class TerminalPageToggle {
|
||||
}
|
||||
|
||||
class TerminalPage extends StatelessWidget {
|
||||
const TerminalPage({
|
||||
super.key,
|
||||
required this.hub,
|
||||
required this.layout,
|
||||
required this.cupertino,
|
||||
});
|
||||
const TerminalPage({super.key, required this.hub, required this.layout});
|
||||
|
||||
final TerminalHub hub;
|
||||
final TerminalLayout layout;
|
||||
final bool cupertino;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@@ -78,15 +65,8 @@ class TerminalPage extends StatelessWidget {
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: [
|
||||
TerminalTabStrip(
|
||||
hub: hub,
|
||||
layout: layout,
|
||||
cupertino: cupertino,
|
||||
showModes: false,
|
||||
),
|
||||
Expanded(
|
||||
child: TerminalBody(hub: hub, cupertino: cupertino, keys: true),
|
||||
),
|
||||
TerminalTabStrip(hub: hub, layout: layout, showModes: false),
|
||||
Expanded(child: TerminalBody(hub: hub, keys: true)),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
@@ -34,14 +34,12 @@ class TerminalPanel extends StatefulWidget {
|
||||
super.key,
|
||||
required this.hub,
|
||||
required this.layout,
|
||||
required this.cupertino,
|
||||
required this.available,
|
||||
this.focus,
|
||||
});
|
||||
|
||||
final TerminalHub hub;
|
||||
final TerminalLayout layout;
|
||||
final bool cupertino;
|
||||
|
||||
/// The height of the window the panel shares with the app.
|
||||
final double available;
|
||||
@@ -138,17 +136,9 @@ class _TerminalPanelState extends State<TerminalPanel> {
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: [
|
||||
handle,
|
||||
TerminalTabStrip(
|
||||
hub: widget.hub,
|
||||
layout: widget.layout,
|
||||
cupertino: widget.cupertino,
|
||||
),
|
||||
TerminalTabStrip(hub: widget.hub, layout: widget.layout),
|
||||
Expanded(
|
||||
child: TerminalBody(
|
||||
hub: widget.hub,
|
||||
cupertino: widget.cupertino,
|
||||
focus: widget.focus,
|
||||
),
|
||||
child: TerminalBody(hub: widget.hub, focus: widget.focus),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../../ui/adaptive/segmented_bar_pieces.dart';
|
||||
|
||||
/// On a phone, a small floating button below the top bar's right end that
|
||||
/// opens the full-screen terminal. It shows how many shells are running when
|
||||
/// there is more than one.
|
||||
@@ -9,21 +7,16 @@ class TerminalShortcutBubble extends StatelessWidget {
|
||||
const TerminalShortcutBubble({
|
||||
super.key,
|
||||
required this.running,
|
||||
required this.cupertino,
|
||||
required this.onOpen,
|
||||
});
|
||||
|
||||
final int running;
|
||||
final bool cupertino;
|
||||
final VoidCallback onOpen;
|
||||
|
||||
/// The top edge: below the safe area and the top bar (its 8 px top inset
|
||||
/// and its pieces), with an 8 px gap.
|
||||
static double topOf(BuildContext context, {required bool cupertino}) =>
|
||||
MediaQuery.paddingOf(context).top +
|
||||
8 +
|
||||
segmentedPieceHeight(cupertino) +
|
||||
8;
|
||||
static double topOf(BuildContext context) =>
|
||||
MediaQuery.paddingOf(context).top + 8 + kMinInteractiveDimension + 8;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
|
||||
@@ -14,7 +14,6 @@ class TerminalStage extends StatelessWidget {
|
||||
super.key,
|
||||
required this.hub,
|
||||
required this.layout,
|
||||
required this.cupertino,
|
||||
required this.present,
|
||||
required this.reveal,
|
||||
required this.focus,
|
||||
@@ -24,7 +23,6 @@ class TerminalStage extends StatelessWidget {
|
||||
|
||||
final TerminalHub hub;
|
||||
final TerminalLayout layout;
|
||||
final bool cupertino;
|
||||
final bool present;
|
||||
final Animation<double> reveal;
|
||||
final FocusScopeNode focus;
|
||||
@@ -76,7 +74,6 @@ class TerminalStage extends StatelessWidget {
|
||||
key: const ValueKey('terminal-panel'),
|
||||
hub: hub,
|
||||
layout: layout,
|
||||
cupertino: cupertino,
|
||||
available: constraints.maxHeight,
|
||||
focus: focus,
|
||||
),
|
||||
|
||||
@@ -31,7 +31,7 @@ class TerminalSurface extends StatefulWidget {
|
||||
super.key,
|
||||
required this.hub,
|
||||
required this.layout,
|
||||
required this.cupertino,
|
||||
this.cupertino,
|
||||
required this.child,
|
||||
this.shortcutHere = true,
|
||||
this.windows,
|
||||
@@ -40,7 +40,9 @@ class TerminalSurface extends StatefulWidget {
|
||||
|
||||
final TerminalHub hub;
|
||||
final TerminalLayout layout;
|
||||
final bool cupertino;
|
||||
|
||||
/// Kept for callers migrating from the former alternate host; ignored.
|
||||
final bool? cupertino;
|
||||
final Widget child;
|
||||
|
||||
/// Whether the current page offers the phone shortcut to reopen the
|
||||
@@ -189,12 +191,7 @@ class _TerminalSurfaceState extends State<TerminalSurface>
|
||||
Future<void> _openPage() async {
|
||||
unawaited(openTerminalIfNone(widget.hub));
|
||||
setState(() {});
|
||||
await _page.show(
|
||||
context,
|
||||
hub: widget.hub,
|
||||
layout: widget.layout,
|
||||
cupertino: widget.cupertino,
|
||||
);
|
||||
await _page.show(context, hub: widget.hub, layout: widget.layout);
|
||||
if (mounted) setState(() {});
|
||||
}
|
||||
|
||||
@@ -212,13 +209,9 @@ class _TerminalSurfaceState extends State<TerminalSurface>
|
||||
if (show)
|
||||
PositionedDirectional(
|
||||
end: 12,
|
||||
top: TerminalShortcutBubble.topOf(
|
||||
context,
|
||||
cupertino: widget.cupertino,
|
||||
),
|
||||
top: TerminalShortcutBubble.topOf(context),
|
||||
child: TerminalShortcutBubble(
|
||||
running: running,
|
||||
cupertino: widget.cupertino,
|
||||
onOpen: () => unawaited(_openPage()),
|
||||
),
|
||||
),
|
||||
@@ -234,7 +227,6 @@ class _TerminalSurfaceState extends State<TerminalSurface>
|
||||
builder: (context, child) => TerminalStage(
|
||||
hub: widget.hub,
|
||||
layout: widget.layout,
|
||||
cupertino: widget.cupertino,
|
||||
// Kept while the hide motion runs.
|
||||
present: !_narrow && (widget.layout.visible || !_reveal.isDismissed),
|
||||
reveal: _curve,
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'terminal_hub.dart';
|
||||
@@ -18,14 +17,12 @@ class TerminalTabStrip extends StatelessWidget {
|
||||
super.key,
|
||||
required this.hub,
|
||||
required this.layout,
|
||||
required this.cupertino,
|
||||
this.trailing = const [],
|
||||
this.showModes = true,
|
||||
});
|
||||
|
||||
final TerminalHub hub;
|
||||
final TerminalLayout layout;
|
||||
final bool cupertino;
|
||||
final List<Widget> trailing;
|
||||
|
||||
/// False on the narrow page, which has no panel or window to choose.
|
||||
@@ -57,11 +54,9 @@ class TerminalTabStrip extends StatelessWidget {
|
||||
_newTerminal(),
|
||||
if (showModes)
|
||||
TerminalMenuButton<_Option>(
|
||||
cupertino: cupertino,
|
||||
label: 'Terminal options',
|
||||
info: TerminalShortcutLabels.current().summary,
|
||||
icon: Icons.more_vert,
|
||||
cupertinoIcon: CupertinoIcons.ellipsis,
|
||||
choices: [
|
||||
for (final mode in TerminalMode.values)
|
||||
TerminalChoice(
|
||||
@@ -113,10 +108,8 @@ class TerminalTabStrip extends StatelessWidget {
|
||||
final machines = hub.connected;
|
||||
if (machines.length > 1) {
|
||||
return TerminalMenuButton<String>(
|
||||
cupertino: cupertino,
|
||||
label: 'New terminal',
|
||||
icon: Icons.add,
|
||||
cupertinoIcon: CupertinoIcons.add,
|
||||
choices: [
|
||||
for (final machine in machines)
|
||||
TerminalChoice(
|
||||
|
||||
@@ -7,14 +7,12 @@ import 'terminal_shortcuts.dart';
|
||||
/// The shell bar's Terminal button: shows or hides the terminal (also
|
||||
/// Alt+T, Ctrl+T, Cmd+T and Ctrl+`, where the platform delivers them).
|
||||
class TerminalToggleButton extends StatelessWidget {
|
||||
const TerminalToggleButton({
|
||||
super.key,
|
||||
required this.layout,
|
||||
required this.cupertino,
|
||||
});
|
||||
const TerminalToggleButton({super.key, required this.layout, this.cupertino});
|
||||
|
||||
final TerminalLayout layout;
|
||||
final bool cupertino;
|
||||
|
||||
/// Kept for callers migrating from the former alternate host; ignored.
|
||||
final bool? cupertino;
|
||||
|
||||
/// The tooltip, naming the platform's most convenient shortcut.
|
||||
static String get label => TerminalShortcutLabels.current().button;
|
||||
|
||||
@@ -149,8 +149,8 @@ class TerminalWindowKind extends WindowKind {
|
||||
builder: (context, _) => Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: [
|
||||
TerminalTabStrip(hub: hub, layout: layout, cupertino: false),
|
||||
Expanded(child: TerminalBody(hub: hub, cupertino: false)),
|
||||
TerminalTabStrip(hub: hub, layout: layout),
|
||||
Expanded(child: TerminalBody(hub: hub)),
|
||||
],
|
||||
),
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user