Files
pipelines/app/lib/features/settings/settings_status_row.dart
T
alan 3ec580c2d9 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.
2026-10-31 03:07:20 +00:00

67 lines
2.4 KiB
Dart

import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import '../../core/transport/pipelines_client.dart' as transport;
import 'settings_controller.dart';
import 'settings_row.dart';
import 'settings_theme.dart';
/// The connection's state as one row: a status icon, the state as the title
/// and the build/time/reason/backoff facts as its subtitle lines. Missing ping
/// values stay explicit.
class SettingsStatusRow extends StatelessWidget {
const SettingsStatusRow({super.key, required this.controller});
final SettingsController controller;
@override
Widget build(BuildContext context) {
final cupertino = usesCupertinoControls(context);
final state = controller.connection;
final lines = controller.connectionLines;
final title = lines.isEmpty ? '' : lines.first;
final details = lines.length > 1 ? lines.sublist(1) : const <String>[];
final connectedColor = cupertino
? CupertinoColors.systemGreen.resolveFrom(context)
: Theme.of(context).colorScheme.primary;
final Color? color = switch (state.kind) {
transport.ConnectionKind.connected => connectedColor,
transport.ConnectionKind.disconnected => settingsErrorColor(context),
_ => null,
};
final Widget leading = switch (state.kind) {
transport.ConnectionKind.connecting =>
cupertino
? const CupertinoActivityIndicator()
: const SizedBox.square(
dimension: 20,
child: CircularProgressIndicator(strokeWidth: 2),
),
transport.ConnectionKind.connected => Icon(
cupertino ? CupertinoIcons.checkmark_circle_fill : Icons.check_circle,
color: color,
),
transport.ConnectionKind.disconnected => Icon(
cupertino ? CupertinoIcons.xmark_circle_fill : Icons.error_outline,
color: color,
),
transport.ConnectionKind.idle => Icon(
cupertino ? CupertinoIcons.circle : Icons.radio_button_unchecked,
),
};
return SettingsRow(
leading: leading,
title: Text(
title,
style: TextStyle(color: color, fontWeight: FontWeight.w600),
),
subtitle: details.isEmpty
? null
: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[for (final line in details) Text(line)],
),
);
}
}