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

83 lines
3.3 KiB
Dart
Raw Normal View History

import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart';
import 'package:selfprivacy/config/brand_theme.dart';
2022-07-13 11:58:23 +00:00
import 'package:selfprivacy/logic/cubit/forms/setup/initializing/provider_form_cubit.dart';
import 'package:selfprivacy/ui/components/brand_bottom_sheet/brand_bottom_sheet.dart';
2022-05-24 18:55:39 +00:00
import 'package:selfprivacy/ui/components/brand_button/filled_button.dart';
import 'package:selfprivacy/ui/components/brand_button/brand_button.dart';
import 'package:selfprivacy/ui/components/brand_hero_screen/brand_hero_screen.dart';
import 'package:cubit_form/cubit_form.dart';
import 'package:selfprivacy/logic/cubit/server_installation/server_installation_cubit.dart';
import 'package:selfprivacy/ui/components/brand_md/brand_md.dart';
class RecoveryHetznerConnected extends StatelessWidget {
const RecoveryHetznerConnected({final super.key});
2022-05-24 18:55:39 +00:00
@override
2022-06-05 19:36:32 +00:00
Widget build(final BuildContext context) {
final ServerInstallationCubit appConfig =
context.watch<ServerInstallationCubit>();
return BlocProvider(
2022-07-12 12:54:16 +00:00
create: (final BuildContext context) => ProviderFormCubit(appConfig),
child: Builder(
2022-06-05 19:36:32 +00:00
builder: (final BuildContext context) {
final FormCubitState formCubitState =
2022-07-12 12:54:16 +00:00
context.watch<ProviderFormCubit>().state;
return BrandHeroScreen(
2022-05-24 18:55:39 +00:00
heroTitle: 'recovering.hetzner_connected'.tr(),
heroSubtitle: 'recovering.hetzner_connected_description'.tr(
args: [appConfig.state.serverDomain?.domainName ?? 'your domain'],
),
hasBackButton: true,
hasFlashButton: false,
onBackButtonPressed: () {
Navigator.of(context).popUntil((final route) => route.isFirst);
},
children: [
CubitFormTextField(
2022-07-12 12:54:16 +00:00
formFieldCubit: context.read<ProviderFormCubit>().apiKey,
decoration: InputDecoration(
2022-05-24 18:55:39 +00:00
border: const OutlineInputBorder(),
labelText: 'recovering.hetzner_connected_placeholder'.tr(),
),
),
2022-05-24 18:55:39 +00:00
const SizedBox(height: 16),
FilledButton(
2022-05-24 18:55:39 +00:00
title: 'more.continue'.tr(),
onPressed: formCubitState.isSubmitting
? null
2022-07-12 12:54:16 +00:00
: () => context.read<ProviderFormCubit>().trySubmit(),
),
2022-05-24 18:55:39 +00:00
const SizedBox(height: 16),
BrandButton.text(
title: 'initializing.how'.tr(),
onPressed: () => showModalBottomSheet<void>(
context: context,
isScrollControlled: true,
backgroundColor: Colors.transparent,
2022-06-09 21:13:06 +00:00
builder: (final BuildContext context) => BrandBottomSheet(
isExpended: true,
child: Padding(
padding: paddingH15V0,
2022-06-09 21:13:06 +00:00
child: ListView(
padding: const EdgeInsets.symmetric(vertical: 16),
children: const [
BrandMarkdown(
fileName: 'how_hetzner',
),
],
),
),
),
),
),
],
);
},
),
);
}
}