Add the app's terminal surface: bottom panel, floating window and full-screen page

This commit is contained in:
2026-11-09 21:42:52 +00:00
parent a5842e6b3b
commit acd160b49e
28 changed files with 2266 additions and 10 deletions
@@ -1,3 +1,5 @@
import '../terminal/terminal_layout.dart';
import 'settings_terminal_section.dart';
import '../../ui/adaptive/segmented_bar.dart';
import 'dart:async';
@@ -66,12 +68,17 @@ class SettingsScreen extends StatefulWidget {
this.deliveryServiceController,
this.fonts,
this.animationSpeed,
this.terminalLayout,
});
/// The device's interface font; defaults to the app's shared controller.
final AppFontController? fonts;
final AnimationSpeedController? animationSpeed;
/// The terminal surface's layout (its mode is chosen here); null is the
/// device's own.
final TerminalLayout? terminalLayout;
/// Android background delivery; hidden when absent or unsupported.
final NotificationServiceBridge? deliveryService;
final NotificationServiceController? deliveryServiceController;
@@ -0,0 +1,85 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import '../terminal/terminal_layout.dart';
import 'settings_group.dart';
import 'settings_theme.dart';
/// Appearance → Terminal: whether the terminal docks at the bottom of the
/// window or floats over it (Ctrl+` shows and hides it either way).
class SettingsTerminalSection extends StatelessWidget {
const SettingsTerminalSection({super.key, required this.layout});
final TerminalLayout layout;
@override
Widget build(BuildContext context) => ListenableBuilder(
listenable: layout,
builder: (context, _) {
final cupertino = usesCupertinoControls(context);
final Widget choice = cupertino
? CupertinoSlidingSegmentedControl<TerminalMode>(
groupValue: layout.mode,
children: {
for (final mode in TerminalMode.values)
mode: Padding(
key: ValueKey('settings-terminal-${mode.name}'),
padding: const EdgeInsets.symmetric(horizontal: 8),
child: Text(mode.label),
),
},
onValueChanged: (mode) {
if (mode != null) layout.setMode(mode);
},
)
: SegmentedButton<TerminalMode>(
segments: [
for (final mode in TerminalMode.values)
ButtonSegment(
value: mode,
label: Text(
mode.label,
key: ValueKey('settings-terminal-${mode.name}'),
),
icon: Icon(
mode == TerminalMode.panel
? Icons.vertical_split_outlined
: Icons.picture_in_picture_alt_outlined,
),
),
],
selected: {layout.mode},
onSelectionChanged: (modes) => layout.setMode(modes.first),
);
return SettingsGroup(
title: 'Terminal',
footer: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
const Text(
'Saved on this device. Ctrl+` shows or hides the terminal; on '
'a narrow window it opens full screen. Shells keep running '
'while it is hidden.',
),
if (layout.saveFailed)
Text(
'Could not save; applies until reload.',
style: TextStyle(color: settingsErrorColor(context)),
),
],
),
children: [
SettingsGroupItem(
child: Semantics(
label: 'Terminal placement',
child: Align(
alignment: AlignmentDirectional.centerStart,
child: choice,
),
),
),
],
);
},
);
}
@@ -14,6 +14,9 @@ extension _SettingsTopicPages on _SettingsScreenState {
SettingsFontSection(
controller: widget.fonts ?? AppFontController.instance,
),
SettingsTerminalSection(
layout: widget.terminalLayout ?? TerminalLayout.instance,
),
],
),
SettingsTopic.connection: (_) => SettingsPageBody(