Remove Cupertino branches from Settings

Keep the Material-only settings implementation and its focused tests while preserving public cupertino parameters for later cleanup. This removes unreachable platform-specific widgets and test variants without changing the Material path.
This commit is contained in:
2026-11-11 05:05:57 +00:00
parent a2e6f8557e
commit a7c41063fa
26 changed files with 622 additions and 1353 deletions
@@ -1,9 +1,7 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import '../../core/servers/machine_access.dart';
import '../../core/servers/server_catalog.dart';
import '../../ui/adaptive/host.dart';
import '../../ui/adaptive/segmented_bar.dart';
import '../onboarding/discovery/discovered_server.dart';
import '../onboarding/discovery/discovery_panel.dart';
@@ -28,9 +26,7 @@ Future<SavedServer?> editSavedServer(
discovery: discovery ?? platformServerDiscovery(),
);
return Navigator.of(context).push<SavedServer>(
usesCupertinoHost(context)
? CupertinoPageRoute(builder: (_) => page)
: MaterialPageRoute(builder: (_) => page),
MaterialPageRoute(builder: (_) => page),
);
}
@@ -125,27 +121,6 @@ class _ServerEditorState extends State<_ServerEditor> {
required String key,
bool multiline = false,
}) {
if (usesCupertinoHost(context)) {
return Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
Text(label),
const SizedBox(height: 8),
CupertinoTextField(
key: Key(key),
controller: controller,
enabled: !_saving,
placeholder: multiline ? 'wss://server.example/connect' : 'Home',
minLines: multiline ? 3 : 1,
maxLines: multiline ? null : 1,
keyboardType: multiline
? TextInputType.multiline
: TextInputType.text,
autocorrect: !multiline,
),
],
);
}
return TextField(
key: Key(key),
controller: controller,
@@ -163,18 +138,12 @@ class _ServerEditorState extends State<_ServerEditor> {
@override
Widget build(BuildContext context) {
final cupertino = usesCupertinoHost(context);
final title = widget.server == null ? 'Add server' : 'Edit server';
final saveLabel = _saving ? 'Saving server…' : 'Save server';
final save = cupertino
? CupertinoButton.filled(
onPressed: _saving ? null : _save,
child: Text(saveLabel),
)
: FilledButton(
onPressed: _saving ? null : _save,
child: Text(saveLabel),
);
final save = FilledButton(
onPressed: _saving ? null : _save,
child: Text(saveLabel),
);
final saved = _saved;
if (saved != null && widget.authenticator != null) {
final step = SafeArea(
@@ -189,7 +158,7 @@ class _ServerEditorState extends State<_ServerEditor> {
],
),
);
return _scaffold(cupertino, 'Sign in to ${saved.name}', step);
return _scaffold('Sign in to ${saved.name}', step);
}
final body = SafeArea(
child: ListView(
@@ -232,9 +201,7 @@ class _ServerEditorState extends State<_ServerEditor> {
child: Text(
_error!,
style: TextStyle(
color: cupertino
? CupertinoColors.systemRed.resolveFrom(context)
: Theme.of(context).colorScheme.error,
color: Theme.of(context).colorScheme.error,
),
),
),
@@ -244,17 +211,12 @@ class _ServerEditorState extends State<_ServerEditor> {
],
),
);
return PopScope(canPop: !_saving, child: _scaffold(cupertino, title, body));
return PopScope(canPop: !_saving, child: _scaffold(title, body));
}
Widget _scaffold(bool cupertino, String title, Widget body) => cupertino
? CupertinoPageScaffold(
navigationBar: SegmentedBar(cupertino: true, title: title),
child: body,
)
: Scaffold(
extendBodyBehindAppBar: true,
appBar: SegmentedBar(cupertino: false, title: title),
body: body,
);
Widget _scaffold(String title, Widget body) => Scaffold(
extendBodyBehindAppBar: true,
appBar: SegmentedBar(cupertino: false, title: title),
body: body,
);
}