214bbbc54f
Keep the existing Material terminal and chat-shell behavior while removing live Cupertino widgets, icon metadata, and alternate-host branches. Retain only the documented optional compatibility parameters until remaining callers migrate.
39 lines
1.2 KiB
Dart
39 lines
1.2 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).
|
|
class TerminalToggleButton extends StatelessWidget {
|
|
const TerminalToggleButton({super.key, required this.layout, this.cupertino});
|
|
|
|
final TerminalLayout layout;
|
|
|
|
/// 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;
|
|
|
|
@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 IconButton(
|
|
key: const ValueKey('shell.terminal'),
|
|
tooltip: label,
|
|
isSelected: shown,
|
|
onPressed: actions.toggle,
|
|
icon: const Icon(Icons.terminal),
|
|
);
|
|
},
|
|
);
|
|
}
|
|
}
|