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.
46 lines
1.3 KiB
Dart
46 lines
1.3 KiB
Dart
import 'package:flutter/material.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.
|
|
class TerminalShortcutBubble extends StatelessWidget {
|
|
const TerminalShortcutBubble({
|
|
super.key,
|
|
required this.running,
|
|
required this.onOpen,
|
|
});
|
|
|
|
final int running;
|
|
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) =>
|
|
MediaQuery.paddingOf(context).top + 8 + kMinInteractiveDimension + 8;
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
final label = running > 1
|
|
? 'Open terminal, $running running'
|
|
: 'Open terminal';
|
|
final icon = Icon(Icons.terminal, size: 20);
|
|
final content = running > 1
|
|
? Badge.count(count: running, child: icon)
|
|
: icon;
|
|
final button = FloatingActionButton.small(
|
|
key: const Key('terminal-shortcut-bubble'),
|
|
heroTag: null,
|
|
tooltip: label,
|
|
onPressed: onOpen,
|
|
child: content,
|
|
);
|
|
return Semantics(
|
|
button: true,
|
|
label: label,
|
|
excludeSemantics: true,
|
|
onTap: onOpen,
|
|
child: button,
|
|
);
|
|
}
|
|
}
|