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:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user