1e07ab1ddc
Keep the Templates destination available through its direct routes while removing the obsolete Settings entry and wiring. Update navigation coverage and document the preserved route behavior.
129 lines
4.2 KiB
Dart
129 lines
4.2 KiB
Dart
part of 'settings_screen.dart';
|
|
|
|
extension _SettingsTopicPages on _SettingsScreenState {
|
|
Map<SettingsTopic, WidgetBuilder> _topicPages() {
|
|
final servers = widget.servers;
|
|
return {
|
|
SettingsTopic.appearance: (_) => SettingsPageBody(
|
|
children: [
|
|
const SettingsScaleSection(),
|
|
SettingsAnimationSection(
|
|
controller:
|
|
widget.animationSpeed ?? AnimationSpeedController.instance,
|
|
),
|
|
SettingsFontSection(
|
|
controller: widget.fonts ?? AppFontController.instance,
|
|
),
|
|
SettingsTerminalSection(
|
|
layout: widget.terminalLayout ?? TerminalLayout.instance,
|
|
),
|
|
],
|
|
),
|
|
SettingsTopic.connection: (_) => SettingsPageBody(
|
|
children: [
|
|
if (servers != null) ...[
|
|
SavedServersSection(connections: servers),
|
|
ManagedConnectionSection(
|
|
client: widget.client,
|
|
controller: _controller,
|
|
),
|
|
] else
|
|
SettingsConnectionSection(
|
|
controller: _controller,
|
|
serverUrlField: _serverUrlField,
|
|
),
|
|
if (widget.showSignIn)
|
|
_single(
|
|
'Sign in',
|
|
SettingsSignInSection(
|
|
endpoint: _endpoint,
|
|
onChanged: _reconnectAfterSignIn,
|
|
),
|
|
),
|
|
if (widget.showSignIn || kIsWeb)
|
|
_single(
|
|
'Sign-in security',
|
|
SettingsSecuritySection(
|
|
endpoint: _endpoint,
|
|
onSignedOut: _reconnectAfterSignIn,
|
|
),
|
|
),
|
|
SettingsWorkspaceSection(
|
|
controller: _controller,
|
|
workspaceField: _workspaceField,
|
|
),
|
|
],
|
|
),
|
|
SettingsTopic.notifications: (_) => SettingsPageBody(
|
|
children: [
|
|
if (widget.notifications case final notifications?)
|
|
SettingsNotificationsSection(controller: notifications),
|
|
if (widget.deliveryService case final service? when service.supported)
|
|
SettingsDeviceDeliverySection(
|
|
bridge: service,
|
|
controller: widget.deliveryServiceController,
|
|
requestNotificationPermission: widget.notifications == null
|
|
? null
|
|
: () async {
|
|
await widget.notifications!.requestPermission();
|
|
},
|
|
),
|
|
SettingsNtfySection(
|
|
gateway: widget.client,
|
|
connected:
|
|
widget.client.state.kind == transport.ConnectionKind.connected,
|
|
),
|
|
],
|
|
),
|
|
SettingsTopic.tools: (_) => SettingsPageBody(
|
|
children: [
|
|
_single(
|
|
'Data management',
|
|
SettingsStorageSection(gateway: widget.client),
|
|
),
|
|
_single('Server', SettingsHealthSection(gateway: widget.client)),
|
|
SettingsGroup(
|
|
title: 'Help',
|
|
leadingRows: true,
|
|
children: const [SettingsKeyboardShortcutsSection()],
|
|
),
|
|
if (widget.onOpenSchedules case final open?)
|
|
SettingsGroup(
|
|
title: 'Library',
|
|
leadingRows: true,
|
|
children: [SettingsSchedulesSection(onOpen: open)],
|
|
),
|
|
],
|
|
),
|
|
SettingsTopic.updates: (_) => SettingsPageBody(
|
|
children: [
|
|
if (widget.showAndroidDownload)
|
|
_single('Android app', const SettingsAndroidDownloadSection()),
|
|
if (widget.showSignIn && appUpdatesSupported)
|
|
_single(
|
|
'App updates',
|
|
SettingsUpdatesSection(
|
|
endpoint: _endpoint,
|
|
servers: widget.servers,
|
|
),
|
|
),
|
|
if (!widget.showAndroidDownload &&
|
|
!(widget.showSignIn && appUpdatesSupported))
|
|
_single(
|
|
'App updates',
|
|
const Text(
|
|
'This installation is updated by its server administrator.',
|
|
),
|
|
),
|
|
],
|
|
),
|
|
};
|
|
}
|
|
|
|
/// A group holding one free-form block (a form, a status with buttons).
|
|
Widget _single(String title, Widget child) => SettingsGroup(
|
|
title: title,
|
|
children: <Widget>[SettingsGroupItem(child: child)],
|
|
);
|
|
}
|