Remove Cupertino onboarding branches

Keep onboarding on the app's Material-only path and remove unreachable Cupertino widgets and host-specific tests. Preserve the reviewed Material behavior while documenting the focused checks and verification limits.
This commit is contained in:
2026-11-11 00:57:05 +00:00
parent c2b992542b
commit 26eafffd42
5 changed files with 94 additions and 178 deletions
@@ -1,7 +1,5 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import '../../../ui/adaptive/host.dart';
import 'discovered_server.dart';
/// One discovered machine. A machine with one route is used by tapping it. A
@@ -48,7 +46,6 @@ class _DiscoveredServerRowState extends State<DiscoveredServerRow> {
@override
Widget build(BuildContext context) {
final cupertino = usesCupertinoHost(context);
final server = widget.server;
final detail = _multiple
? '${server.addresses.length} addresses'
@@ -57,47 +54,26 @@ class _DiscoveredServerRowState extends State<DiscoveredServerRow> {
server.passwordRequired ? '$detail · password' : detail,
);
final onTap = widget.enabled ? _tap : null;
final Widget head = cupertino
? CupertinoListTile(
key: Key('discovered-${server.address}'),
leading: const Icon(CupertinoIcons.desktopcomputer),
title: Text(server.name),
subtitle: subtitle,
trailing: _multiple
? Icon(
_expanded
? CupertinoIcons.chevron_up
: CupertinoIcons.chevron_down,
)
: const CupertinoListTileChevron(),
onTap: onTap,
)
: ListTile(
key: Key('discovered-${server.address}'),
leading: const Icon(Icons.dns_outlined),
title: Text(server.name),
subtitle: subtitle,
trailing: Icon(
_multiple
? (_expanded ? Icons.expand_less : Icons.expand_more)
: Icons.chevron_right,
),
enabled: widget.enabled,
onTap: onTap,
);
final Widget head = ListTile(
key: Key('discovered-${server.address}'),
leading: const Icon(Icons.dns_outlined),
title: Text(server.name),
subtitle: subtitle,
trailing: Icon(
_multiple
? (_expanded ? Icons.expand_less : Icons.expand_more)
: Icons.chevron_right,
),
enabled: widget.enabled,
onTap: onTap,
);
if (!_multiple || !_expanded) return head;
final useLabel = 'Use ${server.name}';
final use = cupertino
? CupertinoButton.filled(
key: Key('discovered-use-${server.address}'),
onPressed: widget.enabled && _chosen.isNotEmpty ? _use : null,
child: Text(useLabel),
)
: FilledButton(
key: Key('discovered-use-${server.address}'),
onPressed: widget.enabled && _chosen.isNotEmpty ? _use : null,
child: Text(useLabel),
);
final use = FilledButton(
key: Key('discovered-use-${server.address}'),
onPressed: widget.enabled && _chosen.isNotEmpty ? _use : null,
child: Text(useLabel),
);
return Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
@@ -109,8 +85,7 @@ class _DiscoveredServerRowState extends State<DiscoveredServerRow> {
'as routes to this one machine; the first is tried first.',
),
),
for (final address in server.addresses)
_choice(context, cupertino, address),
for (final address in server.addresses) _choice(address),
Padding(
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 8),
child: Align(alignment: AlignmentDirectional.centerStart, child: use),
@@ -119,11 +94,7 @@ class _DiscoveredServerRowState extends State<DiscoveredServerRow> {
);
}
Widget _choice(
BuildContext context,
bool cupertino,
DiscoveredAddress address,
) {
Widget _choice(DiscoveredAddress address) {
final checked = _chosen.contains(address);
void toggle(bool? value) => setState(() {
if (value ?? false) {
@@ -133,26 +104,12 @@ class _DiscoveredServerRowState extends State<DiscoveredServerRow> {
}
});
final key = Key('discovered-route-${address.endpoint}');
final title = Text(address.label);
final subtitle = Text(address.endpoint.toString());
if (cupertino) {
return CupertinoListTile(
key: key,
title: title,
subtitle: subtitle,
trailing: CupertinoCheckbox(
value: checked,
onChanged: widget.enabled ? toggle : null,
),
onTap: widget.enabled ? () => toggle(!checked) : null,
);
}
return CheckboxListTile(
key: key,
value: checked,
onChanged: widget.enabled ? toggle : null,
title: title,
subtitle: subtitle,
title: Text(address.label),
subtitle: Text(address.endpoint.toString()),
controlAffinity: ListTileControlAffinity.leading,
);
}
@@ -1,9 +1,7 @@
import 'dart:async';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import '../../../ui/adaptive/host.dart';
import 'browser_server_discovery.dart';
import 'discovered_server.dart';
import 'discovered_server_row.dart';
@@ -88,42 +86,29 @@ class _DiscoveryPanelState extends State<DiscoveryPanel> {
@override
Widget build(BuildContext context) {
final cupertino = usesCupertinoHost(context);
final scanning = _phase == _Phase.scanning;
final label = _phase == _Phase.idle
? 'Find servers on this network'
: 'Search again';
final enabled = widget.enabled && !scanning;
final button = cupertino
? CupertinoButton(
key: const Key('discovery-scan'),
onPressed: enabled ? _start : null,
child: Text(label),
)
: OutlinedButton.icon(
key: const Key('discovery-scan'),
onPressed: enabled ? _start : null,
icon: const Icon(Icons.wifi_find),
label: Text(label),
);
final button = OutlinedButton.icon(
key: const Key('discovery-scan'),
onPressed: enabled ? _start : null,
icon: const Icon(Icons.wifi_find),
label: Text(label),
);
final status = switch (_phase) {
_Phase.scanning => _status(
context,
cupertino,
const Key('discovery-scanning'),
'Looking for Pipelines servers…',
busy: true,
),
_Phase.done when _servers.isEmpty => _status(
context,
cupertino,
const Key('discovery-empty'),
'No Pipelines servers answered on this network. '
'Enter the address instead.',
),
_Phase.failed => _status(
context,
cupertino,
const Key('discovery-error'),
'Could not search this network: $_error',
error: true,
@@ -149,30 +134,22 @@ class _DiscoveryPanelState extends State<DiscoveryPanel> {
}
Widget _status(
BuildContext context,
bool cupertino,
Key key,
String text, {
bool busy = false,
bool error = false,
}) {
final color = !error
? null
: cupertino
? CupertinoColors.systemRed.resolveFrom(context)
: Theme.of(context).colorScheme.error;
final color = !error ? null : Theme.of(context).colorScheme.error;
return Padding(
key: key,
padding: const EdgeInsets.symmetric(vertical: 8),
child: Row(
children: [
if (busy) ...[
cupertino
? const CupertinoActivityIndicator()
: const SizedBox.square(
dimension: 16,
child: CircularProgressIndicator(strokeWidth: 2),
),
const SizedBox.square(
dimension: 16,
child: CircularProgressIndicator(strokeWidth: 2),
),
const SizedBox(width: 12),
],
Expanded(