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(
@@ -1,10 +1,8 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import '../../core/session/server_session.dart';
import '../../core/transport/server_url.dart';
import '../../core/servers/server_probe.dart';
import '../../ui/adaptive/host.dart';
import 'discovery/discovered_server.dart';
import 'discovery/discovery_panel.dart';
import 'discovery/server_discovery.dart';
@@ -219,7 +217,6 @@ class _OnboardingFlowState extends State<OnboardingFlow> {
@override
Widget build(BuildContext context) {
final cupertino = usesCupertinoHost(context);
final title = _passwordStep ? 'Sign in' : 'Connect to Pipelines';
final lead = _passwordStep
? 'Enter the password chosen when Pipelines was installed on '
@@ -228,7 +225,6 @@ class _OnboardingFlowState extends State<OnboardingFlow> {
'wss://server.example/connect.';
final field = _passwordStep
? _field(
cupertino,
key: const Key('onboarding-password'),
controller: _password,
hint: 'Password',
@@ -236,7 +232,6 @@ class _OnboardingFlowState extends State<OnboardingFlow> {
onSubmitted: _signIn,
)
: _field(
cupertino,
key: const Key('onboarding-server'),
controller: _server,
hint: 'wss://server/connect',
@@ -245,26 +240,18 @@ class _OnboardingFlowState extends State<OnboardingFlow> {
);
final action = _passwordStep ? _signIn : _continue;
final label = _passwordStep ? 'Sign in' : 'Continue';
final button = cupertino
? CupertinoButton.filled(
key: const Key('onboarding-next'),
onPressed: _busy ? null : action,
child: _busy ? const CupertinoActivityIndicator() : Text(label),
)
: FilledButton(
key: const Key('onboarding-next'),
onPressed: _busy ? null : action,
child: _busy
? const SizedBox(
width: 18,
height: 18,
child: CircularProgressIndicator(strokeWidth: 2),
)
: Text(label),
);
final errorColor = cupertino
? CupertinoColors.systemRed.resolveFrom(context)
: Theme.of(context).colorScheme.error;
final button = FilledButton(
key: const Key('onboarding-next'),
onPressed: _busy ? null : action,
child: _busy
? const SizedBox(
width: 18,
height: 18,
child: CircularProgressIndicator(strokeWidth: 2),
)
: Text(label),
);
final errorColor = Theme.of(context).colorScheme.error;
final body = SafeArea(
child: Center(
child: SingleChildScrollView(
@@ -274,14 +261,7 @@ class _OnboardingFlowState extends State<OnboardingFlow> {
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
Text(
title,
style: cupertino
? CupertinoTheme.of(
context,
).textTheme.navLargeTitleTextStyle
: Theme.of(context).textTheme.headlineSmall,
),
Text(title, style: Theme.of(context).textTheme.headlineSmall),
const SizedBox(height: 8),
Text(lead),
const SizedBox(height: 24),
@@ -289,7 +269,6 @@ class _OnboardingFlowState extends State<OnboardingFlow> {
if (!_passwordStep) ...[
const SizedBox(height: 12),
_field(
cupertino,
key: const Key('onboarding-server-name'),
controller: _name,
hint: 'Machine name',
@@ -324,15 +303,10 @@ class _OnboardingFlowState extends State<OnboardingFlow> {
],
if (_passwordStep && !widget.startAtPassword) ...[
const SizedBox(height: 8),
cupertino
? CupertinoButton(
onPressed: _busy ? null : _back,
child: const Text('Change server'),
)
: TextButton(
onPressed: _busy ? null : _back,
child: const Text('Change server'),
),
TextButton(
onPressed: _busy ? null : _back,
child: const Text('Change server'),
),
],
if (widget.savedServers != null) ...[
const SizedBox(height: 24),
@@ -344,13 +318,10 @@ class _OnboardingFlowState extends State<OnboardingFlow> {
),
),
);
return cupertino
? CupertinoPageScaffold(child: body)
: Scaffold(body: body);
return Scaffold(body: body);
}
Widget _field(
bool cupertino, {
Widget _field({
required Key key,
required TextEditingController controller,
required String hint,
@@ -358,18 +329,6 @@ class _OnboardingFlowState extends State<OnboardingFlow> {
bool obscure = false,
TextInputType? keyboard,
}) {
if (cupertino) {
return CupertinoTextField(
key: key,
controller: controller,
placeholder: hint,
obscureText: obscure,
autocorrect: false,
keyboardType: keyboard,
autofocus: true,
onSubmitted: (_) => onSubmitted(),
);
}
return TextField(
key: key,
controller: controller,
+41
View File
@@ -0,0 +1,41 @@
# Onboarding: Material-only
Removed the Cupertino branch from `lib/features/onboarding`:
- `onboarding_flow.dart`: Material `Scaffold`, `TextField` (outline border),
`FilledButton` with a small `CircularProgressIndicator`, `TextButton` for
"Change server", theme error colour and `headlineSmall` title. Dropped the
unused `flutter/cupertino.dart` and `ui/adaptive/host.dart` imports.
- `discovery/discovery_panel.dart`: `OutlinedButton.icon` scan action, Material
busy indicator and theme error colour.
- `discovery/discovered_server_row.dart`: Material `ListTile`,
`CheckboxListTile` and `FilledButton`; Cupertino list tiles, chevrons,
checkbox and activity indicators removed.
Public constructors (`OnboardingFlow`, `DiscoveryPanel`, `DiscoveredServerRow`)
are unchanged; no `cupertino` parameters existed there. Private helpers lost
their now-unused `cupertino`/`context` arguments. No Cupertino icons or colours
are kept: the Material path uses none of them.
## Affected UI states
First run server entry, machine name, discovery idle/scanning/empty/error, the
discovered single-route row, the multi-route checklist and "Use <name>", the
sign-in step, probe error text and the "Change server" action. All render the
same Material widgets as before on the Material path; no layout or copy changed.
## Checks
- `tool/memwatch/full.sh 'test/features/onboarding '` — PASS, 24 tests, exit 0.
- `tool/memwatch/full.sh 'test/features/settings/saved_server_discovery_test.dart
test/application/pipelines_root_test.dart
test/application/zero_server_recovery_test.dart'` — PASS, 7 tests, exit 0
(other users of `OnboardingFlow`/`DiscoveryPanel`).
- `tool/analyze.sh` — clean, exit 0.
- `grep -rn 'Cupertino\|cupertino' lib/features/onboarding test/features/onboarding`
— no matches.
Test change: `discovery_panel_test.dart` lost its `CupertinoApp` host variant and
the `CupertinoListTile` expectation; the `host` helper now always builds a
`MaterialApp`. No Material test expectation changed. No UI capture was taken in
this stage.
@@ -1,6 +1,5 @@
import 'dart:async';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:pipelines_app/core/session/server_session.dart';
@@ -33,8 +32,7 @@ const studio = DiscoveredServer(
passwordRequired: false,
);
Widget host(Widget child, {bool cupertino = false}) =>
cupertino ? CupertinoApp(home: child) : MaterialApp(home: child);
Widget host(Widget child) => MaterialApp(home: child);
void main() {
late FakeDiscovery discovery;
@@ -146,22 +144,6 @@ void main() {
expect(find.byKey(const Key('discovery-error')), findsOneWidget);
});
testWidgets('Cupertino host lists and connects the same way', (tester) async {
await tester.pumpWidget(host(flow(discoverer: discovery), cupertino: true));
await tester.tap(find.byKey(const Key('discovery-scan')));
await tester.pump();
discovery.current.add([studio]);
await tester.pump();
expect(find.byType(CupertinoListTile), findsOneWidget);
await tester.tap(find.byKey(const Key('discovered-192.168.1.30:8080')));
await tester.pumpAndSettle();
expect(checked, isEmpty);
await tester.ensureVisible(find.byKey(const Key('onboarding-next')));
await tester.tap(find.byKey(const Key('onboarding-next')));
await tester.pumpAndSettle();
expect(checked, [Uri.parse('ws://192.168.1.30:8080/connect')]);
});
testWidgets('leaving the screen mid-scan stops browsing', (tester) async {
await tester.pumpWidget(host(flow(discoverer: discovery)));
await tester.tap(find.byKey(const Key('discovery-scan')));