part of 'settings_screen.dart'; /// The Settings page's sections, in order. Each entry keeps the widgets the /// former category pages held; a server-backed entry is `lazy`. extension _SettingsPageSections on _SettingsScreenState { List _pageSections() { final servers = widget.servers; return [ SettingsSection( id: 'interface-size', title: 'Interface size', keywords: 'text size scale zoom large small font', builder: (_) => const SettingsScaleSection(), ), if (speechController.supported) const SettingsSection( id: 'read-aloud', title: 'Read aloud', keywords: 'speech voice audio speaking rate read aloud', builder: _readAloudBuilder, ), SettingsSection( id: 'animations', title: 'Animations', keywords: 'animation speed motion quick switch', builder: (_) => SettingsAnimationSection( controller: widget.animationSpeed ?? AnimationSpeedController.instance, ), ), SettingsSection( id: 'font', title: fontSectionTitle, keywords: 'font typeface custom text', builder: (_) => SettingsFontSection( controller: widget.fonts ?? AppFontController.instance, ), ), SettingsSection( id: 'terminal', title: 'Terminal', keywords: 'terminal layout mode split', builder: (_) => SettingsTerminalSection( layout: widget.terminalLayout ?? TerminalLayout.instance, ), ), if (servers != null) ...[ SettingsSection( id: 'servers', title: 'Servers', keywords: 'saved server profile add remove switch address', builder: (_) => SavedServersSection(connections: servers), ), SettingsSection( id: 'managed-connection', title: 'Connection', keywords: 'address current reconnect disconnect status', builder: (_) => ManagedConnectionSection( client: widget.client, controller: _controller, ), ), ] else SettingsSection( id: 'connection', title: 'Connection', keywords: 'server url address connect disconnect reconnect status', builder: (_) => SettingsConnectionSection( controller: _controller, serverUrlField: _serverUrlField, ), ), if (widget.showSignIn) SettingsSection( id: 'sign-in', title: 'Sign in', keywords: 'login password web account', builder: (_) => _single( 'Sign in', SettingsSignInSection( endpoint: _endpoint, onChanged: _reconnectAfterSignIn, ), ), ), if (widget.showSignIn || kIsWeb) SettingsSection( id: 'sign-in-security', title: 'Sign-in security', keywords: 'password sessions sign out everywhere revoke weak', lazy: true, builder: (_) => _single( 'Sign-in security', SettingsSecuritySection( endpoint: _endpoint, onSignedOut: _reconnectAfterSignIn, ), ), ), SettingsSection( id: 'workspace', title: 'Workspace', keywords: 'workspace path folder directory server save', builder: (_) => SettingsWorkspaceSection( controller: _controller, workspaceField: _workspaceField, ), ), SettingsSection( id: 'open-in-chat', title: 'Open in chat', keywords: 'open in chat run pipeline harness model default new chat', lazy: true, builder: (_) => SettingsOpenInChatSection(gateway: widget.client), ), if (widget.notifications case final notifications?) SettingsSection( id: 'notifications', title: notificationSectionTitle, keywords: 'notification permission browser alerts enable', builder: (_) => SettingsNotificationsSection(controller: notifications), ), if (widget.deliveryService case final service? when service.supported) SettingsSection( id: 'device-delivery', title: deviceDeliveryTitle, keywords: 'background delivery battery android notifications', builder: (_) => SettingsDeviceDeliverySection( bridge: service, controller: widget.deliveryServiceController, requestNotificationPermission: widget.notifications == null ? null : () async { await widget.notifications!.requestPermission(); }, ), ), SettingsSection( id: 'phone-notifications', title: ntfySectionTitle, keywords: 'ntfy push phone run finished chat needs you', lazy: true, builder: (_) => SettingsNtfySection( gateway: widget.client, connected: widget.client.state.kind == transport.ConnectionKind.connected, ), ), SettingsSection( id: 'data', title: 'Data management', keywords: 'storage retention worktrees cleanup disk usage', builder: (_) => _single( 'Data management', SettingsStorageSection(gateway: widget.client), ), ), SettingsSection( id: 'server', title: 'Server', keywords: 'health cpu memory gpu process stats', builder: (_) => _single('Server', SettingsHealthSection(gateway: widget.client)), ), if (widget.onOpenSchedules case final open?) SettingsSection( id: 'library', title: 'Library', keywords: 'schedules saved runs pipelines', builder: (_) => SettingsGroup( title: 'Library', leadingRows: true, children: [SettingsSchedulesSection(onOpen: open)], ), ), if (widget.showAndroidDownload) SettingsSection( id: 'android-app', title: 'Android app', keywords: 'apk download install', builder: (_) => _single('Android app', const SettingsAndroidDownloadSection()), ), if (widget.showSignIn && appUpdatesSupported) SettingsSection( id: 'app-updates', title: 'App updates', keywords: 'update version build install', builder: (_) => _single( 'App updates', SettingsUpdatesSection(endpoint: _endpoint, servers: servers), ), ) else if (!widget.showAndroidDownload) SettingsSection( id: 'app-updates-managed', title: 'App updates', keywords: 'update version build administrator', builder: (_) => _single( 'App updates', const Text( 'This installation is updated by its server administrator.', ), ), ), // Help and about: the walkthrough's "Show the walkthrough" row sits in // this group beside the keyboard shortcuts. SettingsSection( id: 'help', title: 'Help and about', keywords: 'keyboard shortcuts help about walkthrough tour guide', builder: (_) => SettingsGroup( title: 'Help and about', leadingRows: true, children: [ const SettingsKeyboardShortcutsSection(), SettingsRow( key: SettingsKeys.showWalkthrough, leading: const Icon(Icons.school_outlined), title: const Text('Show the walkthrough'), subtitle: const Text('Replay the short tour of Pipelines.'), chevron: true, enabled: widget.onShowWalkthrough != null, onTap: widget.onShowWalkthrough, ), ], ), ), ]; } static Widget _readAloudBuilder(BuildContext _) => const SettingsReadAloudSection(); /// A group holding one free-form block (a form, a status with buttons). Widget _single(String title, Widget child) => SettingsGroup( title: title, children: [SettingsGroupItem(child: child)], ); }