2022-05-24 08:06:58 +00:00
|
|
|
import 'package:cubit_form/cubit_form.dart';
|
|
|
|
import 'package:easy_localization/easy_localization.dart';
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
import 'package:selfprivacy/config/brand_theme.dart';
|
|
|
|
import 'package:selfprivacy/logic/cubit/forms/setup/initializing/backblaze_form_cubit.dart';
|
|
|
|
import 'package:selfprivacy/logic/cubit/server_installation/server_installation_cubit.dart';
|
2023-03-27 17:02:44 +00:00
|
|
|
import 'package:selfprivacy/ui/components/buttons/brand_button.dart';
|
2023-02-23 14:49:14 +00:00
|
|
|
import 'package:selfprivacy/ui/layouts/brand_hero_screen.dart';
|
2022-05-24 08:06:58 +00:00
|
|
|
import 'package:selfprivacy/ui/components/brand_md/brand_md.dart';
|
|
|
|
|
|
|
|
class RecoveryConfirmBackblaze extends StatelessWidget {
|
2022-10-26 16:26:09 +00:00
|
|
|
const RecoveryConfirmBackblaze({super.key});
|
2022-05-24 18:55:39 +00:00
|
|
|
|
2022-05-24 08:06:58 +00:00
|
|
|
@override
|
2022-06-05 19:36:32 +00:00
|
|
|
Widget build(final BuildContext context) {
|
2022-06-05 22:40:34 +00:00
|
|
|
final ServerInstallationCubit appConfig =
|
|
|
|
context.watch<ServerInstallationCubit>();
|
2022-05-24 08:06:58 +00:00
|
|
|
|
|
|
|
return BlocProvider(
|
2022-06-05 19:36:32 +00:00
|
|
|
create: (final BuildContext context) => BackblazeFormCubit(appConfig),
|
2022-06-05 22:40:34 +00:00
|
|
|
child: Builder(
|
|
|
|
builder: (final BuildContext context) {
|
|
|
|
final FormCubitState formCubitState =
|
|
|
|
context.watch<BackblazeFormCubit>().state;
|
2022-05-24 08:06:58 +00:00
|
|
|
|
2022-06-05 22:40:34 +00:00
|
|
|
return BrandHeroScreen(
|
|
|
|
heroTitle: 'recovering.confirm_backblaze'.tr(),
|
|
|
|
heroSubtitle: 'recovering.confirm_backblaze_description'.tr(),
|
|
|
|
hasBackButton: true,
|
2022-06-15 04:51:32 +00:00
|
|
|
onBackButtonPressed: () {
|
|
|
|
Navigator.of(context).popUntil((final route) => route.isFirst);
|
|
|
|
},
|
2022-06-05 22:40:34 +00:00
|
|
|
hasFlashButton: false,
|
|
|
|
children: [
|
|
|
|
CubitFormTextField(
|
|
|
|
formFieldCubit: context.read<BackblazeFormCubit>().keyId,
|
|
|
|
decoration: const InputDecoration(
|
|
|
|
border: OutlineInputBorder(),
|
|
|
|
labelText: 'KeyID',
|
|
|
|
),
|
2022-05-24 08:06:58 +00:00
|
|
|
),
|
2022-06-05 22:40:34 +00:00
|
|
|
const SizedBox(height: 16),
|
|
|
|
CubitFormTextField(
|
|
|
|
formFieldCubit:
|
|
|
|
context.read<BackblazeFormCubit>().applicationKey,
|
|
|
|
decoration: const InputDecoration(
|
|
|
|
border: OutlineInputBorder(),
|
|
|
|
labelText: 'Master Application Key',
|
|
|
|
),
|
2022-05-24 08:06:58 +00:00
|
|
|
),
|
2022-06-05 22:40:34 +00:00
|
|
|
const SizedBox(height: 16),
|
|
|
|
BrandButton.rised(
|
|
|
|
onPressed: formCubitState.isSubmitting
|
|
|
|
? null
|
|
|
|
: () => context.read<BackblazeFormCubit>().trySubmit(),
|
|
|
|
text: 'basis.connect'.tr(),
|
|
|
|
),
|
|
|
|
const SizedBox(height: 16),
|
|
|
|
BrandButton.text(
|
|
|
|
onPressed: () => showModalBottomSheet<void>(
|
|
|
|
context: context,
|
|
|
|
isScrollControlled: true,
|
|
|
|
backgroundColor: Colors.transparent,
|
2023-03-31 14:17:22 +00:00
|
|
|
builder: (final BuildContext context) => Padding(
|
2022-05-24 08:06:58 +00:00
|
|
|
padding: paddingH15V0,
|
2022-06-09 21:13:06 +00:00
|
|
|
child: ListView(
|
|
|
|
padding: const EdgeInsets.symmetric(vertical: 16),
|
|
|
|
children: const [
|
|
|
|
BrandMarkdown(
|
|
|
|
fileName: 'how_backblaze',
|
|
|
|
),
|
|
|
|
],
|
2022-05-24 08:06:58 +00:00
|
|
|
),
|
2022-06-05 19:36:32 +00:00
|
|
|
),
|
2022-06-05 22:40:34 +00:00
|
|
|
),
|
|
|
|
title: 'initializing.how'.tr(),
|
2022-05-24 08:06:58 +00:00
|
|
|
),
|
2022-06-05 22:40:34 +00:00
|
|
|
],
|
|
|
|
);
|
|
|
|
},
|
|
|
|
),
|
2022-05-24 08:06:58 +00:00
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|