Files
pipelines/app/lib/features/terminal/terminal_toggle_button.dart
T
alan a233733966 Match chat terminal buttons to responsive UI
Remove the duplicate terminal action from narrow shell bars and expose the terminal in open chat bars only where appropriate. Use the shared plain bar-button styling and add focused light/dark responsive widget coverage.
2026-11-12 02:16:23 +00:00

41 lines
1.3 KiB
Dart

import 'package:flutter/material.dart';
import 'terminal_layout.dart';
import 'terminal_scope.dart';
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).
///
/// It is a plain bar IconButton like Files and More: no selected tint, so
/// its shown state is announced to assistive technology only.
class TerminalToggleButton extends StatelessWidget {
const TerminalToggleButton({super.key, required this.layout});
final TerminalLayout layout;
/// The tooltip, naming the platform's most convenient shortcut.
static String get label => TerminalShortcutLabels.current().button;
@override
Widget build(BuildContext context) {
final actions = TerminalScope.maybeOf(context);
if (actions == null) return const SizedBox.shrink();
return ListenableBuilder(
listenable: layout,
builder: (context, _) {
final shown = layout.visible;
return Semantics(
toggled: shown,
child: IconButton(
key: const ValueKey('shell.terminal'),
tooltip: label,
onPressed: actions.toggle,
icon: const Icon(Icons.terminal),
),
);
},
);
}
}