selfprivacy.org.app/lib/ui/pages/setup/recovering/recovery_method_select.dart

117 lines
4.2 KiB
Dart
Raw Normal View History

import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart';
import 'package:selfprivacy/logic/cubit/server_installation/server_installation_cubit.dart';
import 'package:selfprivacy/ui/components/brand_button/brand_button.dart';
import 'package:selfprivacy/ui/components/brand_cards/brand_cards.dart';
import 'package:selfprivacy/ui/components/brand_hero_screen/brand_hero_screen.dart';
import 'package:selfprivacy/ui/pages/setup/recovering/recover_by_old_token.dart';
import 'package:selfprivacy/utils/route_transitions/basic.dart';
class RecoveryMethodSelect extends StatelessWidget {
2022-05-24 18:55:39 +00:00
const RecoveryMethodSelect({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return BrandHeroScreen(
2022-05-24 18:55:39 +00:00
heroTitle: 'recovering.recovery_main_header'.tr(),
heroSubtitle: 'recovering.method_select_description'.tr(),
hasBackButton: true,
hasFlashButton: false,
children: [
BrandCards.outlined(
child: ListTile(
title: Text(
2022-05-24 18:55:39 +00:00
'recovering.method_select_other_device'.tr(),
style: Theme.of(context).textTheme.titleMedium,
),
2022-05-24 18:55:39 +00:00
leading: const Icon(Icons.offline_share_outlined),
onTap: () => context
.read<ServerInstallationCubit>()
.selectRecoveryMethod(ServerRecoveryMethods.newDeviceKey),
),
),
2022-05-24 18:55:39 +00:00
const SizedBox(height: 16),
BrandCards.outlined(
child: ListTile(
title: Text(
2022-05-24 18:55:39 +00:00
'recovering.method_select_recovery_key'.tr(),
style: Theme.of(context).textTheme.titleMedium,
),
2022-05-24 18:55:39 +00:00
leading: const Icon(Icons.password_outlined),
onTap: () => context
.read<ServerInstallationCubit>()
.selectRecoveryMethod(ServerRecoveryMethods.recoveryKey),
),
),
2022-05-24 18:55:39 +00:00
const SizedBox(height: 16),
BrandButton.text(
2022-05-24 18:55:39 +00:00
title: 'recovering.method_select_nothing'.tr(),
onPressed: () => Navigator.of(context)
.push(materialRoute(RecoveryFallbackMethodSelect())),
)
],
);
}
}
class RecoveryFallbackMethodSelect extends StatelessWidget {
2022-05-24 18:55:39 +00:00
const RecoveryFallbackMethodSelect({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return BrandHeroScreen(
2022-05-24 18:55:39 +00:00
heroTitle: 'recovering.recovery_main_header'.tr(),
heroSubtitle: 'recovering.fallback_select_description'.tr(),
hasBackButton: true,
hasFlashButton: false,
children: [
BrandCards.outlined(
child: ListTile(
title: Text(
2022-05-24 18:55:39 +00:00
'recovering.fallback_select_token_copy'.tr(),
style: Theme.of(context).textTheme.titleMedium,
),
2022-05-24 18:55:39 +00:00
leading: const Icon(Icons.vpn_key),
onTap: () => Navigator.of(context)
2022-05-24 18:55:39 +00:00
.push(materialRoute(const RecoverByOldTokenInstruction(
instructionFilename: 'how_fallback_old',
))),
),
),
2022-05-24 18:55:39 +00:00
const SizedBox(height: 16),
BrandCards.outlined(
child: ListTile(
title: Text(
2022-05-24 18:55:39 +00:00
'recovering.fallback_select_root_ssh'.tr(),
style: Theme.of(context).textTheme.titleMedium,
),
2022-05-24 18:55:39 +00:00
leading: const Icon(Icons.terminal),
onTap: () => Navigator.of(context)
2022-05-24 18:55:39 +00:00
.push(materialRoute(const RecoverByOldTokenInstruction(
instructionFilename: 'how_fallback_ssh',
))),
),
),
2022-05-24 18:55:39 +00:00
const SizedBox(height: 16),
BrandCards.outlined(
child: ListTile(
title: Text(
2022-05-24 18:55:39 +00:00
'recovering.fallback_select_provider_console'.tr(),
style: Theme.of(context).textTheme.titleMedium,
),
subtitle: Text(
2022-05-24 18:55:39 +00:00
'recovering.fallback_select_provider_console_hint'.tr(),
style: Theme.of(context).textTheme.bodyMedium,
),
2022-05-24 18:55:39 +00:00
leading: const Icon(Icons.web),
onTap: () => Navigator.of(context)
2022-05-24 18:55:39 +00:00
.push(materialRoute(const RecoverByOldTokenInstruction(
instructionFilename: 'how_fallback_terminal',
))),
),
),
],
);
}
}