part of 'settings_screen.dart'; extension _SettingsTopicPages on _SettingsScreenState { Map _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)), if (widget.onOpenSchedules != null || widget.onOpenTemplates != null) SettingsGroup( title: 'Library', leadingRows: true, children: [ if (widget.onOpenSchedules case final open?) SettingsSchedulesSection(onOpen: open), if (widget.onOpenTemplates case final open?) SettingsTemplatesSection(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: [SettingsGroupItem(child: child)], ); }