30ba70ade8
Guide new users through connecting a server, configuring an agent harness, starting runs, and chatting with agents. Persist completion per device and offer the walkthrough again for empty servers or from Settings, with widget coverage and implementation notes.
132 lines
4.3 KiB
Dart
132 lines
4.3 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(),
|
|
SettingsWalkthroughSection(),
|
|
],
|
|
),
|
|
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)],
|
|
);
|
|
}
|