import 'package:auto_route/auto_route.dart'; import 'package:easy_localization/easy_localization.dart'; import 'package:flutter/material.dart'; import 'package:selfprivacy/config/get_it_config.dart'; import 'package:selfprivacy/logic/api_maps/tls_options.dart'; import 'package:selfprivacy/logic/cubit/app_settings/app_settings_cubit.dart'; import 'package:selfprivacy/logic/cubit/devices/devices_cubit.dart'; import 'package:selfprivacy/logic/cubit/recovery_key/recovery_key_cubit.dart'; import 'package:selfprivacy/ui/layouts/brand_hero_screen.dart'; @RoutePage() class DeveloperSettingsPage extends StatefulWidget { const DeveloperSettingsPage({super.key}); @override State createState() => _DeveloperSettingsPageState(); } class _DeveloperSettingsPageState extends State { @override Widget build(final BuildContext context) => BrandHeroScreen( hasBackButton: true, hasFlashButton: false, bodyPadding: const EdgeInsets.symmetric(vertical: 16), heroTitle: 'developer_settings.title'.tr(), heroSubtitle: 'developer_settings.subtitle'.tr(), children: [ Padding( padding: const EdgeInsets.all(16), child: Text( 'developer_settings.server_setup'.tr(), style: Theme.of(context).textTheme.labelLarge!.copyWith( color: Theme.of(context).colorScheme.secondary, ), ), ), SwitchListTile( title: Text('developer_settings.use_staging_acme'.tr()), subtitle: Text('developer_settings.use_staging_acme_description'.tr()), value: TlsOptions.stagingAcme, onChanged: (final bool value) => setState( () => TlsOptions.stagingAcme = value, ), ), SwitchListTile( title: Text('developer_settings.ignore_tls'.tr()), subtitle: Text('developer_settings.ignore_tls_description'.tr()), value: TlsOptions.verifyCertificate, onChanged: (final bool value) => setState( () => TlsOptions.verifyCertificate = value, ), ), SwitchListTile( title: Text('developer_settings.allow_ssh_key_at_setup'.tr()), subtitle: Text( 'developer_settings.allow_ssh_key_at_setup_description'.tr(), ), value: TlsOptions.allowCustomSshKeyDuringSetup, onChanged: (final bool value) => setState( () => TlsOptions.allowCustomSshKeyDuringSetup = value, ), ), Padding( padding: const EdgeInsets.all(16), child: Text( 'developer_settings.routing'.tr(), style: Theme.of(context).textTheme.labelLarge!.copyWith( color: Theme.of(context).colorScheme.secondary, ), ), ), ListTile( title: Text('developer_settings.reset_onboarding'.tr()), subtitle: Text('developer_settings.reset_onboarding_description'.tr()), enabled: !context.watch().state.isOnboardingShowing, onTap: () => context .read() .turnOffOnboarding(isOnboardingShowing: true), ), Padding( padding: const EdgeInsets.all(16), child: Text( 'developer_settings.cubit_statuses'.tr(), style: Theme.of(context).textTheme.labelLarge!.copyWith( color: Theme.of(context).colorScheme.secondary, ), ), ), ListTile( title: const Text('ApiDevicesCubit'), subtitle: Text( context.watch().state.status.toString(), ), ), ListTile( title: const Text('RecoveryKeyCubit'), subtitle: Text( context.watch().state.loadingStatus.toString(), ), ), ListTile( title: const Text('ApiConnectionRepository status'), subtitle: Text( getIt() .currentConnectionStatus .toString(), ), ), ], ); }