Restyle Settings as flat grouped list sections (F9) and scroll it behind the bar (F1)

Servers become rows with a selection mark, addresses as subtitles and a
Use/Edit/Remove menu plus an Add server row; the connection is a status row
with address and Reconnect/Disconnect rows; Templates and Schedules are
chevron rows in a Library group. Material groups are flat surfaceContainer
surfaces with primary titleSmall headers (no Cards); Cupertino uses
inset-grouped sections on the grouped background, switches for the ntfy
choices. The trust warning is a footer, helper copy is shortened, Save
workspace is a legible tonal/plain button, and the column starts at the
bar's inset (max 720) instead of being centred. The page pads by the top
media padding instead of a top SafeArea.
This commit is contained in:
2026-10-31 03:07:20 +00:00
parent ea0f22dfc7
commit 3ec580c2d9
23 changed files with 1103 additions and 677 deletions
@@ -5,12 +5,23 @@ import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import '../../core/transport/pipelines_client.dart';
import '../../ui/adaptive/host.dart';
import 'settings_controller.dart';
import 'settings_group.dart';
import 'settings_row.dart';
import 'settings_sections.dart';
import 'settings_trust_warning.dart';
import 'settings_theme.dart';
/// Status follows the actual attempted address, not just the preferred URL.
/// The short line under the managed connection's rows.
const String managedConnectionHelp =
'Reconnect tries the preferred address first, then the backups.';
/// The browser-only addition to [managedConnectionHelp].
const String managedConnectionWebHelp =
'In a browser the connection stays on this page’s origin.';
/// The saved-server connection: its state, the address actually attempted and
/// Reconnect / Disconnect rows. Status follows the actual attempted address,
/// not just the preferred URL.
class ManagedConnectionSection extends StatelessWidget {
const ManagedConnectionSection({
super.key,
@@ -20,43 +31,49 @@ class ManagedConnectionSection extends StatelessWidget {
final PipelinesClient client;
final SettingsController controller;
Widget _action(BuildContext context, String text, VoidCallback? press) =>
usesCupertinoHost(context)
? CupertinoButton(onPressed: press, child: Text(text))
: TextButton(onPressed: press, child: Text(text));
@override
Widget build(BuildContext context) => Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
SelectableText('Current address: ${client.endpoint ?? 'Not connected'}'),
const SizedBox(height: 8),
const Text(
'Reconnect tries the preferred address first. A dropped or '
'unreachable connection tries this server’s backup addresses automatically.',
),
if (kIsWeb)
const Text(
'In a browser, the connection stays on this page’s '
'origin. Use a saved server to open its page; native apps use automatic address fallback.',
),
Wrap(
spacing: 8,
children: [
_action(
context,
'Reconnect',
client.endpoints.isEmpty
? null
: () => unawaited(client.connectAny(client.endpoints)),
Widget build(BuildContext context) {
final cupertino = usesCupertinoControls(context);
return SettingsGroup(
title: 'Connection',
leadingRows: true,
footer: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: <Widget>[
Text(
kIsWeb
? '$managedConnectionHelp $managedConnectionWebHelp'
: managedConnectionHelp,
),
_action(context, 'Disconnect', () => unawaited(client.disconnect())),
const SizedBox(height: 12),
settingsConnectionFooter(controller),
],
),
SettingsStatusCard(controller: controller),
const SizedBox(height: 12),
const SettingsTrustWarning(),
if (controller.protocolWarning case final warning?) Text(warning),
],
);
children: <Widget>[
SettingsStatusRow(controller: controller),
SettingsRow(
leading: Icon(cupertino ? CupertinoIcons.link : Icons.link),
title: const Text('Current address'),
subtitle: SelectableText('${client.endpoint ?? 'Not connected'}'),
),
SettingsRow(
action: true,
enabled: client.endpoints.isNotEmpty,
leading: Icon(
cupertino ? CupertinoIcons.arrow_clockwise : Icons.refresh,
),
title: const Text('Reconnect'),
onTap: () => unawaited(client.connectAny(client.endpoints)),
),
SettingsRow(
action: true,
leading: Icon(
cupertino ? CupertinoIcons.stop_circle : Icons.link_off,
),
title: const Text('Disconnect'),
onTap: () => unawaited(client.disconnect()),
),
],
);
}
}